예제 #1
0
        protected void updateClaimDiary(Invoice invoice, CRM.Data.Entities.InvoiceDetail invoiceDetail)
        {
            ClaimComment comment = null;

            // retrieve comment by reference
            //comment = ClaimCommentManager.GetLeadCommentByReferenceId(invoiceDetail.InvoiceLineID);

            if (comment == null)
            {
                comment = new ClaimComment();
            }

            comment.UserId      = Core.SessionHelper.getUserId();
            comment.CommentDate = DateTime.Now;
            comment.ClaimID     = invoice.ClaimID;
            //comment.ReferenceID = invoiceDetail.InvoiceLineID;
            comment.IsActive    = true;                 // active
            comment.CommentText = string.Format("<div>Invoice # {0} - {1:MM-dd-yyyy} for {2} Qty:{3:N2} Rate:{4:N2} Item Total:{5:N2}</div><div>{6}</div>",
                                                invoice.InvoiceNumber,
                                                invoiceDetail.LineDate,
                                                invoiceDetail.LineDescription ?? "",
                                                invoiceDetail.Qty ?? 0,
                                                invoiceDetail.Rate ?? 0,
                                                invoiceDetail.LineAmount ?? 0,
                                                invoiceDetail.Comments ?? ""
                                                );

            ClaimCommentManager.Save(comment);
        }
예제 #2
0
        public static int Save(InvoiceDetail invoiceDetail)
        {
            if (invoiceDetail.InvoiceLineID == 0)
                DbContextHelper.DbContext.Add(invoiceDetail);

            DbContextHelper.DbContext.SaveChanges();

            return invoiceDetail.InvoiceLineID;
        }