| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 | using System;using System.Linq;using InABox.Core;namespace Comal.Classes{    public class JobBillOfMaterialsItem : DimensionedEntity<StockDimensions>, IRemotable, IPersistent, IOneToMany<Job>,         IOneToMany<JobBillOfMaterials>, ISequenceable, ILicense<ProjectManagementLicense>, IJobMaterial    {        [NullEditor]        [EntityRelationship(DeleteAction.Cascade)]        public JobLink Job { get; set; }        [NullEditor]        [EntityRelationship(DeleteAction.Cascade)]        public JobBillOfMaterialsLink BillOfMaterials { get; set; }        [EditorSequence(1)]        [TextBoxEditor]        public string Section { get; set; }        [EditorSequence(2)]        [EntityRelationship(DeleteAction.SetNull)]        public JobITPLink ITP { get; set; }        [EditorSequence(3)]        [EntityRelationship(DeleteAction.SetNull)]        public ProductLink Product { get; set; }        [EditorSequence(4)]        [EntityRelationship(DeleteAction.SetNull)]        public ProductStyleLink Style { get; set; }        [NullEditor]        [Obsolete("Replaced by Dimensions",true)]        public double UnitSize { get; set; }        [EditorSequence(5)]        [RequiredColumn]        public override StockDimensions Dimensions { get; set; }                [EditorSequence(6)]        public double Quantity { get; set; }        [EditorSequence(7)]        public SupplierLink Supplier { get; set; }        [NullEditor]        public long Sequence { get; set; }        protected override void Init()        {            base.Init();            Job = new JobLink();            BillOfMaterials = new JobBillOfMaterialsLink();            ITP = new JobITPLink();                        Product = new ProductLink();            Product.PropertyChanged += Product_PropertyChanged;            //LinkProperty<ProductLink, JobBillOfMaterialsItem>(x => x.UnitSize, x => x.UnitSize);            Style = new ProductStyleLink();            LinkProperty<ProductLink, JobBillOfMaterialsItem>(x => x.DefaultStyle.ID, x => x.Style.ID);                        Supplier = new SupplierLink();            Dimensions = new StockDimensions();        }        private void Product_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)        {        }        private static Column<JobRequisitionItem> dimensions = new Column<JobRequisitionItem>(x => x.Product.Dimensions);        private static Column<JobRequisitionItem> style = new Column<JobRequisitionItem>(x => x.Product.DefaultStyle);                private bool bChanging;        protected override void DoPropertyChanged(string name, object before, object after)        {            if (bChanging)                return;            if (dimensions.IsParentOf(name))            {                bChanging = true;                String col = String.Join(".", name.Split('.').Skip(1));                CoreUtils.SetPropertyValue(this, col, after);                bChanging = false;            }                                    else if (style.IsParentOf(name))            {                bChanging = true;                String col = String.Join(".", name.Split('.').Skip(1));                CoreUtils.SetPropertyValue(this, col, after);                bChanging = false;            }            else                base.DoPropertyChanged(name, before, after);        }            }}
 |