12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- using InABox.Core;
- using System;
- using System.Linq;
- namespace Comal.Classes
- {
- [UserTracking(typeof(Product))]
- public class ProductStyle : Entity, IRemotable, IPersistent, IProductStyle, ILicense<ProductManagementLicense>, IMergeable, IIssues, IProblems<ManagedProblem>
- {
- [EditorSequence(1)]
- [UniqueCodeEditor(Visible = Visible.Default, Editable = Editable.Enabled)]
- public string Code { get; set; } = "";
- [EditorSequence(2)]
- [TextBoxEditor]
- public string Description { get; set; } = "";
- [EditorSequence(3)]
- [DataModelTableName("Image")]
- public ImageDocumentLink Image { get; set; }
- private class TreatmentTypeLookup : LookupDefinitionGenerator<TreatmentType, Product>
- {
- public override Filter<TreatmentType>? DefineFilter(Product[] items)
- {
- return new Filter<TreatmentType>(x => x.Active).IsEqualTo(true);
- }
- }
- [LookupDefinition(typeof(TreatmentTypeLookup))]
- [EditorSequence(4)]
- public TreatmentTypeLink TreatmentType { get; set; }
-
-
- [NullEditor]
- [Obsolete("Replaced with Problem", true)]
- public string Issues { get; set; }
-
- [EditorSequence("Issues", 1)]
- public ManagedProblem Problem { get; set; }
- private class TreatmentProductLookup : LookupDefinitionGenerator<Product, ProductStyle>
- {
- public override Filter<Product>? DefineFilter(ProductStyle[] items)
- {
- var treatmentID = items.Select(x => x.TreatmentType.ID).SingleOrDefault();
- if(treatmentID == Guid.Empty)
- {
- return Filter.None<Product>();
- }
- else
- {
- return new Filter<Product>(x => x.TreatmentType.ID).IsEqualTo(treatmentID);
- }
- }
- public override Columns<ProductStyle> DefineFilterColumns()
- {
- return Columns.None<ProductStyle>().Add(x => x.TreatmentType.ID);
- }
- }
- [LookupDefinition(typeof(TreatmentProductLookup))]
- public ProductLink ManufacturingTreatmentProduct { get; set; }
-
- [LookupDefinition(typeof(TreatmentProductLookup))]
- public ProductLink StockTreatmentProduct { get; set; }
- public override string ToString() => $"{Code}: {Description}";
- }
- }
|