/// <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("未选中维修付款计划!"); } }
protected override void OnAddInvoice(object obj) { MessageConfirm("是否根据付款计划创建?", (s, arg) => { if (arg.DialogResult != true) { UndercartMaintainInvoice = new UndercartMaintainInvoiceDTO { UndercartMaintainInvoiceId = RandomHelper.Next(), CreateDate = DateTime.Now, InvoiceDate = DateTime.Now, InMaintainTime = DateTime.Now, OutMaintainTime = DateTime.Now, OperatorName = StatusData.curUser }; var currency = Currencies.FirstOrDefault(); if (currency != null) UndercartMaintainInvoice.CurrencyId = currency.Id; var supplier = Suppliers.FirstOrDefault(); if (supplier != null) { UndercartMaintainInvoice.SupplierId = supplier.SupplierId; UndercartMaintainInvoice.SupplierName = supplier.Name; } UndercartMaintainInvoices.AddNew(UndercartMaintainInvoice); return; } PrepayPayscheduleChildView.ViewModel.InitData( typeof (UndercartMaintainInvoiceDTO), PrepayPayscheduleChildViewClosed); PrepayPayscheduleChildView.ShowDialog(); }); }