Пример #1
0
 public void InsertUndercartMaintainInvoice(UndercartMaintainInvoiceDTO undercartMaintainInvoice)
 {
     Supplier supplier = _supplierRepository.Get(undercartMaintainInvoice.SupplierId);
     undercartMaintainInvoice.SupplierName = supplier.CnName;
     UndercartMaintainInvoice newUndercartMaintainInvoice =
         MaintainInvoiceFactory.CreateUndercartMaintainInvoice();
     newUndercartMaintainInvoice.SetInvoiceNumber(GetMaxInvoiceNumber());
     MaintainInvoiceFactory.SetMaintainInvoice(newUndercartMaintainInvoice, undercartMaintainInvoice.SerialNumber,
         undercartMaintainInvoice.InvoideCode, undercartMaintainInvoice.InvoiceDate,
         undercartMaintainInvoice.SupplierName, undercartMaintainInvoice.SupplierId,
         undercartMaintainInvoice.InvoiceValue, undercartMaintainInvoice.PaidAmount,
         undercartMaintainInvoice.OperatorName,
         undercartMaintainInvoice.Reviewer, undercartMaintainInvoice.Status, undercartMaintainInvoice.CurrencyId,
         undercartMaintainInvoice.DocumentName, undercartMaintainInvoice.DocumentId,
         undercartMaintainInvoice.PaymentScheduleLineId,
         undercartMaintainInvoice.InMaintainTime, undercartMaintainInvoice.OutMaintainTime);
     if (undercartMaintainInvoice.MaintainInvoiceLines != null)
     {
         foreach (MaintainInvoiceLineDTO maintainInvoiceLine in undercartMaintainInvoice.MaintainInvoiceLines)
         {
             MaintainInvoiceLine newMaintainInvoiceLine = MaintainInvoiceFactory.CreateInvoiceLine();
             MaintainInvoiceFactory.SetInvoiceLine(newMaintainInvoiceLine, maintainInvoiceLine.MaintainItem,
                 maintainInvoiceLine.ItemName, maintainInvoiceLine.UnitPrice, maintainInvoiceLine.Amount,
                 maintainInvoiceLine.Note);
             newUndercartMaintainInvoice.InvoiceLines.Add(newMaintainInvoiceLine);
         }
     }
     newUndercartMaintainInvoice.SetInvoiceValue();
     _invoiceRepository.Add(newUndercartMaintainInvoice);
     var maintainCost = new UndercartMaintainCostDTO
     {
         MaintainInvoiceId = newUndercartMaintainInvoice.Id,
         Year = newUndercartMaintainInvoice.InvoiceDate.Year
     };
     _maintainCostAppService.InsertUndercartMaintainCost(maintainCost);
 }
Пример #2
0
 public void ModifyUndercartMaintainInvoice(UndercartMaintainInvoiceDTO undercartMaintainInvoice)
 {
     Supplier supplier = _supplierRepository.Get(undercartMaintainInvoice.SupplierId);
     undercartMaintainInvoice.SupplierName = supplier.CnName;
     MaintainInvoice updateUndercartMaintainInvoice =
         _invoiceRepository.GetMaintainInvoice(undercartMaintainInvoice.UndercartMaintainInvoiceId); //获取需要更新的对象。
     MaintainInvoiceFactory.SetMaintainInvoice(updateUndercartMaintainInvoice,
         undercartMaintainInvoice.SerialNumber,
         undercartMaintainInvoice.InvoideCode, undercartMaintainInvoice.InvoiceDate,
         undercartMaintainInvoice.SupplierName, undercartMaintainInvoice.SupplierId,
         undercartMaintainInvoice.InvoiceValue, undercartMaintainInvoice.PaidAmount,
         undercartMaintainInvoice.OperatorName,
         undercartMaintainInvoice.Reviewer, undercartMaintainInvoice.Status, undercartMaintainInvoice.CurrencyId,
         undercartMaintainInvoice.DocumentName, undercartMaintainInvoice.DocumentId,
         undercartMaintainInvoice.PaymentScheduleLineId,
         undercartMaintainInvoice.InMaintainTime, undercartMaintainInvoice.OutMaintainTime);
     UpdateMaintainInvoiceLines(undercartMaintainInvoice.MaintainInvoiceLines, updateUndercartMaintainInvoice);
     _invoiceRepository.Modify(updateUndercartMaintainInvoice);
 }
Пример #3
0
 public void DeleteUndercartMaintainInvoice(UndercartMaintainInvoiceDTO undercartMaintainInvoice)
 {
     MaintainInvoice deleteUndercartMaintainInvoice =
         _invoiceRepository.GetMaintainInvoice(undercartMaintainInvoice.UndercartMaintainInvoiceId);
     //获取需要删除的对象。
     UpdateMaintainInvoiceLines(new List<MaintainInvoiceLineDTO>(), deleteUndercartMaintainInvoice);
     _invoiceRepository.Remove(deleteUndercartMaintainInvoice); //删除Undercart维修发票。
 }