Example #1
0
     private void FixupCommodity(Commodity previousValue, bool skipKeys = false)
     {
         if (IsDeserializing)
         {
             return;
         }
 
         if (previousValue != null && previousValue.TDPositions.Contains(this))
         {
             previousValue.TDPositions.Remove(this);
         }
 
         if (Commodity != null)
         {
             if (!Commodity.TDPositions.Contains(this))
             {
                 Commodity.TDPositions.Add(this);
             }
 
             CommodityId = Commodity.Id;
         }
         else if (!skipKeys)
         {
             CommodityId = null;
         }
 
         if (ChangeTracker.ChangeTrackingEnabled)
         {
             if (ChangeTracker.OriginalValues.ContainsKey("Commodity")
                 && (ChangeTracker.OriginalValues["Commodity"] == Commodity))
             {
                 ChangeTracker.OriginalValues.Remove("Commodity");
             }
             else
             {
                 ChangeTracker.RecordOriginalValue("Commodity", previousValue);
             }
             if (Commodity != null && !Commodity.ChangeTracker.ChangeTrackingEnabled)
             {
                 Commodity.StartTracking();
             }
         }
     }
Example #2
0
        public DeliveryLineVM(int id, Commodity commodity, List<DeliveryLine> deliveryLines,
                              List<DeliveryLine> addDeliveryLines, List<DeliveryLine> updateDeliveryLines,DeliveryType deliveryType)
        {
            ObjectId = id;
            OldID = id;
            DeliveryType = deliveryType;
            DeliveryLines = deliveryLines;
            //SetID(id);
            AllDeliveryPersonList = new List<WarehouseOutDeliveryPerson>();
            AddDeliveryPersonList = new List<WarehouseOutDeliveryPerson>();
            UpdateDeliveryPersonList = new List<WarehouseOutDeliveryPerson>();
            DeleteDeliveryPersonList = new List<WarehouseOutDeliveryPerson>();

            AddedDeliveryLines = addDeliveryLines;
            UpdatedDeliveryLines = updateDeliveryLines;
            Commodity = commodity;
            CommodityId = commodity.Id;
            
            _startStatus = true;
            LoadCommodityType();
            LoadCountry();
            LoadDeliveryLine(GetDeliveryLineFromList(id, deliveryLines));

            LoadStatus();
            LoadDocumentLineEnableProperty(ObjectId);
            PropertyChanged += OnPropertyChanged;
        }
Example #3
0
        public DeliveryLineVM(DeliveryLine deliveryLine, Commodity commodity)
        {
            AllDeliveryPersonList = new List<WarehouseOutDeliveryPerson>();
            AddDeliveryPersonList = new List<WarehouseOutDeliveryPerson>();
            UpdateDeliveryPersonList = new List<WarehouseOutDeliveryPerson>();
            DeleteDeliveryPersonList = new List<WarehouseOutDeliveryPerson>();

            Id = deliveryLine.Id;
            CurrentDeliveryLine = deliveryLine;
            Commodity = commodity;
            CommodityId = commodity.Id;
            PBNo = deliveryLine.PBNo;
            NetWeight = deliveryLine.NetWeight;
            GrossWeight = deliveryLine.GrossWeight;
            VerifiedWeight = deliveryLine.VerifiedWeight;
            CountryId = deliveryLine.CountryId;
            Country = deliveryLine.Country;
            BrandId = deliveryLine.BrandId;
            PackingQuantity = deliveryLine.PackingQuantity;
            IsVerified = deliveryLine.IsVerified;
            DlvLineIsVerified = deliveryLine.IsVerified;
            Comment = deliveryLine.Comment;
            DeliveryStatus = deliveryLine.DeliveryStatus?1:0;
            _fDPLineId = deliveryLine.FDPLineId;

            _startStatus = true;
            LoadCommodityType();
            LoadBrandAndSpecification();
            LoadCountry();
            LoadStatus();
            LoadDocumentLineEnableProperty(Id);
            PropertyChanged += OnPropertyChanged;
        }
Example #4
0
        public DeliveryLineVM(Commodity commodity, CommodityType commodityType, Brand brand, Specification specification,
                              List<DeliveryLine> deliveryLines, List<DeliveryLine> addDeliveryLines,DeliveryType deliveryType,decimal? qty)
        {
            ObjectId = 0;
            DeliveryType = deliveryType;
            AllDeliveryPersonList = new List<WarehouseOutDeliveryPerson>();
            AddDeliveryPersonList = new List<WarehouseOutDeliveryPerson>();
            DeliveryLines = deliveryLines;
            AddedDeliveryLines = addDeliveryLines;
            Commodity = commodity;
            CommodityId = commodity.Id;
            CommodityTypeId = commodityType.Id;
            _brandId = brand == null ? 0 : brand.Id;

            SpecificationId = specification == null ? 0 : specification.Id;

            _startStatus = true;
            LoadCommodityType();

            LoadCountry();
            LoadStatus();
            LoadDocumentLineEnableProperty(ObjectId);

            if (deliveryLines == null || deliveryLines.Count == 0)
            { 
                //第一次新增
                if (deliveryType == DeliveryType.ExternalTDBOL || deliveryType == DeliveryType.ExternalTDWW)
                {
                    NetWeight = qty;
                    GrossWeight = qty;
                }
                else if (deliveryType == DeliveryType.InternalTDBOL || deliveryType == DeliveryType.InternalTDWW)
                {
                    NetWeight = qty;
                    VerifiedWeight = qty;
                }
            }
            PropertyChanged += OnPropertyChanged;
        }
Example #5
0
        public void Link(Commodity c)
        {
            if (Allocated.Contains(c))
            {
                throw new Exception(ResUserSetting.CommodityDuplicated);
            }

            if (!NotAllocated.Contains(c))
            {
                throw new Exception(ResUserSetting.CommodityNotFound);
            }

            Allocated.Add(c);
            NotAllocated.Remove(c);
        }