コード例 #1
0
 /// <summary>
 ///     更新发票行集合
 /// </summary>
 /// <param name="sourceMaintainInvoiceLines">客户端集合</param>
 /// <param name="dstMaintainInvoice">数据库集合</param>
 private void UpdateMaintainInvoiceLines(IEnumerable<MaintainInvoiceLineDTO> sourceMaintainInvoiceLines,
     MaintainInvoice dstMaintainInvoice)
 {
     var maintainInvoiceLines = new List<MaintainInvoiceLine>();
     foreach (MaintainInvoiceLineDTO sourceMaintainInvoiceLine in sourceMaintainInvoiceLines)
     {
         MaintainInvoiceLine result =
             dstMaintainInvoice.InvoiceLines.FirstOrDefault(
                 p => p.Id == sourceMaintainInvoiceLine.MaintainInvoiceLineId);
         if (result == null)
         {
             result = MaintainInvoiceFactory.CreateInvoiceLine();
             result.ChangeCurrentIdentity(sourceMaintainInvoiceLine.MaintainInvoiceLineId);
         }
         MaintainInvoiceFactory.SetInvoiceLine(result, sourceMaintainInvoiceLine.MaintainItem,
             sourceMaintainInvoiceLine.ItemName, sourceMaintainInvoiceLine.UnitPrice,
             sourceMaintainInvoiceLine.Amount,
             sourceMaintainInvoiceLine.Note);
         maintainInvoiceLines.Add(result);
     }
     dstMaintainInvoice.InvoiceLines.ToList().ForEach(p =>
     {
         if (maintainInvoiceLines.FirstOrDefault(t => t.Id == p.Id) == null)
         {
             _invoiceRepository.RemoveInvoiceLine(p);
         }
     });
     dstMaintainInvoice.InvoiceLines = maintainInvoiceLines;
     dstMaintainInvoice.SetInvoiceValue();
 }
コード例 #2
0
 /// <summary>
 ///     设置维修发票属性
 /// </summary>
 /// <param name="maintainInvoice">维修发票</param>
 /// <param name="serialNumber">序列号</param>
 /// <param name="invoideCode">发票号码</param>
 /// <param name="invoiceDate">发票日期</param>
 /// <param name="supplierName">供应商名称</param>
 /// <param name="supplierId">供应商ID</param>
 /// <param name="invoiceValue">发票金额</param>
 /// <param name="paidAmount">已付金额</param>
 /// <param name="operatorName">经办人</param>
 /// <param name="reviewer">审核人</param>
 /// <param name="status">发票状态</param>
 /// <param name="currencyId">币种ID</param>
 /// <param name="documentName">文档名称</param>
 /// <param name="documentId">文档ID</param>
 /// <param name="paymentScheduleLineId">付款计划行</param>
 /// <param name="inMaintainTime"></param>
 /// <param name="outMaintainTime"></param>
 public static void SetMaintainInvoice(MaintainInvoice maintainInvoice, string serialNumber, string invoideCode,
     DateTime invoiceDate, string supplierName, int supplierId, decimal invoiceValue, decimal paidAmount,
     string operatorName, string reviewer, int status, int currencyId, string documentName, Guid documentId, int? paymentScheduleLineId,
     DateTime inMaintainTime, DateTime outMaintainTime)
 {
     maintainInvoice.SetSerialNumber(serialNumber);
     maintainInvoice.InvoideCode = invoideCode;
     maintainInvoice.InvoiceDate = invoiceDate;
     maintainInvoice.SetInvoiceValue();
     maintainInvoice.SetOperator(operatorName);
     maintainInvoice.SetInvoiceStatus((InvoiceStatus)status);
     maintainInvoice.SetSupplier(supplierId, supplierName);
     maintainInvoice.SetCurrency(currencyId);
     maintainInvoice.SetPaymentScheduleLine(paymentScheduleLineId);
     maintainInvoice.DocumentName = documentName;
     maintainInvoice.DocumentId = documentId;
     maintainInvoice.InMaintainTime = inMaintainTime;
     maintainInvoice.OutMaintainTime = outMaintainTime;
     maintainInvoice.TotalDays = (maintainInvoice.OutMaintainTime.Date - maintainInvoice.InMaintainTime.Date).Days + 1;
     if (!String.IsNullOrEmpty(reviewer))
     {
         maintainInvoice.Review(reviewer);
     }
     if (maintainInvoice is EngineMaintainInvoice)
     {
     }
     else if (maintainInvoice is APUMaintainInvoice)
     {
     }
     else if (maintainInvoice is UndercartMaintainInvoice)
     {
     }
     else if (maintainInvoice is AirframeMaintainInvoice)
     {
     }
 }