예제 #1
0
 /// <summary>
 ///     执行确定命令。
 /// </summary>
 /// <param name="sender"></param>
 public void OnCommitExecute(object sender)
 {
     if (SelectMaintainPaymentSchedule != null)
     {
         if (SelectPaymentScheduleLine == null)
         {
             MessageAlert("请选择一条付款计划行!");
         }
         else
         {
             if (_currentType == typeof (AirframeMaintainInvoiceDTO))
             {
                 var maintainInvoice = new AirframeMaintainInvoiceDTO
                 {
                     AirframeMaintainInvoiceId = RandomHelper.Next(),
                     CreateDate = DateTime.Now,
                     InvoiceDate = DateTime.Now,
                     InMaintainTime = DateTime.Now,
                     OutMaintainTime = DateTime.Now,
                     SupplierId = SelectMaintainPaymentSchedule.SupplierId,
                     SupplierName = SelectMaintainPaymentSchedule.SupplierName,
                     CurrencyId = SelectMaintainPaymentSchedule.CurrencyId,
                     PaymentScheduleLineId = SelectPaymentScheduleLine.PaymentScheduleLineId,
                     OperatorName = StatusData.curUser
                 };
                 prepayPayscheduleChildView.Tag = maintainInvoice;
             }
             else if (_currentType == typeof (APUMaintainInvoiceDTO))
             {
                 var maintainInvoice = new APUMaintainInvoiceDTO
                 {
                     APUMaintainInvoiceId = RandomHelper.Next(),
                     CreateDate = DateTime.Now,
                     InvoiceDate = DateTime.Now,
                     InMaintainTime = DateTime.Now,
                     OutMaintainTime = DateTime.Now,
                     SupplierId = SelectMaintainPaymentSchedule.SupplierId,
                     SupplierName = SelectMaintainPaymentSchedule.SupplierName,
                     CurrencyId = SelectMaintainPaymentSchedule.CurrencyId,
                     PaymentScheduleLineId = SelectPaymentScheduleLine.PaymentScheduleLineId,
                 };
                 prepayPayscheduleChildView.Tag = maintainInvoice;
             }
             else if (_currentType == typeof (EngineMaintainInvoiceDTO))
             {
                 var maintainInvoice = new EngineMaintainInvoiceDTO
                 {
                     EngineMaintainInvoiceId = RandomHelper.Next(),
                     CreateDate = DateTime.Now,
                     InvoiceDate = DateTime.Now,
                     InMaintainTime = DateTime.Now,
                     OutMaintainTime = DateTime.Now,
                     SupplierId = SelectMaintainPaymentSchedule.SupplierId,
                     SupplierName = SelectMaintainPaymentSchedule.SupplierName,
                     CurrencyId = SelectMaintainPaymentSchedule.CurrencyId,
                     PaymentScheduleLineId = SelectPaymentScheduleLine.PaymentScheduleLineId,
                 };
                 prepayPayscheduleChildView.Tag = maintainInvoice;
             }
             else if (_currentType == typeof (UndercartMaintainInvoiceDTO))
             {
                 var maintainInvoice = new UndercartMaintainInvoiceDTO
                 {
                     UndercartMaintainInvoiceId = RandomHelper.Next(),
                     CreateDate = DateTime.Now,
                     InvoiceDate = DateTime.Now,
                     InMaintainTime = DateTime.Now,
                     OutMaintainTime = DateTime.Now,
                     SupplierId = SelectMaintainPaymentSchedule.SupplierId,
                     SupplierName = SelectMaintainPaymentSchedule.SupplierName,
                     CurrencyId = SelectMaintainPaymentSchedule.CurrencyId,
                     PaymentScheduleLineId = SelectPaymentScheduleLine.PaymentScheduleLineId,
                 };
                 prepayPayscheduleChildView.Tag = maintainInvoice;
             }
             else
             {
                 var maintainInvoice = new SpecialRefitInvoiceDTO
                 {
                     SpecialRefitId = RandomHelper.Next(),
                     CreateDate = DateTime.Now,
                     InvoiceDate = DateTime.Now,
                     SupplierId = SelectMaintainPaymentSchedule.SupplierId,
                     SupplierName = SelectMaintainPaymentSchedule.SupplierName,
                     CurrencyId = SelectMaintainPaymentSchedule.CurrencyId,
                     PaymentScheduleLineId = SelectPaymentScheduleLine.PaymentScheduleLineId,
                 };
                 prepayPayscheduleChildView.Tag = maintainInvoice;
             }
             prepayPayscheduleChildView.Close();
         }
     }
     else
     {
         MessageAlert("未选中维修付款计划!");
     }
 }
예제 #2
0
 protected override void OnAddInvoice(object obj)
 {
     MessageConfirm("是否根据付款计划创建?", (s, arg) =>
     {
         if (arg.DialogResult != true)
         {
             EngineMaintainInvoice = new EngineMaintainInvoiceDTO
             {
                 EngineMaintainInvoiceId =
                     RandomHelper.Next(),
                 CreateDate = DateTime.Now,
                 InvoiceDate = DateTime.Now,
                 InMaintainTime = DateTime.Now,
                 OutMaintainTime = DateTime.Now,
                 OperatorName = StatusData.curUser
             };
             var currency = Currencies.FirstOrDefault();
             if (currency != null)
                 EngineMaintainInvoice.CurrencyId = currency.Id;
             var supplier = Suppliers.FirstOrDefault();
             if (supplier != null)
             {
                 EngineMaintainInvoice.SupplierId = supplier.SupplierId;
                 EngineMaintainInvoice.SupplierName = supplier.Name;
             }
             EngineMaintainInvoices.AddNew(EngineMaintainInvoice);
             return;
         }
         PrepayPayscheduleChildView.ViewModel.InitData(
             typeof (EngineMaintainInvoiceDTO), PrepayPayscheduleChildViewClosed);
         PrepayPayscheduleChildView.ShowDialog();
     });
 }