protected void updateInvoiceComment(Data.Entities.LeadInvoice invoice, LeadInvoiceDetail invoiceDetail) { LeadComment comment = null; // retrieve comment by reference comment = LeadCommentManager.GetLeadCommentByReferenceId(invoiceDetail.InvoiceLineID); if (comment == null) { comment = new LeadComment(); } comment.InsertBy = Core.SessionHelper.getUserId(); comment.InsertDate = DateTime.Now; comment.LeadId = invoice.LeadId; comment.PolicyType = invoice.PolicyTypeID; comment.ReferenceID = invoiceDetail.InvoiceLineID; comment.Status = 1; // active comment.UserId = Core.SessionHelper.getUserId(); 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.AdjusterInvoiceNumber, invoiceDetail.LineDate, invoiceDetail.LineDescription ?? "", invoiceDetail.Qty ?? 0, invoiceDetail.Rate ?? 0, invoiceDetail.LineAmount ?? 0, invoiceDetail.Comments ?? "" ); LeadCommentManager.Save(comment); }
protected void btnSave_click(object sender, EventArgs e) { CRM.Data.Entities.LeadComment comment = null; string policyType = null; if (Page.Request.Params["t"] != null) { policyType = Page.Request.Params["t"].ToString(); int policyTypeID = (int)Enum.Parse(typeof(PolicyType), policyType); comment = new CRM.Data.Entities.LeadComment(); comment.CommentText = txtComment.Text.Trim(); comment.InsertBy = Convert.ToInt32(Session["UserId"].ToString()); comment.InsertDate = DateTime.Now; comment.LeadId = Convert.ToInt32(Session["LeadIds"].ToString()); comment.PolicyType = policyTypeID; comment.Status = 1; comment.UserId = comment.InsertBy; LeadCommentManager.Save(comment); string js = "<script type='text/javascript'>closeRefresh();</script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "commentk", js, false); } }
protected void saveComments(string comments, int policyTypeID, int leadID) { if (!string.IsNullOrEmpty(comments)) { LeadComment comment = new LeadComment(); comment.LeadId = leadID; comment.PolicyType = policyTypeID; comment.CommentText = comments; comment.UserId = userID; comment.InsertDate = DateTime.Now; comment.Status = 1; LeadCommentManager.Save(comment); } }
protected void btnSaveContinue_Click(object sender, EventArgs e) { lblError.Text = string.Empty; lblError.Visible = false; lblMessage.Text = string.Empty; lblMessage.Visible = false; lblSave.Text = string.Empty; lblSave.Visible = false; int commentID = 0; try { if (int.TryParse(hfCommentId.Value, out commentID) && commentID > 0) { LeadComment comment = LeadCommentManager.GetLeadCommentById(commentID); comment.CommentText = txtComment.Text.Trim(); comment.UserId = Convert.ToInt32(Session["UserId"]); LeadComment objld = LeadCommentManager.Save(comment); int LeadID = Convert.ToInt32(hfLeadsId.Value); lblSave.Text = "Comment Saved Successfully"; lblSave.Visible = true; txtComment.Text = string.Empty; FillComments(LeadID); dvEdit.Visible = false; btnNewComment.Visible = true; btnCancelNew.Visible = true; } else { LeadComment objLeadComment = new LeadComment(); int LeadID = 0; if (hfLeadsId.Value != null && Convert.ToInt32(hfLeadsId.Value) > 0) { LeadID = Convert.ToInt32(hfLeadsId.Value); } else { lblError.Text = string.Empty; lblError.Text = "There is a problem to save."; lblError.Visible = true; return; } objLeadComment.LeadId = LeadID; objLeadComment.UserId = Convert.ToInt32(Session["UserId"]); objLeadComment.CommentText = txtComment.Text; objLeadComment.Status = 1; LeadComment objld = LeadCommentManager.Save(objLeadComment); if (objLeadComment.CommentId > 0) { lblSave.Text = string.Empty; lblSave.Text = "Comment Saved Successfully"; lblSave.Visible = true; txtComment.Text = string.Empty; FillComments(LeadID); dvEdit.Visible = false; btnNewComment.Visible = true; btnCancelNew.Visible = true; } } } catch (Exception ex) { lblError.Text = string.Empty; lblError.Text = "There is a problem to save."; lblError.Visible = true; } }