Esempio n. 1
0
        private void OnAddOrderLine(object obj)
        {
            SelAircraftLeaseOrderLineDTO = new AircraftLeaseOrderLineDTO
            {
                Id = RandomHelper.Next(),
                Amount = 1,
                EstimateDeliveryDate = DateTime.Now,
                ContractAircraftId = RandomHelper.Next()
            };

            SelAircraftLeaseOrderDTO.AircraftLeaseOrderLines.Add(SelAircraftLeaseOrderLineDTO);
        }
Esempio n. 2
0
 private void OnAddOrder(object obj)
 {
     if (SelAircraftLeaseOrderDTO == null)
     {
         SelAircraftLeaseOrderDTO = new AircraftLeaseOrderDTO
         {
             Id = RandomHelper.Next(),
             OrderDate = DateTime.Now,
             TradeId = _selTradeDTO.Id,
             SourceGuid = Guid.NewGuid(),
             SupplierId = _selTradeDTO.SupplierId,
             OperatorName = StatusData.curUser
         };
         var currency = Currencies.FirstOrDefault();
         if (currency != null)
             SelAircraftLeaseOrderDTO.CurrencyId = currency.Id;
         ViewAircraftLeaseOrderDTO.AddNew(SelAircraftLeaseOrderDTO);
         SelTradeDTO.Status = (int) TradeStatus.进行中;
     }
     else
     {
         var order =
             ViewAircraftLeaseOrderDTO.Where(o => o.TradeId == _selTradeDTO.Id)
                 .OrderBy(o => o.Version)
                 .LastOrDefault();
         if (order == null) return;
         SelAircraftLeaseOrderDTO = new AircraftLeaseOrderDTO
         {
             Id = RandomHelper.Next(),
             OrderDate = DateTime.Now,
             TradeId = order.TradeId,
             Name = order.Name,
             CurrencyId = order.CurrencyId,
             LinkmanId = order.LinkmanId,
             SourceGuid = Guid.NewGuid(),
             SupplierId = order.SupplierId,
             OperatorName = StatusData.curUser
         };
         var currency = Currencies.FirstOrDefault();
         if (currency != null)
             SelAircraftLeaseOrderDTO.CurrencyId = currency.Id;
         ViewAircraftLeaseOrderDTO.AddNew(SelAircraftLeaseOrderDTO);
         order.AircraftLeaseOrderLines.ToList().ForEach(line =>
         {
             var newLine = new AircraftLeaseOrderLineDTO
             {
                 Id = RandomHelper.Next(),
                 UnitPrice = line.UnitPrice,
                 Amount = line.Amount,
                 Discount = line.Discount,
                 EstimateDeliveryDate = line.EstimateDeliveryDate,
                 Note = line.Note,
                 ContractAircraftId = line.ContractAircraftId,
                 AircraftMaterialId = line.AircraftMaterialId,
                 RankNumber = line.RankNumber,
                 CSCNumber = line.CSCNumber,
                 SerialNumber = line.SerialNumber,
                 Status = line.Status
             };
             SelAircraftLeaseOrderDTO.AircraftLeaseOrderLines.Add(newLine);
         });
     }
     RefreshCommandState();
 }