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 gvComments_RowCommand(object sender, GridViewCommandEventArgs e) { int commentID = 0; int leadID = 0; if (e.CommandName == "DoDelete") { commentID = Convert.ToInt32(e.CommandArgument.ToString()); try { LeadCommentManager.Delete(commentID); // refresh comments list int.TryParse(Session["LeadIds"].ToString(), out leadID); FillComments(leadID); } catch (Exception ex) { } } if (e.CommandName == "DoEdit") { dvEdit.Visible = true; commentID = Convert.ToInt32(e.CommandArgument.ToString()); LeadComment comment = LeadCommentManager.GetLeadCommentById(commentID); txtComment.Text = comment.CommentText; hfCommentId.Value = commentID.ToString(); } }
public static LeadComment GetLeadCommentByReferenceId(int Id) { LeadComment comment = (from x in DbContextHelper.DbContext.LeadComment where x.ReferenceID == Id select x).FirstOrDefault(); return(comment); }
public LeadCommentModel AddCommentInLead(LeadCommentModel leadCommentModel) { int NewCommentId = 0; LeadComment leadComment = new LeadComment(); leadCommentModel.CreatedDate = DateTime.UtcNow; AutoMapper.Mapper.Map(leadCommentModel, leadComment); leadCommentRepository.Insert(leadComment); AutoMapper.Mapper.Map(leadComment, leadCommentModel); return(leadCommentModel); }
public static void Delete(int id) { LeadComment comment = new LeadComment(); comment.CommentId = id; DbContextHelper.DbContext.LeadComment.Attach(comment); DbContextHelper.DbContext.DeleteObject(comment); DbContextHelper.DbContext.SaveChanges(); }
public static void DeleteLeadCommentByReferenceId(int Id) { LeadComment comment = (from x in DbContextHelper.DbContext.LeadComment where x.ReferenceID == Id select x).FirstOrDefault(); if (comment != null) { DbContextHelper.DbContext.DeleteObject(comment); DbContextHelper.DbContext.SaveChanges(); } }
protected void AddComments(int leadID, int policyType, string commentText) { LeadComment objLeadComment = new LeadComment(); objLeadComment.LeadId = leadID; objLeadComment.UserId = Convert.ToInt32(Session["UserId"]); objLeadComment.CommentText = commentText; objLeadComment.Status = 1; objLeadComment.PolicyType = policyType; LeadComment objld = LeadCommentManager.Save(objLeadComment); }
public static LeadComment Save(LeadComment objLeadComment) { if (objLeadComment.CommentId == 0) { objLeadComment.InsertBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name); // insert now time when date null objLeadComment.InsertDate = objLeadComment.InsertDate ?? DateTime.Now; objLeadComment.InsertMachineInfo = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString(); DbContextHelper.DbContext.Add(objLeadComment); } //secUser.UpdatedBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name); objLeadComment.UpdateMachineInfo = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString(); objLeadComment.UpdateDate = DateTime.Now; DbContextHelper.DbContext.SaveChanges(); return(objLeadComment); }
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 copyCoverages(int targetPolicyID, LeadPolicy policy) { // if (policy.LeadPolicyCoverages != null && policy.LeadPolicyCoverages.Count > 0) { // foreach (LeadPolicyCoverage coverage in policy.LeadPolicyCoverages) { // LeadPolicyCoverage newCoverage = new LeadPolicyCoverage(); // newCoverage.LeadPolicyID = targetPolicyID; // newCoverage.Deductible = coverage.Deductible; // newCoverage.Description = coverage.Description; // newCoverage.Limit = coverage.Limit; // LeadPolicyCoverageManager.Save(newCoverage); // } // } //} protected void copyComments(int sourceLeadID, int targetLeadID) { List<LeadComment> comments = LeadCommentManager.getLeadCommentByLeadID(sourceLeadID); if (comments != null && comments.Count > 0) { foreach (LeadComment comment in comments) { LeadComment newComment = new LeadComment(); newComment.CommentText = comment.CommentText; newComment.InsertBy = comment.InsertBy; newComment.InsertDate = comment.InsertDate; newComment.LeadId = targetLeadID; newComment.PolicyType = comment.PolicyType; newComment.UserId = comment.UserId; newComment.Status = comment.Status; newComment.ReferenceID = comment.ReferenceID; LeadCommentManager.Save(newComment); } } }
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 UploadTemplate1() { // original format designed by Vivek int adjusterID = 0; lblSave.Text = string.Empty; lblSave.Visible = false; lblError.Text = string.Empty; lblError.Visible = false; lblMessage.Text = string.Empty; lblMessage.Visible = false; // 2013-02-09 tortega -- Added data validation prior to import. File is not aborted in the event of incorrect data. string str = null; int clientID = Core.SessionHelper.getClientId(); // assume homeowner int policyType = 1; DateTime DateSubmitted = DateTime.Now; try { if (FileUpload1.HasFile) { string ext = System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName); string ActualFileName = FileUpload1.PostedFile.FileName.Substring(FileUpload1.PostedFile.FileName.LastIndexOf(@"\") + 1); string FileNameWithoutExt = ActualFileName.Replace(ext, ""); if (ext == ".csv") { if (!Directory.Exists(Server.MapPath("~//CSVLoad//"))) { Directory.CreateDirectory(Server.MapPath("~//CSVLoad//")); } FileUpload1.SaveAs(Server.MapPath("~//CSVLoad//" + FileUpload1.FileName)); DataTable table = CSVReader.ReadCSVFile(Server.MapPath("~//CSVLoad//" + FileUpload1.FileName), true); using (TransactionScope scope = new TransactionScope()) { Leads objLead = null; for (int i = 0; i < table.Rows.Count; i++) { objLead = new Leads(); objLead.OriginalLeadDate = DateTime.Now; objLead.UserId = Convert.ToInt32(Session["UserId"]); if (table.Rows[i]["DateSubmitted"] != string.Empty) { DateTime.TryParse(table.Rows[i]["DateSubmitted"].ToString(), out DateSubmitted); objLead.DateSubmitted = DateSubmitted; } str = table.Rows[i]["LFUUID"].ToString(); if (str.Length > 50) objLead.LFUUID = table.Rows[i]["LFUUID"].ToString().Substring(0, 50); else objLead.LFUUID = table.Rows[i]["LFUUID"].ToString(); if (table.Rows[i]["Original Lead Date"] != string.Empty) { objLead.OriginalLeadDate = Convert.ToDateTime(table.Rows[i]["Original Lead Date"]); } if (table.Rows[i]["Last Name"] != string.Empty) { str = table.Rows[i]["Last Name"].ToString(); if (str.Length > 50) objLead.ClaimantLastName = table.Rows[i]["Last Name"].ToString().Substring(0, 50); else objLead.ClaimantLastName = table.Rows[i]["Last Name"].ToString(); } if (table.Rows[i]["First Name"] != string.Empty) { str = table.Rows[i]["First Name"].ToString(); if (str.Length > 50) objLead.ClaimantFirstName = table.Rows[i]["First Name"].ToString().Substring(0, 50); else objLead.ClaimantFirstName = table.Rows[i]["First Name"].ToString(); } if (table.Rows[i]["Email Address"] != string.Empty) { str = table.Rows[i]["Email Address"].ToString(); if (str.Length > 100) objLead.EmailAddress = str.Substring(0, 100); else objLead.EmailAddress = str; } if (table.Rows[i]["Secondary Email"] != string.Empty) { str = table.Rows[i]["Secondary Email"].ToString(); if (str.Length > 100) objLead.SecondaryEmail = str.Substring(0, 100); else objLead.SecondaryEmail = str; } if (table.Rows[i]["Adjuster"] != string.Empty) { string adjusterName = table.Rows[i]["Adjuster"].ToString(); AdjusterMaster adjuster = null; if (!string.IsNullOrEmpty(adjusterName)) { adjuster = AdjusterManager.GetByAdjusterName(adjusterName.Trim()); if (adjuster.AdjusterId == 0) { // add adjuster adjuster = new AdjusterMaster(); adjuster.Status = true; adjuster.AdjusterName = adjusterName.Trim(); adjuster.ClientId = clientID; adjuster.InsertBy = objLead.UserId; adjuster.InsertDate = DateTime.Now; adjuster.isEmailNotification = true; adjuster = AdjusterManager.Save(adjuster); } adjusterID = adjuster.AdjusterId; } } if (table.Rows[i]["Lead Source"] != string.Empty) { string sourceName = table.Rows[i]["Lead Source"].ToString(); var id = LeadSourceManager.GetByLeadSourceName(sourceName); if (id.LeadSourceId > 0) objLead.LeadSource = id.LeadSourceId; else { // add source LeadSourceMaster leadSource = new LeadSourceMaster(); if (clientID > 0) leadSource.ClientId = clientID; leadSource.InsertBy = Core.SessionHelper.getUserId(); leadSource.InsertDate = DateTime.Now; leadSource.LeadSourceName = sourceName.Length > 100 ? sourceName.Substring(0, 100) : sourceName; leadSource.Status = true; LeadSourceMaster newLeadSource = LeadSourceManager.Save(leadSource); objLead.LeadSource = newLeadSource.LeadSourceId; } } if (table.Rows[i]["Primary Producer"] != string.Empty) { var id = ProducerManager.GetByProducerName(table.Rows[i]["Primary Producer"].ToString()); if (id != null && id.ProducerId > 0) objLead.PrimaryProducerId = id.ProducerId; else { ProducerMaster producer = AddProducer(objLead, table.Rows[i]["Primary Producer"].ToString()); objLead.PrimaryProducerId = producer.ProducerId; } } if (table.Rows[i]["Secondary Producer"] != string.Empty) { var id = SecondaryProducerManager.GetBySecondaryProducerName(table.Rows[i]["Secondary Producer"].ToString()); if (id != null && id.SecondaryProduceId > 0) objLead.SecondaryProducerId = id.SecondaryProduceId; else { ProducerMaster producer = AddProducer(objLead, table.Rows[i]["Secondary Producer"].ToString()); objLead.SecondaryProducerId = producer.ProducerId; } } if (table.Rows[i]["Inspector Name"] != string.Empty) { var id = InspectorManager.GetByName(table.Rows[i]["Inspector Name"].ToString()); if (id != null && id.InspectorId > 0) objLead.InspectorName = id.InspectorId; else { InspectorMaster inspector = AddInspector(objLead, table.Rows[i]["Inspector Name"].ToString()); objLead.InspectorName = inspector.InspectorId; } } if (table.Rows[i]["Inspector Cell"] != string.Empty) { str = table.Rows[i]["Inspector Cell"].ToString(); if (str.Length > 20) str = objLead.InspectorCell = table.Rows[i]["Inspector Cell"].ToString().Substring(0, 20); else objLead.InspectorCell = table.Rows[i]["Inspector Cell"].ToString(); } if (table.Rows[i]["Inspector Email"] != string.Empty) { str = table.Rows[i]["Inspector Email"].ToString(); ; if (str.Length > 100) objLead.InspectorEmail = table.Rows[i]["Inspector Email"].ToString().Substring(0, 100); else objLead.InspectorEmail = table.Rows[i]["Inspector Email"].ToString(); } if (table.Rows[i]["Phone Number"] != string.Empty) { str = table.Rows[i]["Phone Number"].ToString(); if (str.Length > 20) objLead.PhoneNumber = table.Rows[i]["Phone Number"].ToString().Substring(0, 20); else objLead.PhoneNumber = table.Rows[i]["Phone Number"].ToString(); } if (table.Rows[i]["Secondary Phone"] != string.Empty) { str = table.Rows[i]["Secondary Phone"].ToString(); if (str.Length > 20) objLead.SecondaryPhone = str.Substring(0, 20); else objLead.SecondaryPhone = str; } //if (table.Rows[i]["Webform Source"] != string.Empty) { // //objLead.WebformSource = table.Rows[i]["Webform Source"].ToString(); // var id = WebFormSourceManager.GetByName(table.Rows[i]["Webform Source"].ToString()); // if (id != null && id.WebformSourceId > 0) // objLead.WebformSource = id.WebformSourceId; //} if (!string.IsNullOrEmpty(table.Rows[i]["Type of Damage"].ToString())) { //objLead.TypeOfDamage = table.Rows[i]["Type of Damage"].ToString(); var id = TypeofDamageManager.getbyTypeOfDamage(table.Rows[i]["Type of Damage"].ToString()); objLead.TypeOfDamage = id.TypeOfDamage; //string dmgid = string.Empty; //string[] dmg = table.Rows[i]["Type of Damage"].ToString().Split(','); //for (int d = 0; d < dmg.Length; d++) { // string dmgtext = dmg[d]; // var dmgdata = TypeofDamageManager.getbyTypeOfDamage(dmgtext); // if (dmgdata != null && dmgdata.TypeOfDamage != null && dmgdata.TypeOfDamage.ToString() != string.Empty) { // dmgid += dmgdata.TypeOfDamageId + ","; // } // else { // TypeOfDamageMaster objdmg = new TypeOfDamageMaster(); // objdmg.TypeOfDamage = dmgtext.Length > 100 ? dmgtext.Substring(0, 100) : dmgtext; // objdmg.Status = true; // TypeOfDamageMaster sv = TypeofDamageManager.Save(objdmg); // dmgid += sv.TypeOfDamageId + ","; // } //} //objLead.TypeOfDamage = dmgid; str = table.Rows[i]["Type of Damage"].ToString(); if (str.Length > 250) objLead.TypeofDamageText = table.Rows[i]["Type of Damage"].ToString().Substring(0, 250); else objLead.TypeofDamageText = table.Rows[i]["Type of Damage"].ToString(); //string Damagetxt = string.Empty; //string DamageId = string.Empty; //for (int j = 0; j < chkTypeOfDamage.Items.Count; j++) //{ // if (chkTypeOfDamage.Items[j].Selected == true) // { // Damagetxt += chkTypeOfDamage.Items[j].Text + ','; // DamageId += chkTypeOfDamage.Items[j].Value + ','; // } //} } if (!string.IsNullOrEmpty(table.Rows[i]["Type of Property"].ToString())) { var id = PropertyTypeManager.GetByPropertyName(table.Rows[i]["Type of Property"].ToString()); if (id != null && id.TypeOfPropertyId > 0) { objLead.TypeOfProperty = id.TypeOfPropertyId; if (id.TypeOfProperty.Contains("Home")) policyType = 1; if (id.TypeOfProperty.Contains("Commercial")) policyType = 2; if (id.TypeOfProperty.Contains("Flood")) policyType = 3; if (id.TypeOfProperty.Contains("Earthquake")) policyType = 4; } } if (table.Rows[i]["Market Value"] != string.Empty) { decimal MarketValue = 0; decimal.TryParse(table.Rows[i]["Market Value"].ToString(), out MarketValue); objLead.MarketValue = MarketValue; //Convert.ToDecimal(table.Rows[i]["Market Value"]); } if (table.Rows[i]["Loss Address"] != string.Empty) { str = table.Rows[i]["Loss Address"].ToString(); if (str.Length > 100) objLead.LossAddress = str.Substring(0, 100); else objLead.LossAddress = str; } if (table.Rows[i]["City"] != string.Empty) objLead.CityName = table.Rows[i]["City"].ToString(); if (table.Rows[i]["State"] != string.Empty) objLead.StateName = table.Rows[i]["State"].ToString(); if (table.Rows[i]["Zip"] != string.Empty) objLead.Zip = table.Rows[i]["Zip"].ToString(); if (table.Rows[i]["Property Damage Estimate"] != string.Empty) { decimal PropertyDamageEstimate = 0; decimal.TryParse(table.Rows[i]["Property Damage Estimate"].ToString(), out PropertyDamageEstimate); objLead.PropertyDamageEstimate = PropertyDamageEstimate;// Convert.ToDecimal(table.Rows[i]["Property Damage Estimate"]); } //if (table.Rows[i]["Habitable"] != string.Empty) { // //objLead.Habitable = table.Rows[i]["Habitable"].ToString(); // var id = HabitableManager.GetbyHabitable(table.Rows[i]["Habitable"].ToString()); // if (id != null && id.HabitableId > 0) // objLead.Habitable = id.HabitableId; //} //if (table.Rows[i]["Wind Policy"] != string.Empty) { // //objLead.WindPolicy = table.Rows[i]["Wind Policy"].ToString(); // //var id = WindPolicyManager.getbyWindPolicy(table.Rows[i]["Habitable"].ToString()); // var id = WindPolicyManager.getbyWindPolicy(table.Rows[i]["Wind Policy"].ToString()); // if (id != null && id.WindPolicyId > 0) // objLead.WindPolicy = id.WindPolicyId; //} //if (table.Rows[i]["Flood Policy"] != string.Empty) { // //objLead.FloodPolicy = table.Rows[i]["Flood Policy"].ToString(); // var id = FloodPolicyManager.GetByFloodPolicy(table.Rows[i]["Flood Policy"].ToString()); // if (id != null && id.FloodPolicyId > 0) // objLead.FloodPolicy = id.FloodPolicyId; //} if (table.Rows[i]["Owner First Name"] != string.Empty) if (table.Rows[i]["Owner First Name"].ToString().Length > 50) objLead.OwnerFirstName = table.Rows[i]["Owner First Name"].ToString().Substring(0, 50); else objLead.OwnerFirstName = table.Rows[i]["Owner First Name"].ToString(); if (table.Rows[i]["Owner Last Name"] != string.Empty) { str = table.Rows[i]["Owner Last Name"].ToString(); objLead.OwnerLastName = str.Length > 50 ? str.Substring(0, 50) : str; } if (table.Rows[i]["Owner Phone Number"] != string.Empty) { str = table.Rows[i]["Owner Phone Number"].ToString(); objLead.OwnerPhone = str.Length > 15 ? str.Substring(0, 15) : str; } if (table.Rows[i]["Last Contact Date"] != string.Empty) objLead.LastContactDate = Convert.ToDateTime(table.Rows[i]["Last Contact Date"].ToString()); if (table.Rows[i]["Personal Referral"] != string.Empty) { str = table.Rows[i]["Personal Referral"].ToString(); objLead.HearAboutUsDetail = str.Length > 250 ? str.Substring(0, 250) : str; } StatusMaster statusMaster = null; if (table.Rows[i]["Status"] != string.Empty) { string statusName = table.Rows[i]["Status"].ToString(); statusName = statusName.Length > 100 ? statusName.Substring(0, 100) : statusName; statusMaster = StatusManager.GetByStatusName(statusName); if (statusMaster.StatusId == 0) { statusMaster = new StatusMaster(); statusMaster.clientID = clientID; statusMaster.InsertBy = objLead.UserId; statusMaster.InsertDate = DateTime.Now; statusMaster.isCountable = true; statusMaster.isCountAsOpen = true; statusMaster.Status = true; statusMaster.StatusName = statusName; statusMaster = StatusManager.Save(statusMaster); } } objLead.Status = 1; objLead.InsertBy = objLead.UserId; // 2013-08-29 tortega if (clientID > 0) objLead.ClientID = clientID; Leads newLead = LeadsManager.Save(objLead); if (newLead != null) { LeadComment objLeadComment = null; // add policy CRM.Data.Entities.LeadPolicy policy = new CRM.Data.Entities.LeadPolicy(); policy.PolicyType = 1; policy.LeadId = newLead.LeadId; policy.IsActive = true; policy.isAllDocumentUploaded = false; if (statusMaster != null) policy.LeadStatus = statusMaster.StatusId; if (adjusterID > 0) policy.AdjusterID = adjusterID; if (table.Rows[i]["Claims Number"] != string.Empty) policy.ClaimNumber = table.Rows[i]["Claims Number"].ToString(); if (table.Rows[i]["Site Survey Date"] != string.Empty) policy.SiteSurveyDate = Convert.ToDateTime(table.Rows[i]["Site Survey Date"].ToString()); LeadPolicyManager.Save(policy); if (!string.IsNullOrEmpty(table.Rows[i]["Reported to Insurer"].ToString())) { objLeadComment = new LeadComment(); int LeadID = objLead.LeadId; objLeadComment.LeadId = LeadID; objLeadComment.UserId = objLead.UserId; objLeadComment.Status = 1; // 2013-08-29 tortega objLeadComment.PolicyType = policyType; str = table.Rows[i]["Reported to Insurer"].ToString(); if (str.Length > 8000) objLeadComment.CommentText = "Reported to Insurer " + str.Substring(0, 8000); else objLeadComment.CommentText = "Reported to Insurer " + str; LeadComment objld = LeadCommentManager.Save(objLeadComment); } if (!string.IsNullOrEmpty(table.Rows[i]["Claimant Comments"].ToString())) { objLeadComment = new LeadComment(); int LeadID = objLead.LeadId; objLeadComment.LeadId = LeadID; objLeadComment.UserId = objLead.UserId; objLeadComment.Status = 1; // 2013-08-29 tortega objLeadComment.PolicyType = policyType; str = table.Rows[i]["Claimant Comments"].ToString(); if (str.Length > 8000) objLeadComment.CommentText = str.Substring(0, 8000); else objLeadComment.CommentText = str; LeadComment objld = LeadCommentManager.Save(objLeadComment); } } } //for (int i = 0; i < table.Rows.Count; i++) { scope.Complete(); } string rootFolderPath = Server.MapPath("~//CSVLoad//"); string filesToDelete = FileUpload1.FileName; string[] fileList = System.IO.Directory.GetFiles(rootFolderPath, filesToDelete); foreach (string file in fileList) { System.IO.File.Delete(file); } lblSave.Text = "Data Saved Successfully !!!"; lblSave.Visible = true; } } } catch (Exception ex) { lblError.Text = "There Is a problem in data save !!!"; lblError.Visible = true; Core.EmailHelper.emailError(ex); } }
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; } }