protected void lbtnNewClaimService_Click(object sender, EventArgs e) { AdjusterMaster adjuster = null; Claim claim = null; int claimID = SessionHelper.getClaimID(); int clientID = SessionHelper.getClientId(); showServiceEditPanel(); this.txtServiceQty.Value = 0; this.txtServiceDescription.Text = string.Empty; this.ddlInvoiceServiceType.SelectedIndex = -1; txtServiceDate.Text = string.Empty; // load current adjuster assigned to claim claim = Data.Account.ClaimsManager.GetByID(claimID); if (claim != null && claim.AdjusterID != null) { adjuster = Data.Account.AdjusterManager.GetAdjusterId((int)claim.AdjusterID); if (adjuster != null) { txtServiceAdjuster.Text = adjuster.adjusterName; this.hf_serviceAdjusterID.Value = adjuster.AdjusterId.ToString(); } } ViewState["ClaimServiceID"] = "0"; bindServiceTypes(); }
protected void gvAdjuster_RowDataBound(object sender, GridViewRowEventArgs e) { AdjusterMaster adjuster = null; Image adjusterPhoto = null; if (e.Row.RowType == DataControlRowType.DataRow) { adjuster = e.Row.DataItem as AdjusterMaster; if (adjuster != null) { Repeater repeaterStateLicense = e.Row.FindControl("repeaterStateLicense") as Repeater; if (repeaterStateLicense != null) { repeaterStateLicense.DataSource = adjuster.AdjusterServiceArea; repeaterStateLicense.DataBind(); } // type of claim handled Repeater repeaterTypeClaimHandle = e.Row.FindControl("repeaterTypeClaimHandle") as Repeater; if (repeaterTypeClaimHandle != null) { repeaterTypeClaimHandle.DataSource = adjuster.AdjusterHandleClaimType; repeaterTypeClaimHandle.DataBind(); } adjusterPhoto = e.Row.FindControl("adjusterPhoto") as Image; adjusterPhoto.ImageUrl = Core.Common.getAdjusterPhotoURL(adjuster.AdjusterId, adjuster.PhotoFileName); } } }
protected void gvAdjuster_RowCommand(object sender, GridViewCommandEventArgs e) { int adjusterID = 0; string encryptedID = null; if (e.CommandName == "DoEdit") { encryptedID = Core.SecurityManager.EncryptQueryString(e.CommandArgument.ToString()); Response.Redirect("~/protected/admin/AdjusterEdit.aspx?q=" + encryptedID); } else if (e.CommandName == "DoDelete") { adjusterID = Convert.ToInt32(e.CommandArgument.ToString()); AdjusterMaster adjuster = AdjusterManager.GetAdjusterId(adjusterID); if (adjuster != null) { adjuster.Status = false; AdjusterManager.Save(adjuster); } } DoBind(); }
protected void lbtnNewExpense_Click(object sender, EventArgs e) { AdjusterMaster adjuster = null; Claim claim = null; int claimID = SessionHelper.getClaimID(); showExpenseEditPanel(); txtExpenseAmount.Value = 0; txtExpenseQty.Value = 0; txtExpenseDescription.Text = string.Empty; txtExpenseDate.Text = string.Empty; ddlExpenseType.SelectedIndex = -1; cbxExpenseReimburse.Checked = false; txtMyComments.Text = ""; ViewState["ClaimExpenseID"] = 0; // load current adjuster assigned to claim claim = Data.Account.ClaimsManager.GetByID(claimID); if (claim != null && claim.AdjusterID != null) { adjuster = Data.Account.AdjusterManager.GetAdjusterId((int)claim.AdjusterID); if (adjuster != null) { txtExpenseAdjuster.Text = adjuster.adjusterName; hf_expenseAdjusterID.Value = adjuster.AdjusterId.ToString(); } } }
public void UpdateAdjusterName(AdjusterMaster objAdjusterMaster) { AdjusterMaster objAdjusterMaster2 = DbContextHelper.DbContext.AdjusterMaster.First(x => x.AdjusterId == objAdjusterMaster.AdjusterId); objAdjusterMaster2.CompanyName = objAdjusterMaster.CompanyName; DbContextHelper.DbContext.SaveChanges(); }
public static AdjusterMaster GetAdjusterByUserID(int userID) { AdjusterMaster adjuster = (from x in DbContextHelper.DbContext.AdjusterMaster where x.userID == userID && x.Status == true select x ).FirstOrDefault(); return(adjuster); }
public static void CheckSendMail(RuleException ruleExp) { if (ruleExp != null) { string adjusterEmail = string.Empty; string supervisorEmail = string.Empty; bool sendAdjuster = false; bool sendSupervisor = false; string recipient = string.Empty; int claimId = 0; BusinessRuleManager objRuleManager = new BusinessRuleManager(); BusinessRule objRule = new BusinessRule(); CRM.Data.Entities.Claim objClaim = new CRM.Data.Entities.Claim(); CRM.Data.Entities.SecUser objSecUser = new Data.Entities.SecUser(); AdjusterMaster adjustermaster = new AdjusterMaster(); int businessRuleID = ruleExp.BusinessRuleID ?? 0; objRule = objRuleManager.GetBusinessRule(businessRuleID); if (objRule != null) { claimId = ruleExp.ObjectID ?? 0; objClaim = objRuleManager.GetClaim(claimId); adjustermaster = objRuleManager.GetAdjuster(objClaim.AdjusterID ?? 0); objSecUser = objRuleManager.GetSupervisor(objClaim.SupervisorID ?? 0); if (objSecUser != null) { adjusterEmail = adjustermaster.email; supervisorEmail = objSecUser.Email; sendAdjuster = objRule.EmailAdjuster; sendSupervisor = objRule.EmailSupervisor; if (sendAdjuster == true && sendSupervisor == true) { recipient = adjusterEmail + "," + supervisorEmail; notifyUser(objRule.Description, claimId, recipient); } else if (sendAdjuster == false && sendSupervisor == true) { recipient = supervisorEmail; notifyUser(objRule.Description, claimId, recipient); } else if (sendAdjuster == true && sendSupervisor == false) { recipient = adjusterEmail; notifyUser(objRule.Description, claimId, recipient); } } } } }
public AdjusterMaster GetAdjuster(int adjusterID) { AdjusterMaster rule = null; rule = (from x in claimRulerDBContext.AdjusterMaster where x.AdjusterId == adjusterID select x ).FirstOrDefault <AdjusterMaster>(); return(rule); }
public static void CheckSendMail(RuleException ruleExp) { if (ruleExp != null) { string adjusterEmail = string.Empty; string supervisorEmail = string.Empty; bool sendAdjuster = false; bool sendSupervisor = false; string recipient = string.Empty; int claimId = 0; BusinessRuleManager objRuleManager = new BusinessRuleManager(); BusinessRule objRule = new BusinessRule(); CRM.Data.Entities.Claim objClaim = new CRM.Data.Entities.Claim(); CRM.Data.Entities.SecUser objSecUser = new Data.Entities.SecUser(); AdjusterMaster adjustermaster = new AdjusterMaster(); int businessRuleID = ruleExp.BusinessRuleID ?? 0; objRule = objRuleManager.GetBusinessRule(businessRuleID); if (objRule != null) { claimId = ruleExp.ObjectID ?? 0; objClaim = objRuleManager.GetClaim(claimId); adjustermaster = objRuleManager.GetAdjuster(objClaim.AdjusterID ?? 0); objSecUser = objRuleManager.GetSupervisor(objClaim.SupervisorID ?? 0); if (objSecUser != null) { adjusterEmail = adjustermaster.email; supervisorEmail = objSecUser.Email; sendAdjuster = objRule.EmailAdjuster; sendSupervisor = objRule.EmailSupervisor; if (sendAdjuster == true && sendSupervisor == true) { recipient = adjusterEmail + "," + supervisorEmail; notifyUser(objRule.Description, claimId, recipient); } else if (sendAdjuster == false && sendSupervisor == true) { recipient = supervisorEmail; notifyUser(objRule.Description, claimId, recipient); } else if (sendAdjuster == true && sendSupervisor == false) { recipient = adjusterEmail; notifyUser(objRule.Description, claimId, recipient); } } } } }
public static AdjusterMaster Save(AdjusterMaster objAdjuster) { if (objAdjuster.AdjusterId == 0) { //objProducer.InsertBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name); objAdjuster.InsertDate = DateTime.Now; DbContextHelper.DbContext.Add(objAdjuster); } objAdjuster.UpdateDate = DateTime.Now; DbContextHelper.DbContext.SaveChanges(); return(objAdjuster); }
public static void saveAdjusterPhoto(int adjusterID, string filePath) { AdjusterMaster adjuster = null; string photoFileName = null; string imageFolderPath = null; string destinationFilePath = null; // get application path string appPath = ConfigurationManager.AppSettings["appPath"].ToString(); // get uploaded file string tempFilePath = HttpContext.Current.Server.MapPath(String.Format("~\\Temp\\{0}", filePath)); adjuster = AdjusterManager.GetAdjusterId(adjusterID); if (adjuster != null && File.Exists(tempFilePath)) { try { imageFolderPath = string.Format("{0}/Adjusters/{1}/Photo", appPath, adjuster.AdjusterId); if (!Directory.Exists(imageFolderPath)) { Directory.CreateDirectory(imageFolderPath); } photoFileName = adjuster.AdjusterId.ToString() + Path.GetExtension(filePath); destinationFilePath = string.Format("{0}/{1}", imageFolderPath, photoFileName); System.IO.File.Copy(tempFilePath, destinationFilePath, true); // delete temp file File.Delete(tempFilePath); adjuster.PhotoFileName = photoFileName; AdjusterManager.Save(adjuster); } catch (Exception ex) { Core.EmailHelper.emailError(ex); } } }
private void notifyAdjuster(CRM.Data.Entities.LeadPolicy policy) { AdjusterMaster adjuster = null; string clientName = null; string claimantName = null; string emailText = null; string emailPassword = null; Leads lead = null; int leadID = 0; string[] recipients = null; string userEmail = null; string subject = null; // get adjuster info adjuster = AdjusterManager.Get(policy.AdjusterID ?? 0); // retreive lead information leadID = SessionHelper.getLeadId(); lead = LeadsManager.GetByLeadId(leadID); if (lead != null && adjuster != null && !string.IsNullOrEmpty(adjuster.email) && (adjuster.isEmailNotification ?? true)) { recipients = new string[] { adjuster.email }; userEmail = ConfigurationManager.AppSettings["userID"].ToString(); emailPassword = ConfigurationManager.AppSettings["Password"].ToString(); // name of CRM client clientName = adjuster.Client == null ? "" : adjuster.Client.BusinessName; claimantName = string.Format("{0} {1}", lead.ClaimantFirstName ?? "", lead.ClaimantLastName ?? ""); subject = string.Format("{0} has assigned {1} to you.", clientName, claimantName); emailText = string.Format("<br>Claim # {0} was assigned to you.<br>Please review {1} right away to begin the file.<br><br>Thank you.<br><br>http://app.claimruler.com", policy.ClaimNumber, claimantName); Core.EmailHelper.sendEmail(adjuster.email, recipients, null, subject, emailText, null, userEmail, emailPassword); } }
protected void btnAssign_Click(object sender, EventArgs e) { int adjusterID = 0; Claim claim = null; int claimID = 0; AdjusterMaster adjuster = null; StringBuilder claimList = new StringBuilder(); if (int.TryParse(ddlAdjuster.SelectedValue, out adjusterID) && adjusterID > 0) { adjuster = AdjusterManager.GetAdjusterId(adjusterID); foreach (GridViewRow row in gvSearchResult.Rows) { if (row.RowType == DataControlRowType.DataRow) { CheckBox cbxSelected = row.FindControl("cbxSelected") as CheckBox; if (cbxSelected.Checked) { claimID = (int)gvSearchResult.DataKeys[row.RowIndex].Value; claim = ClaimsManager.GetByID(claimID); if (claim != null) { claim.AdjusterID = adjusterID; ClaimsManager.Save(claim); HyperLink lnkLead = row.FindControl("hlnkLead") as HyperLink; claimList.Append(string.Format("<tr align=\"center\"><td>{0}</td><td>{1}</td><td>{2}</td></tr>", lnkLead.Text, claim.AdjusterClaimNumber ?? "", claim.InsurerClaimNumber ?? "")); } } } } // foreach notifyAdjuster(adjuster, claimList); btnSearch_Click(null, null); } }
public static void Delete(int id) { // Create an entity to represent the Entity you wish to delete // Notice you don't need to know all the properties, in this // case just the ID will do. AdjusterMaster adjuster = new AdjusterMaster { AdjusterId = id }; // Now attach the category stub object to the "Categories" set. // This puts the Entity into the context in the unchanged state, // This is same state it would have had if you made the query DbContextHelper.DbContext.AttachTo("AdjusterMaster", adjuster); // Do the delete the category DbContextHelper.DbContext.DeleteObject(adjuster); // Apply the delete to the database DbContextHelper.DbContext.SaveChanges(); }
protected void btnSaveExpense_Click(object sender, EventArgs e) { Claim claim = null; Claim myClaim = null; ClaimExpense claimExpense = null; AdjusterMaster adjuster = null; CarrierInvoiceProfile CarrierInvoice = null; int clientID = SessionHelper.getClientId(); int userID = SessionHelper.getUserId(); int claimID = SessionHelper.getClaimID(); int myAdjusterID = 0; int profileID = 0; int expenseTypeID = 0; int id = 0; Page.Validate("expense"); if (!Page.IsValid) { return; } id = Convert.ToInt32(ViewState["ClaimExpenseID"]); ClaimManager cm = new ClaimManager(); myClaim = cm.Get(claimID); try { expenseTypeID = Convert.ToInt32(ddlExpenseType.SelectedValue); using (TransactionScope scope = new TransactionScope()) { using (ClaimExpenseManager repository = new ClaimExpenseManager()) { if (id == 0) { claimExpense = new ClaimExpense(); claimExpense.ClaimID = claimID; } else { claimExpense = repository.Get(id); } // populate fields if (txtExpenseAmount.Visible == false) { var x = Session["multiplier"].ToString(); double expenseAmount = Convert.ToDouble(x) * Convert.ToDouble(txtExpenseQty.ValueDecimal); //newOC 10/7/14 claimExpense.ExpenseAmount = Convert.ToDecimal(expenseAmount); decimal d = Convert.ToDecimal(expenseAmount); //Session["EmailAmount"] = "$" + Math.Round(d, 2); Session["EmailAmount"] = String.Format("{0:0.00}", expenseAmount); // Session["EmailAmount"] = expenseAmount; } else { claimExpense.ExpenseAmount = txtExpenseAmount.ValueDecimal; } claimExpense.ExpenseDate = txtExpenseDate.Date; claimExpense.ExpenseDescription = txtExpenseDescription.Text.Trim(); claimExpense.ExpenseTypeID = expenseTypeID; claimExpense.IsReimbursable = cbxExpenseReimburse.Checked; claimExpense.UserID = userID; claimExpense.AdjusterID = Convert.ToInt32(hf_expenseAdjusterID.Value); claimExpense.ExpenseQty = txtExpenseQty.ValueDecimal; claimExpense.InternalComments = txtMyComments.Text.Trim(); claimExpense.Billed = false; // claimExpense.IsBillable = cbIsBillable.Checked; // save expense claimExpense = repository.Save(claimExpense); } // update diary entry ClaimComment diary = new ClaimComment(); diary.ClaimID = claimID; diary.CommentDate = DateTime.Now; diary.UserId = userID; diary.CommentText = string.Format("Expense: {0}, Description: {1}, Date: {2:MM/dd/yyyy}, Amount: {3:N2}, Adjuster: {4} Qty: {5:N2}", ddlExpenseType.SelectedItem.Text, claimExpense.ExpenseDescription, claimExpense.ExpenseDate, claimExpense.ExpenseAmount, txtExpenseAdjuster.Text, claimExpense.ExpenseQty ); ClaimCommentManager.Save(diary); // 2014-05-02 apply rule using (SpecificExpenseTypePerCarrier ruleEngine = new SpecificExpenseTypePerCarrier()) { claim = new Claim(); claim.ClaimID = claimID; RuleException ruleException = ruleEngine.TestRule(clientID, claim, expenseTypeID); if (ruleException != null) { ruleException.UserID = Core.SessionHelper.getUserId(); ruleEngine.AddException(ruleException); CheckSendMail(ruleException); } } myAdjusterID = Convert.ToInt32(claimExpense.AdjusterID); //Convert.ToInt32(myClaim.AdjusterID); //EMAIL ADJUSTER OC 10/22/2014 if (myAdjusterID != 0 || myAdjusterID != null) { adjuster = AdjusterManager.GetAdjusterId(myAdjusterID); } if (cbEmailAdjuster.Checked == true) { try { notifyAdjuster(adjuster, claimExpense, myClaim); } catch (Exception ex) { lblMessage.Text = "Unable to send email to adjuster"; lblMessage.CssClass = "error"; } } //EMAIL CLIENT CONTACT OC 10/22/2014 if (cbEmailClient.Checked == true) //Dont need to check if invoice Pro ID is empty becuase to get to this point, one has to exist already { if (Session["ComingFromAllClaims"] != null) //if the user got here straight from the all claims screen { profileID = Convert.ToInt32(Session["CarrierInvoiceID"]); } else//coming from claim detail page { profileID = Convert.ToInt32(Session["InvoiceProfileID"]); } CarrierInvoice = CarrierInvoiceProfileManager.Get(profileID); try { notifyClientContact(CarrierInvoice, claimExpense, myClaim, adjuster); } catch (Exception ex) { lblMessage.Text = "Unable to send email to client contact"; lblMessage.CssClass = "error"; } } //EMAIL TO WHOMEVER OC 10/22/2014 if (txtEmailTo.Text != "") { try { notifySpecifiedUser(adjuster, claimExpense, myClaim); } catch (Exception ex) { lblMessage.Text = "Unable to send email to adjuster"; lblMessage.CssClass = "error"; } } // complete transaction scope.Complete(); } lblMessage.Text = "Expense saved successfully."; lblMessage.CssClass = "ok"; // refresh grid gvExpense.DataSource = loadExpenses(claimID); gvExpense.DataBind(); // keep edit form active lbtnNewExpense_Click(null, null); lblAmount.Text = ""; lblAmount.Visible = false; txtExpenseAmount.Visible = true; } catch (Exception ex) { Core.EmailHelper.emailError(ex); lblMessage.Text = "Unable to save claim expense."; lblMessage.CssClass = "error"; } }
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); } }
public static string SaveClaimExpense(string expenseType, string insurerClaimId, string insurerName, int claimAdjusterId, string adjusterComapnyName, string updatedby, string commentNote, string emailTo, int carrierID, int claimID, string recipientId, string claimAdjuster, string expenseTypeName, string carrier, string idOf, string expenseQty, string expenseAmount, string expenseDate, string reimbrance) { string json = ""; Claim objclaim = null; AdjusterMaster objAdjusterMaster = null; Leads objLeads = null; ClaimComment comment = null; ClaimExpense claimExpense = null; CRM.Data.Entities.LeadPolicy objLeadPolicy = null; int userID = SessionHelper.getUserId(); int leadID = 0; int policyId = 0; try { using (TransactionScope scope = new TransactionScope()) { using (ClaimManager repository = new ClaimManager()) { objclaim = new Claim(); objclaim.ClaimID = claimID; objclaim.InsurerClaimNumber = insurerClaimId; //objclaim.CarrierID = carrierID; objclaim.AdjusterID = claimAdjusterId; // objclaim.StatusUpdatedBy = updatedby; repository.UpdateClaimStatus(objclaim); // AdjusterMaster objAdjusterMaster = new AdjusterMaster(); objAdjusterMaster.AdjusterId = claimAdjusterId; //objAdjusterMaster.CompanyName = AdjusterComapnyName; repository.UpdateAdjusterName(objAdjusterMaster); //leads leadID = repository.GetPolicyId(claimID); objLeads = new Leads(); objLeads.LeadId = leadID; objLeads.InsuredName = insurerName; repository.UpdateInsurerName(objLeads); //save carrier id in Lead policy policyId = repository.GetLeadPolicyId(claimID); objLeadPolicy = new Data.Entities.LeadPolicy(); objLeadPolicy.Id = policyId; objLeadPolicy.CarrierID = carrierID; repository.UpdateCarrierId(objLeadPolicy); //add expense ClaimExpenseManager objClaimExpenseManager = new ClaimExpenseManager(); claimExpense = new ClaimExpense(); claimExpense.ClaimID = claimID; if (!string.IsNullOrEmpty(expenseAmount)) { claimExpense.ExpenseAmount = Convert.ToDecimal(expenseAmount); } if (!string.IsNullOrEmpty(expenseDate)) { claimExpense.ExpenseDate = Convert.ToDateTime(expenseDate); } claimExpense.ExpenseDescription = commentNote.Trim(); claimExpense.ExpenseTypeID = Convert.ToInt32(expenseType); if (reimbrance == "1") { claimExpense.IsReimbursable = true; } else { claimExpense.IsReimbursable = false; } claimExpense.UserID = userID; claimExpense.AdjusterID = Convert.ToInt32(claimAdjusterId); if (!string.IsNullOrEmpty(expenseQty)) { claimExpense.ExpenseQty = Convert.ToDecimal(expenseQty); } objClaimExpenseManager.Save(claimExpense); //claim comment for add notes comment = new ClaimComment(); comment.ClaimID = claimID; comment.IsActive = true; comment.UserId = Core.SessionHelper.getUserId(); comment.CommentDate = DateTime.Now; comment.ActivityType = "Add Expense"; comment.CommentText = string.Format("Expense: {0}, Description: {1}, Date: {2:MM/dd/yyyy}, Amount: {3:N2}, Adjuster: {4} Qty: {5:N2}", expenseTypeName, commentNote.Trim(), Convert.ToDateTime(expenseDate), expenseAmount, claimAdjuster, expenseQty ); ClaimCommentManager.Save(comment); } scope.Complete(); } string[] recipId = recipientId.Split(','); string recipientEmailId = string.Empty; string[] IdofTable = idOf.Split(','); int index2 = 0; for (int index = 0; index < recipId.Length; index++) { index2 = 0; int.TryParse(recipId[index], out index2); if (IdofTable[index] == "c") { Contact objContact = ContactManager.Get(index2); if (!string.IsNullOrEmpty(objContact.Email)) { if (recipientEmailId == "") { recipientEmailId = objContact.Email; } else { recipientEmailId = recipientEmailId + "," + objContact.Email; } } } else { AdjusterMaster objAdjuster = AdjusterManager.GetAdjusterId(index2); if (!string.IsNullOrEmpty(objAdjuster.email)) { if (recipientEmailId == "") { recipientEmailId = objAdjuster.email; } else { recipientEmailId = recipientEmailId + "," + objAdjuster.email; } } } } SendExpenseEmail(expenseType, insurerClaimId, insurerName, claimAdjusterId, adjusterComapnyName, updatedby, commentNote, "", carrierID, claimID, recipientEmailId, claimAdjuster, expenseTypeName, carrier, recipId, IdofTable, expenseQty, expenseAmount, expenseDate, reimbrance); json = "Expense add successfully"; } catch (Exception ex) { Core.EmailHelper.emailError(ex); } return json; }
private void notifyAdjuster(AdjusterMaster adjuster, StringBuilder claimList) { StringBuilder emailBody = new StringBuilder(); string password = null; string[] recipients = null; string smtpHost = null; int smtpPort = 0; string siteUrl = ConfigurationManager.AppSettings["siteUrl"].ToString(); string subject = "Claim Assignment Notification"; CRM.Data.Entities.SecUser user = null; string itsgHost = ConfigurationManager.AppSettings["smtpHost"].ToString(); string itsgHostPort = ConfigurationManager.AppSettings["smtpPort"].ToString(); string itsgEmail = ConfigurationManager.AppSettings["smtpEmail"].ToString(); string itsgEmailPassword = ConfigurationManager.AppSettings["smtpPassword"].ToString(); int.TryParse(itsgHostPort, out smtpPort); // get logged in user int userID = SessionHelper.getUserId(); //Convert.ToInt32(itsgHostPort); // get current user email info user = SecUserManager.GetByUserId(userID); // load email credentials smtpHost = user.emailHost; int.TryParse(user.emailHostPort, out smtpPort); // recipients recipients = new string[] { adjuster.email }; // build email body // .containerBox emailBody.Append("<div style=\"margin:auto;width:600px;border: 1px solid #DDDDE4; margin: auto;font-family: Tahoma, Arial,sans-serif;font-size: 12px;color: #808080;\">"); // .header //emailBody.Append("<div style=\"background-image:url(https://appv3.claimruler.com/images/email_header_small.jpg);background-repeat: no-repeat;background-size: 100% 100%;height:70px;\"></div>"); emailBody.Append("<div><img src=\"http://app.claimruler.com/images/email_header_small.jpg\"></image></div>"); // .paneContentInner emailBody.Append("<div style=\"margin: 20px;\">"); emailBody.Append("Hi " + adjuster.adjusterName + "!<br><br>"); emailBody.Append("Your firm uses Claim Ruler software for claims management and the following claim(s) have been assigned to you.<br><br>"); emailBody.Append("Please review claim(s) right away to begin handling the file(s). Time is of the essence!<br><br>"); emailBody.Append("<table style=\"width:550px;\">"); emailBody.Append(string.Format("<tr align=\"center\"><th scope=\"col\">{0}</th><th scope=\"col\">{1}</th><th scope=\"col\">{2}</th></tr>", "Insured Name", "Adjuster Claim #", "Insurer Claim #")); // claim list emailBody.Append(claimList.ToString()); // end email body emailBody.Append("</table>"); emailBody.Append(string.Format("<p><a href=\"{0}/login.aspx\">Please click here to access Claim Ruler.</a></p>", siteUrl)); emailBody.Append("<br>Thank you."); emailBody.Append("</div>"); // inner containerBox emailBody.Append("</div>"); // paneContentInner emailBody.Append("</div>"); // containerBox //Core.EmailHelper.sendEmail(user.Email, recipients, null, "Claim Assignment Notification", emailBody.ToString(), null, user.emailHost, smtpPort, smtpEmail, smtpPassword, true); password = Core.SecurityManager.Decrypt(user.emailPassword); //Core.EmailHelper.sendEmail(user.Email, recipients, null, subject, emailBody.ToString(), null, user.emailHost, smtpPort, user.Email, password, user.isSSL ?? true); Core.EmailHelper.sendEmail(user.Email, recipients, null, subject, emailBody.ToString(), null, itsgHost, Convert.ToInt32(itsgHostPort), itsgEmail, itsgEmailPassword); }
//EMAIL TO: Specified User private void notifySpecifiedUser(AdjusterMaster adjuster, ClaimService service, Claim myClaim) { StringBuilder emailBody = new StringBuilder(); string password = null; string[] recipients = null; string smtpHost = null; int smtpPort = 0; string siteUrl = ConfigurationManager.AppSettings["siteUrl"].ToString(); string insuredName = Session["InsuredName"].ToString(); string subject = "Claim # " + myClaim.InsurerClaimNumber + ", Please Read Claim Note, Claim Ruler Note for : " + insuredName; CRM.Data.Entities.SecUser user = null; string itsgHost = ConfigurationManager.AppSettings["smtpHost"].ToString(); string itsgHostPort = ConfigurationManager.AppSettings["smtpPort"].ToString(); string itsgEmail = ConfigurationManager.AppSettings["smtpEmail"].ToString(); string itsgEmailPassword = ConfigurationManager.AppSettings["smtpPassword"].ToString(); string EmailService = ddlInvoiceServiceType.SelectedItem.Text; string EmailActivity = ddlActivity.SelectedItem.Text; string EmailDescription = txtServiceDescription.Text; string EmailInternal = txtMyComments.Text; string EmailQuantity = txtServiceQty.Text; string EmailDate = txtServiceDate.Text; string userName = SessionHelper.getUserName(); int.TryParse(itsgHostPort, out smtpPort); // get logged in user int userID = SessionHelper.getUserId(); //Convert.ToInt32(itsgHostPort); // get current user email info user = SecUserManager.GetByUserId(userID); // load email credentials smtpHost = user.emailHost; int.TryParse(user.emailHostPort, out smtpPort); // recipients recipients = new string[] { txtEmailTo.Text }; // build email body // .containerBox emailBody.Append("<div style=\"margin:auto;width:600px;border: 1px solid #DDDDE4; margin: auto;font-family: Tahoma, Arial,sans-serif;font-size: 12px;color: #808080;\">"); // .header //emailBody.Append("<div style=\"background-image:url(https://appv3.claimruler.com/images/email_header_small.jpg);background-repeat: no-repeat;background-size: 100% 100%;height:70px;\"></div>"); //emailBody.Append("<div><img src=\"http://app.claimruler.com/images/email_header_small.jpg\"></image></div>"); // .paneContentInner emailBody.Append("<div style=\"margin: 20px;\">"); emailBody.Append("Hi " + adjuster.adjusterName + ",<br><br>"); emailBody.Append("The following activity was just logged on Claim # " + myClaim.InsurerClaimNumber + " for Insured: " + insuredName + "<br><br><br>"); emailBody.Append("<table >"); emailBody.Append("<tr> "); emailBody.Append("<td align=\"left\"><b>Service:</b></td><td align=\"left\"> " + EmailService + "</td>"); emailBody.Append("</tr>"); // emailBody.Append("</table><br><br>"); emailBody.Append("<tr>"); emailBody.Append("<td align=\"left\"><b>Activity:</b></td><td align=\"left\"> " + EmailActivity + "</td>"); emailBody.Append("</tr>"); emailBody.Append("<tr> "); emailBody.Append("<td align=\"left\"><b>Description:</b></td><td align=\"left\"> " + EmailDescription + "</td>"); emailBody.Append("</tr>"); emailBody.Append("<tr> "); emailBody.Append("<td align=\"left\"><b>Internal Comments:</b></td><td align=\"left\"> " + EmailInternal + "</td>"); emailBody.Append("</tr>"); emailBody.Append("<tr></tr>"); emailBody.Append("<tr> "); emailBody.Append("<td align=\"left\"><b>Adjuster:</b></td><td align=\"left\"> " + adjuster.adjusterName + "</td>"); emailBody.Append("</tr>"); emailBody.Append("<tr> "); emailBody.Append("<td align=\"left\"><b>User Name:</b></td><td align=\"left\"> " + userName + "</td>"); emailBody.Append("</tr>"); emailBody.Append("<tr> "); emailBody.Append("<td align=\"left\"><b>Service Date:</b></td><td align=\"left\"> " + EmailDate + "</td>"); emailBody.Append("</tr>"); emailBody.Append("<tr> "); emailBody.Append("<td align=\"left\"><b>Timer Quantity:</b></td><td align=\"left\"> " + EmailQuantity + "</td>"); emailBody.Append("</tr>"); emailBody.Append("</table ><br><br>"); emailBody.Append("</div>"); // inner containerBox emailBody.Append("</div>"); // paneContentInner emailBody.Append("</div>"); // containerBox //Core.EmailHelper.sendEmail(user.Email, recipients, null, "Claim Assignment Notification", emailBody.ToString(), null, user.emailHost, smtpPort, smtpEmail, smtpPassword, true); password = Core.SecurityManager.Decrypt(user.emailPassword); //Core.EmailHelper.sendEmail(user.Email, recipients, null, subject, emailBody.ToString(), null, user.emailHost, smtpPort, user.Email, password, user.isSSL ?? true); Core.EmailHelper.sendEmail(itsgEmail, recipients, null, subject, emailBody.ToString(), null, itsgHost, Convert.ToInt32(itsgHostPort), itsgEmail, itsgEmailPassword); }
public List<string> getEmailData(int claimId, int BusinessRuleID) { List<string> emailData = new List<string>(); string adjusterEmail = ""; int adjusterId = 0; int superVisorId = 0; string adjusterClaimNumber = ""; string dateRecieved = ""; int ruleId = 0; string businessDescription = ""; string redFlagName = ""; string insuredName = ""; string adjusterName = ""; ClaimManager ClaimManagerObj = new ClaimManager(); Claim claimObj = new Claim(); claimObj = ClaimManagerObj.Get(claimId); if (claimObj != null && claimObj.AdjusterID != null) { adjusterId = Convert.ToInt32(claimObj.AdjusterID); } if (claimObj != null && claimObj.InsurerClaimNumber != null) { adjusterClaimNumber = claimObj.InsurerClaimNumber; } if (claimObj != null && claimObj.DateOpenedReported != null) { dateRecieved = Convert.ToString(claimObj.DateOpenedReported); } AdjusterMaster adjusterMasterObj = new AdjusterMaster(); if (claimObj != null) { adjusterMasterObj = claimObj.AdjusterMaster; } if (adjusterMasterObj != null && adjusterMasterObj.email != null) { adjusterEmail = Convert.ToString(adjusterMasterObj.email); } if (adjusterMasterObj != null && adjusterMasterObj.adjusterName != null) { adjusterName = Convert.ToString(adjusterMasterObj.adjusterName); } if (adjusterMasterObj != null && adjusterMasterObj.SupervisorID != null) { superVisorId = Convert.ToInt32(adjusterMasterObj.SupervisorID); } CRM.Data.Entities.SecUser secUserObj = new CRM.Data.Entities.SecUser(); secUserObj = getSecUser(superVisorId); insuredName = claimObj.LeadPolicy.Leads.insuredName; BusinessRuleManager BusinessRuleManagerObj = new BusinessRuleManager(); BusinessRule BusinessRuleObj = new BusinessRule(); BusinessRuleObj = BusinessRuleManagerObj.GetBusinessRule(BusinessRuleID); if (BusinessRuleObj.RuleID != null) { ruleId = Convert.ToInt32(BusinessRuleObj.RuleID); }; businessDescription = BusinessRuleObj.Description; CRM.Data.Entities.Rule ruleObj = new CRM.Data.Entities.Rule(); ruleObj = BusinessRuleManagerObj.GetRule(ruleId); redFlagName = ruleObj.RuleName; string encryptedClaimNumber = Core.SecurityManager.EncryptQueryString(claimId.ToString()); emailData.Add(adjusterEmail); emailData.Add(adjusterName); emailData.Add(secUserObj.Email); emailData.Add(secUserObj.UserName); emailData.Add(adjusterClaimNumber); emailData.Add(dateRecieved); emailData.Add(businessDescription); emailData.Add(redFlagName); emailData.Add(insuredName); emailData.Add(encryptedClaimNumber); return emailData; }
public List <string> getEmailData(int claimId, int BusinessRuleID) { List <string> emailData = new List <string>(); string adjusterEmail = ""; int adjusterId = 0; int superVisorId = 0; string adjusterClaimNumber = ""; string dateRecieved = ""; int ruleId = 0; string businessDescription = ""; string redFlagName = ""; string insuredName = ""; string adjusterName = ""; ClaimManager ClaimManagerObj = new ClaimManager(); Claim claimObj = new Claim(); claimObj = ClaimManagerObj.Get(claimId); if (claimObj != null && claimObj.AdjusterID != null) { adjusterId = Convert.ToInt32(claimObj.AdjusterID); } if (claimObj != null && claimObj.InsurerClaimNumber != null) { adjusterClaimNumber = claimObj.InsurerClaimNumber; } if (claimObj != null && claimObj.DateOpenedReported != null) { dateRecieved = Convert.ToString(claimObj.DateOpenedReported); } AdjusterMaster adjusterMasterObj = new AdjusterMaster(); if (claimObj != null) { adjusterMasterObj = claimObj.AdjusterMaster; } if (adjusterMasterObj != null && adjusterMasterObj.email != null) { adjusterEmail = Convert.ToString(adjusterMasterObj.email); } if (adjusterMasterObj != null && adjusterMasterObj.adjusterName != null) { adjusterName = Convert.ToString(adjusterMasterObj.adjusterName); } if (adjusterMasterObj != null && adjusterMasterObj.SupervisorID != null) { superVisorId = Convert.ToInt32(adjusterMasterObj.SupervisorID); } CRM.Data.Entities.SecUser secUserObj = new CRM.Data.Entities.SecUser(); secUserObj = getSecUser(superVisorId); insuredName = claimObj.LeadPolicy.Leads.insuredName; BusinessRuleManager BusinessRuleManagerObj = new BusinessRuleManager(); BusinessRule BusinessRuleObj = new BusinessRule(); BusinessRuleObj = BusinessRuleManagerObj.GetBusinessRule(BusinessRuleID); if (BusinessRuleObj.RuleID != null) { ruleId = Convert.ToInt32(BusinessRuleObj.RuleID); } ; businessDescription = BusinessRuleObj.Description; CRM.Data.Entities.Rule ruleObj = new CRM.Data.Entities.Rule(); ruleObj = BusinessRuleManagerObj.GetRule(ruleId); redFlagName = ruleObj.RuleName; string encryptedClaimNumber = Core.SecurityManager.EncryptQueryString(claimId.ToString()); emailData.Add(adjusterEmail); emailData.Add(adjusterName); emailData.Add(secUserObj.Email); emailData.Add(secUserObj.UserName); emailData.Add(adjusterClaimNumber); emailData.Add(dateRecieved); emailData.Add(businessDescription); emailData.Add(redFlagName); emailData.Add(insuredName); emailData.Add(encryptedClaimNumber); return(emailData); }
protected void btnUpload_Click(object sender, EventArgs e) { string fileExtension = null; AdjusterMaster adjuster = null; string firstName = null; string lastName = null; AdjusterServiceArea serviceArea = null; AdjusterLicenseAppointmentType licenseAppointmentType = null; string licenseNumber = null; string licenseType = null; string licenseEffectiveDate = null; string licenseExpireDate = null; string appointmentType = null; StateMaster stateMaster = null; string str = null; lblMessage.Text = string.Empty; if (!fileUpload.HasFile) { lblMessage.Text = "No file selected."; lblMessage.CssClass = "error"; return; } // validate file fileExtension = System.IO.Path.GetExtension(fileUpload.PostedFile.FileName); if (!fileExtension.Equals(".csv", StringComparison.OrdinalIgnoreCase)) { lblMessage.Text = "CSV file format allowed only."; lblMessage.CssClass = "error"; return; } try { //save file in temp folder string destinationPath = Server.MapPath(string.Format("~//Temp//{0}.csv", Guid.NewGuid())); fileUpload.SaveAs(destinationPath); // load file for processing //DataTable table = CSVReader.ReadCSVFile(Server.MapPath("~//Temp//" + fileUpload.FileName), true); DataTable table = CSVHelper.ReadCSVFile(destinationPath); using (TransactionScope scope = new TransactionScope()) { for (int i = 0; i < table.Rows.Count; i++) { #region process each row adjuster = new AdjusterMaster(); adjuster.ClientId = clientID; adjuster.Status = true; adjuster.InsertBy = userID; adjuster.InsertDate = DateTime.Now; if (table.Rows[i]["First_Name"] != string.Empty) { firstName = table.Rows[i]["First_Name"].ToString(); } if (table.Rows[i]["Last_Name"] != string.Empty) { lastName = table.Rows[i]["Last_Name"].ToString(); } // skip blank rows if (string.IsNullOrEmpty(lastName) && string.IsNullOrEmpty(firstName)) { continue; } adjuster.FirstName = firstName.Length < 50 ? firstName : firstName.Substring(0, 50); adjuster.LastName = lastName.Length < 50 ? lastName : lastName.Substring(0, 50); if (table.Rows[i]["Middle_Initial"] != string.Empty) { str = table.Rows[i]["Middle_Initial"].ToString(); adjuster.MiddleInitial = str.Substring(0, 1); } adjuster.AdjusterName = string.Format("{0} {1} {2}", firstName, adjuster.MiddleInitial ?? "", lastName); if (table.Rows[i]["Suffix"] != string.Empty) { adjuster.Suffix = table.Rows[i]["Suffix"].ToString().Substring(0, 1); } if (table.Rows[i]["Cell_Phone_Number"] != string.Empty) { str = table.Rows[i]["Cell_Phone_Number"].ToString(); if (str.Length > 20) { adjuster.PhoneNumber = str.Substring(0, 20); } else { adjuster.PhoneNumber = str; } } if (table.Rows[i]["Email"] != string.Empty) { str = table.Rows[i]["Email"].ToString(); adjuster.email = str.Length < 100 ? str : str.Substring(0, 100); } if (table.Rows[i]["Address_Line1"] != string.Empty) { str = table.Rows[i]["Address_Line1"].ToString(); adjuster.Address1 = str.Length < 100 ? str : str.Substring(0, 100); } if (table.Rows[i]["City"] != string.Empty) { str = table.Rows[i]["City"].ToString(); adjuster.Address1 = str.Length < 50 ? str : str.Substring(0, 50); } if (table.Rows[i]["State_Code"] != string.Empty) { str = table.Rows[i]["State_Code"].ToString(); stateMaster = State.Getstateid(str); if (stateMaster.StateId > 0) { adjuster.StateID = stateMaster.StateId; } else { adjuster.StateID = null; } } if (table.Rows[i]["ZIP_Code"] != string.Empty) { str = table.Rows[i]["ZIP_Code"].ToString(); adjuster.Address1 = str.Length < 10 ? str : str.Substring(0, 10); } // save adjuster adjuster = AdjusterManager.Save(adjuster); if (table.Rows[i]["License_Type"] != string.Empty) { licenseType = table.Rows[i]["License_Type"].ToString(); } if (table.Rows[i]["License_Number"] != string.Empty) { licenseNumber = table.Rows[i]["License_Number"].ToString(); } if (table.Rows[i]["License_Issue_Date"] != string.Empty) { licenseEffectiveDate = table.Rows[i]["License_Issue_Date"].ToString(); } if (table.Rows[i]["License_Expires_Date"] != string.Empty) { licenseExpireDate = table.Rows[i]["License_Expires_Date"].ToString(); } if (table.Rows[i]["Appointment_Type"] != string.Empty) { appointmentType = table.Rows[i]["Appointment_Type"].ToString(); if (!string.IsNullOrEmpty(appointmentType)) { licenseAppointmentType = AdjusterLicenseAppointmentTypeManager.Get(appointmentType, clientID); if (licenseAppointmentType == null) { licenseAppointmentType = new AdjusterLicenseAppointmentType(); licenseAppointmentType.IsActive = true; licenseAppointmentType.LicenseAppointmentType = appointmentType; licenseAppointmentType.ClientID = clientID; licenseAppointmentType = AdjusterLicenseAppointmentTypeManager.Save(licenseAppointmentType); } } } if (!string.IsNullOrEmpty(licenseType) && !string.IsNullOrEmpty(licenseNumber) && !string.IsNullOrEmpty(licenseEffectiveDate) && !string.IsNullOrEmpty(licenseExpireDate) && !string.IsNullOrEmpty(appointmentType)) { serviceArea = new AdjusterServiceArea(); serviceArea.AdjusterID = adjuster.AdjusterId; serviceArea.StateID = adjuster.StateID; serviceArea.LicenseNumber = licenseNumber.Length < 50 ? licenseNumber : licenseNumber.Substring(0, 50); serviceArea.LicenseType = licenseType.Length < 20 ? licenseType : licenseType.Substring(0, 20); DateTime effectiveDate = DateTime.MaxValue; DateTime expireDate = DateTime.MaxValue; if (DateTime.TryParse(licenseEffectiveDate, out effectiveDate)) { serviceArea.LicenseEffectiveDate = effectiveDate; } if (DateTime.TryParse(licenseExpireDate, out expireDate)) { serviceArea.LicenseExpirationDate = expireDate; } if (licenseAppointmentType != null) { serviceArea.AppointmentTypeID = licenseAppointmentType.LicenseAppointmentTypeID; } AdjusterStateLicenseManager.Save(serviceArea); } // create notes if (table.Rows[i]["Adjuster_Status_Code"] != string.Empty) { string adjuster_Status_Code = table.Rows[i]["Adjuster_Status_Code"].ToString(); addNote(adjuster.AdjusterId, adjuster_Status_Code); } if (table.Rows[i]["Adjuster_Reason_Code"] != string.Empty) { string sdjuster_Reason_Code = table.Rows[i]["Adjuster_Reason_Code"].ToString(); addNote(adjuster.AdjusterId, sdjuster_Reason_Code); } #endregion } scope.Complete(); lblMessage.Text = "Import completed successfully."; lblMessage.CssClass = "ok"; } } catch (Exception ex) { lblMessage.Text = "Import not completed successfully."; lblMessage.CssClass = "error"; Core.EmailHelper.emailError(ex); } }
//[AllowAnonymous] public HttpResponseMessage Post([FromBody] AdjusterMaster data) { return(requestHandler.CreateGbObject(Request, data)); }
//[AllowAnonymous] public HttpResponseMessage Get([FromBody] AdjusterMaster data) { return(requestHandler.GetGbObjects(Request, data)); }
protected void UploadTemplate2() { // original format designed by Vivek 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 fileLineNumber = 0; int clientID = Core.SessionHelper.getClientId(); // assume homeowner int policyType = 1; DateTime DateSubmitted = DateTime.Now; DateTime ContractDate = DateTime.Now; string columnValue = null; Mortgagee mortgagee = null; StatusMaster statusMaster = null; string statusName = null; 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++) { fileLineNumber = i; objLead = new Leads(); //objLead.LeadStatus = 1; // active objLead.OriginalLeadDate = DateTime.Now; objLead.TypeOfProperty = 18; //residential objLead.UserId = Convert.ToInt32(Session["UserId"]); try { if (columnExists(table, "Create Date") && table.Rows[i]["Create Date"] != string.Empty) { DateTime.TryParse(table.Rows[i]["Create Date"].ToString(), out DateSubmitted); objLead.DateSubmitted = DateSubmitted; objLead.OriginalLeadDate = DateSubmitted; } if (columnExists(table, "Last Name") && table.Rows[i]["Last Name"] != string.Empty) { str = table.Rows[i]["Last Name"].ToString(); if (str.Length > 50) { objLead.ClaimantLastName = str.Substring(0, 50); objLead.OwnerLastName = objLead.ClaimantLastName; } else { objLead.ClaimantLastName = str; objLead.OwnerLastName = str; } } if (columnExists(table, "First Name") && table.Rows[i]["First Name"] != string.Empty) { str = table.Rows[i]["First Name"].ToString(); if (str.Length > 50) { objLead.ClaimantFirstName = str.Substring(0, 50); objLead.OwnerFirstName = objLead.ClaimantFirstName; } else { objLead.ClaimantFirstName = str; objLead.OwnerFirstName = str; } } if (columnExists(table, "Middle Name") && table.Rows[i]["Middle Name"] != string.Empty) { str = table.Rows[i]["Middle Name"].ToString(); if (str.Length > 50) { objLead.ClaimantMiddleName = str.Substring(0, 50); } else { objLead.ClaimantMiddleName = str; } } if (columnExists(table, "E-mail") && table.Rows[i]["E-mail"] != string.Empty) { str = table.Rows[i]["E-mail"].ToString(); if (str.Length > 100) objLead.EmailAddress = str.Substring(0, 100); else objLead.EmailAddress = str; } if (columnExists(table, "Personal E-mail") && table.Rows[i]["Personal E-mail"] != string.Empty) { str = table.Rows[i]["Personal E-mail"].ToString(); if (str.Length > 100) objLead.SecondaryEmail = str.Substring(0, 100); else objLead.SecondaryEmail = str; } if (columnExists(table, "Mobile Phone") && table.Rows[i]["Mobile Phone"] != string.Empty) { str = table.Rows[i]["Mobile Phone"].ToString(); if (str.Length > 20) objLead.SecondaryPhone = str.Substring(0, 20); else objLead.SecondaryPhone = str; } if (columnExists(table, "Salutation") && table.Rows[i]["Salutation"] != string.Empty) { str = table.Rows[i]["Salutation"].ToString(); if (str.Length > 50) objLead.Salutation = str.Substring(0, 20); else objLead.Salutation = str; } } catch (Exception ex) { lblError.Text = "There Is a problem in data save !!!"; lblError.Visible = true; Core.EmailHelper.emailError(ex); throw new Exception(ex.Message); } string adjusterName = null; int? adjusterID = null; AdjusterMaster adjuster = null; if (columnExists(table, "Adjuster Name") && table.Rows[i]["Adjuster Name"] != string.Empty) adjusterName = table.Rows[i]["Adjuster Name"].ToString(); string adjusterEmail = null; string adjusterFax = null; string AdjusterPhone = null; string AdjusterCo = null; string AdjusterAddress = null; if (columnExists(table, "Adjuster Email") && table.Rows[i]["Adjuster Email"] != string.Empty) adjusterEmail = table.Rows[i]["Adjuster Email"].ToString(); if (columnExists(table, "Adjuster Fax") && table.Rows[i]["Adjuster Fax"] != string.Empty) adjusterFax = table.Rows[i]["Adjuster Fax"].ToString(); if (columnExists(table, "Adjuster Phone") && table.Rows[i]["Adjuster Phone"] != string.Empty) AdjusterPhone = table.Rows[i]["Adjuster Phone"].ToString(); if (columnExists(table, "Adjuster Co") && table.Rows[i]["Adjuster Co"] != string.Empty) AdjusterCo = table.Rows[i]["Adjuster Co"].ToString(); if (columnExists(table, "Adj Address") && table.Rows[i]["Adj Address"] != string.Empty) AdjusterAddress = table.Rows[i]["Adj Address"].ToString(); 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.email = adjusterEmail; adjuster.Address1 = AdjusterAddress; adjuster.PhoneNumber = AdjusterPhone; adjuster.FaxNumber = adjusterFax; adjuster.CompanyName = AdjusterCo; adjuster = AdjusterManager.Save(adjuster); } adjusterID = adjuster.AdjusterId; } if (columnExists(table, "ExaminerName") && table.Rows[i]["ExaminerName"] != string.Empty) { InspectorMaster inspector = InspectorManager.GetByName(table.Rows[i]["ExaminerName"].ToString()); if (inspector.InspectorId > 0) { objLead.InspectorName = inspector.InspectorId; } } //if (columnExists(table, "Loss Location") && table.Rows[i]["Loss Location"] != string.Empty) // objLead.LossLocation = table.Rows[i]["Loss Location"].ToString(); //if (columnExists(table, "Date of Loss") && table.Rows[i]["Date of Loss"] != string.Empty) { // DateTime lossDate = DateTime.MinValue; // if (DateTime.TryParse(table.Rows[i]["Date of Loss"].ToString(), out lossDate)) // objLead.LossDate = lossDate; //} if (columnExists(table, "Contract Signed Date") && table.Rows[i]["Contract Signed Date"] != string.Empty) objLead.ContractDate = Convert.ToDateTime(table.Rows[i]["Contract Signed Date"].ToString()); if (columnExists(table, "Address 1") && table.Rows[i]["Address 1"] != string.Empty) { str = table.Rows[i]["Address 1"].ToString(); if (str.Length > 100) objLead.MailingAddress = str.Substring(0, 99); else objLead.LossAddress = str.ToString(); } try { if (columnExists(table, "City") && table.Rows[i]["City"] != string.Empty) objLead.MailingCity = table.Rows[i]["City"].ToString(); if (columnExists(table, "State") && table.Rows[i]["State"] != string.Empty) objLead.MailingState = table.Rows[i]["State"].ToString(); if (columnExists(table, "ZIP Code") && table.Rows[i]["ZIP Code"] != string.Empty) objLead.MailingZip = table.Rows[i]["ZIP Code"].ToString(); if (columnExists(table, "Business Name") && table.Rows[i]["Business Name"] != string.Empty) objLead.BusinessName = table.Rows[i]["Business Name"].ToString(); if (columnExists(table, "Adjuster Name") && table.Rows[i]["Adjuster Name"] != string.Empty) adjusterName = table.Rows[i]["Adjuster Name"].ToString(); if (columnExists(table, "Phone") && table.Rows[i]["Phone"] != string.Empty) { str = table.Rows[i]["Phone"].ToString(); if (str.Length > 20) objLead.PhoneNumber = str.Substring(0, 20); else objLead.PhoneNumber = str.ToString(); } if (columnExists(table, "Loss Address") && table.Rows[i]["Loss Address"] != string.Empty) { str = table.Rows[i]["Loss Address"].ToString(); if (str.Length > 100) objLead.LossAddress = str.Substring(0, 99); else objLead.LossAddress = str.ToString(); } if (columnExists(table, "Loss City") && table.Rows[i]["Loss City"] != string.Empty) objLead.CityName = table.Rows[i]["Loss City"].ToString(); if (columnExists(table, "Loss State") && table.Rows[i]["Loss State"] != string.Empty) objLead.StateName = table.Rows[i]["Loss State"].ToString(); if (columnExists(table, "Loss Zip Code") && table.Rows[i]["Loss Zip Code"] != string.Empty) { str = table.Rows[i]["Loss Zip Code"].ToString(); if (str.Length < 5) str = "0" + str; objLead.Zip = str; } if (columnExists(table, "Fax") && table.Rows[i]["Fax"] != string.Empty) { str = table.Rows[i]["Fax"].ToString(); if (str.Length > 20) objLead.SecondaryPhone = str.Substring(0, 20); else objLead.SecondaryPhone = str.ToString(); } if (columnExists(table, "File Status") && table.Rows[i]["File Status"] != string.Empty) { statusName = table.Rows[i]["File Status"].ToString(); 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.Status = true; statusMaster.StatusName = statusName; statusMaster = StatusManager.Save(statusMaster); } } } catch (Exception ex) { lblError.Text = "There Is a problem in data save !!!"; lblError.Visible = true; Core.EmailHelper.emailError(ex); throw new Exception(ex.Message); } if (columnExists(table, "Peril") && !string.IsNullOrEmpty(table.Rows[i]["Peril"].ToString())) { var id = TypeofDamageManager.getbyTypeOfDamage(table.Rows[i]["Peril"].ToString()); if (id.TypeOfDamageId > 0) objLead.TypeOfDamage = id.TypeOfDamageId.ToString() + ","; //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]["Peril"].ToString(); if (str.Length > 250) objLead.TypeofDamageText = str.Substring(0, 250).Replace("/", ","); else objLead.TypeofDamageText = str.Replace("/", ","); } objLead.Status = 1; // 2013-08-29 tortega if (clientID > 0) objLead.ClientID = clientID; Leads newLead = LeadsManager.Save(objLead); int policyTypeID = 1; if (newLead != null) { // add policy CRM.Data.Entities.LeadPolicy policy = new CRM.Data.Entities.LeadPolicy(); if (columnExists(table, "PolicyType") && table.Rows[i]["PolicyType"] != string.Empty) { policyTypeID = getPolicyType(table.Rows[i]["PolicyType"].ToString()); } policy.PolicyType = policyTypeID; policy.LeadId = newLead.LeadId; policy.IsActive = true; policy.isAllDocumentUploaded = false; if (adjusterID != null) policy.AdjusterID = adjusterID; if (columnExists(table, "LoanID") && table.Rows[i]["LoanID"] != string.Empty) { str = table.Rows[i]["LoanID"].ToString(); if (str.Length > 50) policy.LoanNumber = str.Substring(0, 50); else policy.LoanNumber = str; } if (columnExists(table, "DateOfEvaluation") && table.Rows[i]["DateOfEvaluation"] != string.Empty) { DateTime SiteSurveyDate = DateTime.MinValue; if (DateTime.TryParse(table.Rows[i]["DateOfEvaluation"].ToString(), out SiteSurveyDate)) policy.SiteSurveyDate = SiteSurveyDate; } if (columnExists(table, "Mortgagee") && table.Rows[i]["Mortgagee"] != string.Empty) { int id = getMortgageeID(table.Rows[i]["Mortgagee"].ToString(), clientID); if (id > 0) policy.MortgageeID = id; else { mortgagee = new Mortgagee(); mortgagee.ClientID = clientID; mortgagee.Status = true; mortgagee.MortageeName = table.Rows[i]["Mortgagee"].ToString(); mortgagee = MortgageeManager.Save(mortgagee); if (mortgagee.MortgageeID > 0) policy.MortgageeID = mortgagee.MortgageeID; } } if (columnExists(table, "Loss Location") && table.Rows[i]["Loss Location"] != string.Empty) policy.LossLocation = table.Rows[i]["Loss Location"].ToString(); if (columnExists(table, "Date of Loss") && table.Rows[i]["Date of Loss"] != string.Empty) { DateTime lossDate = DateTime.MinValue; if (DateTime.TryParse(table.Rows[i]["Date of Loss"].ToString(), out lossDate)) policy.LossDate = lossDate; } if (columnExists(table, "Policy Period") && table.Rows[i]["Policy Period"] != string.Empty) policy.PolicyPeriod = table.Rows[i]["Policy Period"].ToString(); string PolicyExpirationDate = null; if (columnExists(table, "PolicyExpirationDate") && table.Rows[i]["PolicyExpirationDate"] != string.Empty) PolicyExpirationDate = table.Rows[i]["PolicyExpirationDate"].ToString(); string effectiveDate = null; if (columnExists(table, "PolicyEffectiveDate") && table.Rows[i]["PolicyEffectiveDate"] != string.Empty) effectiveDate = table.Rows[i]["PolicyEffectiveDate"].ToString(); str = string.Format("{0} - {1}", effectiveDate ?? "N/A", PolicyExpirationDate ?? "N/A"); if (str.Length > 50) policy.PolicyPeriod = str.Substring(0, 50); else policy.PolicyPeriod = str; if (columnExists(table, "Claim Number") && table.Rows[i]["Claim Number"] != string.Empty) { str = table.Rows[i]["Claim Number"].ToString(); if (str.Length > 50) policy.ClaimNumber = str.Substring(0, 50); else policy.ClaimNumber = str; } if (columnExists(table, "Policy Number") && table.Rows[i]["Policy Number"] != string.Empty) { str = table.Rows[i]["Policy Number"].ToString(); if (str.Length > 100) policy.PolicyNumber = str.Substring(0, 100); else policy.PolicyNumber = str; } if (columnExists(table, "File Number") && table.Rows[i]["File Number"] != string.Empty) { str = table.Rows[i]["File Number"].ToString(); if (str.Length > 20) policy.InsurerFileNo = str.Substring(0, 20); else policy.InsurerFileNo = str; } if (statusMaster != null) policy.LeadStatus = statusMaster.StatusId; if (columnExists(table, "Ins Carrier") && table.Rows[i]["Ins Carrier"] != string.Empty) { str = table.Rows[i]["Ins Carrier"].ToString(); if (str.Length > 50) policy.InsuranceCompanyName = str.Substring(0, 50); else policy.InsuranceCompanyName = str; } if (columnExists(table, "Ins Co Address") && table.Rows[i]["Ins Co Address"] != string.Empty) { str = table.Rows[i]["Ins Co Address"].ToString(); if (str.Length > 50) policy.InsuranceAddress = str.Substring(0, 50); else policy.InsuranceAddress = str; } if (columnExists(table, "Ins Co City") && table.Rows[i]["Ins Co City"] != string.Empty) { string cityName = table.Rows[i]["Ins Co City"].ToString(); CityMaster cityMaster = City.GetByCityName(cityName); if (cityMaster != null && cityMaster.CityId > 0) policy.InsuranceCity = cityMaster.CityId; } if (columnExists(table, "Ins Co State") && table.Rows[i]["Ins Co State"] != string.Empty) { string stateName = table.Rows[i]["Ins Co State"].ToString(); StateMaster stateMaster = State.Getstateid(stateName); if (stateMaster != null && stateMaster.StateId > 0) policy.InsuranceState = stateMaster.StateId; } if (columnExists(table, "Ins Co Zip") && table.Rows[i]["Ins Co Zip"] != string.Empty) { string zipCode = table.Rows[i]["Ins Co Zip"].ToString(); ZipCodeMaster zipMaster = ZipCode.GetByZipCode(zipCode); if (zipMaster != null && zipMaster.ZipCodeID > 0) policy.InsuranceZipCode = zipMaster.ZipCodeID.ToString(); } LeadPolicyManager.Save(policy); // add policy comments if (columnExists(table, "Notes") && table.Rows[i]["Notes"] != string.Empty) { char[] splitTokens = { '\n' }; string[] lines = table.Rows[i]["Notes"].ToString().Split(splitTokens, StringSplitOptions.RemoveEmptyEntries); if (lines != null && lines.Length > 0) foreach (string line in lines) { string[] datetimeValues = line.Split(new char[] { ' ' }); if (datetimeValues.Length > 3) { string datetime = string.Format("{0} {1} {2}", datetimeValues[0] ?? "", datetimeValues[1] ?? "", datetimeValues[2] ?? ""); DateTime commentInsertDate = DateTime.Now; if (DateTime.TryParse(datetime, out commentInsertDate)) AddComments(newLead.LeadId, policyTypeID, line, commentInsertDate); else AddComments(newLead.LeadId, policyTypeID, line); } else AddComments(newLead.LeadId, policyTypeID, line); } //AddComments(newLead.LeadId, policyTypeID, table.Rows[i]["Notes"].ToString().Replace("\n","<br/>"); } if (columnExists(table, "Certified Mail Number") && table.Rows[i]["Certified Mail Number"] != string.Empty) AddComments(newLead.LeadId, policyTypeID, "Certified Mail Number: " + table.Rows[i]["Certified Mail Number"].ToString()); //if (columnExists(table, "Contract Signed Date") && table.Rows[i]["Contract Signed Date"] != string.Empty) // AddComments(newLead.LeadId, policyTypeID, "Contract Signed Date: " + table.Rows[i]["Contract Signed Date"].ToString()); if (columnExists(table, "Last E-mail") && table.Rows[i]["Last E-mail"] != string.Empty) AddComments(newLead.LeadId, policyTypeID, "Last E-mail Date: " + table.Rows[i]["Last E-mail"].ToString()); if (columnExists(table, "Last Meeting") && table.Rows[i]["Last Meeting"] != string.Empty) AddComments(newLead.LeadId, policyTypeID, "Last Meeting Date: " + table.Rows[i]["Last Meeting"].ToString()); if (columnExists(table, "Letter Date") && table.Rows[i]["Letter Date"] != string.Empty) AddComments(newLead.LeadId, policyTypeID, "Letter Date: " + table.Rows[i]["Letter Date"].ToString()); } } //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; } }
private void notifyAdjuster(AdjusterMaster adjuster, StringBuilder claimList) { StringBuilder emailBody = new StringBuilder(); string password = null; string[] recipients = null; string smtpHost = null; int smtpPort = 0; string siteUrl = ConfigurationManager.AppSettings["siteUrl"].ToString(); string subject = "Claim Assignment Notification"; CRM.Data.Entities.SecUser user = null; string itsgHost = ConfigurationManager.AppSettings["smtpHost"].ToString(); string itsgHostPort = ConfigurationManager.AppSettings["smtpPort"].ToString(); string itsgEmail = ConfigurationManager.AppSettings["smtpEmail"].ToString(); string itsgEmailPassword = ConfigurationManager.AppSettings["smtpPassword"].ToString(); int.TryParse(itsgHostPort, out smtpPort); // get logged in user int userID = SessionHelper.getUserId(); //Convert.ToInt32(itsgHostPort); // get current user email info user = SecUserManager.GetByUserId(userID); // load email credentials smtpHost = user.emailHost; int.TryParse(user.emailHostPort, out smtpPort); // recipients recipients = new string[] { adjuster.email }; // build email body // .containerBox emailBody.Append("<div style=\"margin:auto;width:600px;border: 1px solid #DDDDE4; margin: auto;font-family: Tahoma, Arial,sans-serif;font-size: 12px;color: #808080;\">"); // .header //emailBody.Append("<div style=\"background-image:url(https://appv3.claimruler.com/images/email_header_small.jpg);background-repeat: no-repeat;background-size: 100% 100%;height:70px;\"></div>"); emailBody.Append("<div><img src=\"http://app.claimruler.com/images/email_header_small.jpg\"></image></div>"); // .paneContentInner emailBody.Append("<div style=\"margin: 20px;\">"); emailBody.Append("Hi " + adjuster.adjusterName + "!<br><br>"); emailBody.Append("Your firm uses Claim Ruler software for claims management and the following claim(s) have been assigned to you.<br><br>"); emailBody.Append("Please review claim(s) right away to begin handling the file(s). Time is of the essence!<br><br>"); emailBody.Append("<table style=\"width:550px;\">"); emailBody.Append(string.Format("<tr align=\"center\"><th scope=\"col\">{0}</th><th scope=\"col\">{1}</th><th scope=\"col\">{2}</th></tr>", "Insured Name", "Adjuster Claim #", "Insurer Claim #")); // claim list emailBody.Append(claimList.ToString()); // end email body emailBody.Append("</table>"); emailBody.Append(string.Format("<p><a href=\"{0}/login.aspx\">Please click here to access Claim Ruler.</a></p>", siteUrl)); emailBody.Append("<br>Thank you."); emailBody.Append("</div>"); // inner containerBox emailBody.Append("</div>"); // paneContentInner emailBody.Append("</div>"); // containerBox //Core.EmailHelper.sendEmail(user.Email, recipients, null, "Claim Assignment Notification", emailBody.ToString(), null, user.emailHost, smtpPort, smtpEmail, smtpPassword, true); password = Core.SecurityManager.Decrypt(user.emailPassword); //Core.EmailHelper.sendEmail(user.Email, recipients, null, subject, emailBody.ToString(), null, user.emailHost, smtpPort, user.Email, password, user.isSSL ?? true); Core.EmailHelper.sendEmail(user.Email, recipients, null, subject, emailBody.ToString(), null, itsgHost, Convert.ToInt32(itsgHostPort), itsgEmail, itsgEmailPassword); }
protected void btnSaveClaimService_Click(object sender, EventArgs e) { ClaimService claimService = null; ClaimComment diary = null; AdjusterMaster adjuster = null; Claim myClaim = null; CarrierInvoiceProfile CarrierInvoice = null; int userID = SessionHelper.getUserId(); int claimID = SessionHelper.getClaimID(); int id = 0; int myAdjusterID = 0; int profileID = 0; Page.Validate("service"); if (!Page.IsValid) { return; } id = Convert.ToInt32(ViewState["ClaimServiceID"]); //Get current claim info to pass through to emails ClaimManager cm = new ClaimManager(); myClaim = cm.Get(claimID); //AdjusterManager try { using (TransactionScope scope = new TransactionScope()) { using (ClaimServiceManager repository = new ClaimServiceManager()) { if (id == 0) { claimService = new ClaimService(); claimService.ClaimID = claimID; } else { claimService = repository.Get(id); } claimService.ServiceQty = this.txtServiceQty.Value == null ? 0 : Convert.ToDecimal(txtServiceQty.Value); claimService.ServiceDate = txtServiceDate.Date; claimService.ServiceDescription = txtServiceDescription.Text.Trim(); claimService.ServiceTypeID = Convert.ToInt32(this.ddlInvoiceServiceType.SelectedValue); claimService.UserID = userID; claimService.AdjusterID = Convert.ToInt32(hf_serviceAdjusterID.Value); claimService.Activity = ddlActivity.SelectedItem.Text; claimService.InternalComments = txtMyComments.Text.Trim(); claimService.IsBillable = cbIsBillable.Checked; claimService.Billed = false; //save to db claimService = repository.Save(claimService); //string EmailService = ddlInvoiceServiceType.SelectedItem.Text; //string EmailActivity = ddlActivity.SelectedItem.Text; //string EmailDescription = txtServiceDescription.Text; //string EmailInternal = txtMyComments.Text; //string EmailQuantity = txtServiceQty.Text; //string EmailDate = txtServiceDate.Text; } // diary diary = new ClaimComment(); diary.ClaimID = claimID; diary.CommentDate = DateTime.Now; diary.UserId = userID; diary.ActivityType = ddlActivity.SelectedItem.Text; diary.InternalComments = txtMyComments.Text.Trim(); diary.CommentText = string.Format("Service: {0}, Description: {1}, Date {2:MM/dd/yyyy}, Qty: {3:N2}, Adjuster: {4}", ddlInvoiceServiceType.SelectedItem.Text, claimService.ServiceDescription, claimService.ServiceDate, claimService.ServiceQty, txtServiceAdjuster.Text ); ClaimCommentManager.Save(diary); myAdjusterID = Convert.ToInt32(claimService.AdjusterID); //Convert.ToInt32(myClaim.AdjusterID); //EMAIL ADJUSTER OC 10/21/2014 if (myAdjusterID != 0 || myAdjusterID != null) { adjuster = AdjusterManager.GetAdjusterId(myAdjusterID); } if (cbEmailAdjuster.Checked == true) { try { notifyAdjuster(adjuster, claimService, myClaim); } catch (Exception ex) { lblMessage.Text = "Unable to send email to adjuster"; lblMessage.CssClass = "error"; } } //EMAIL CLIENT CONTACT OC 10/22/2014 if (cbEmailClient.Checked == true) //Dont need to check if invoice Pro ID is empty becuase to get to this point, one has to exist already { if (Session["ComingFromAllClaims"] != null) //if the user got here straight from the all claims screen { profileID = Convert.ToInt32(Session["CarrierInvoiceID"]); } else//coming from claim detail page { profileID = Convert.ToInt32(Session["InvoiceProfileID"]); } CarrierInvoice = CarrierInvoiceProfileManager.Get(profileID); try { notifyClientContact(CarrierInvoice, claimService, myClaim, adjuster); } catch (Exception ex) { lblMessage.Text = "Unable to send email to client contact"; lblMessage.CssClass = "error"; } } //EMAIL TO WHOMEVER if (txtEmailTo.Text != "") { try { notifySpecifiedUser(adjuster, claimService, myClaim); } catch (Exception ex) { lblMessage.Text = "Unable to send email to adjuster"; lblMessage.CssClass = "error"; } } scope.Complete(); } lblMessage.Text = "Service was saved successfully."; lblMessage.CssClass = "ok"; // keep edit form active lbtnNewClaimService_Click(null, null); // refresh grid gvClaimService.DataSource = loadClaimServices(claimID); gvClaimService.DataBind(); } catch (Exception ex) { Core.EmailHelper.emailError(ex); lblMessage.Text = "Unable to save claim service."; lblMessage.CssClass = "error"; } //send email to adjuster }
public override T Convert <T, U>(U entity) { AdjusterMaster adjusterMasterDB = entity as AdjusterMaster; if (adjusterMasterDB == null) { return(default(T)); } BO.AdjusterMaster adjusterMasterBO = new BO.AdjusterMaster(); adjusterMasterBO.ID = adjusterMasterDB.Id; adjusterMasterBO.CompanyId = adjusterMasterDB.CompanyId; adjusterMasterBO.FirstName = adjusterMasterDB.FirstName; adjusterMasterBO.MiddleName = adjusterMasterDB.MiddleName; adjusterMasterBO.LastName = adjusterMasterDB.LastName; adjusterMasterBO.InsuranceMasterId = adjusterMasterDB.InsuranceMasterId; adjusterMasterBO.AddressInfoId = adjusterMasterDB.AddressInfoId; adjusterMasterBO.ContactInfoId = adjusterMasterDB.ContactInfoId; if (adjusterMasterDB.AddressInfo != null) { BO.AddressInfo boAddress = new BO.AddressInfo(); boAddress.Name = adjusterMasterDB.AddressInfo.Name; boAddress.Address1 = adjusterMasterDB.AddressInfo.Address1; boAddress.Address2 = adjusterMasterDB.AddressInfo.Address2; boAddress.City = adjusterMasterDB.AddressInfo.City; boAddress.State = adjusterMasterDB.AddressInfo.State; boAddress.ZipCode = adjusterMasterDB.AddressInfo.ZipCode; boAddress.Country = adjusterMasterDB.AddressInfo.Country; //[STATECODE-CHANGE] //boAddress.StateCode = adjusterMasterDB.AddressInfo.StateCode; //[STATECODE-CHANGE] boAddress.CreateByUserID = adjusterMasterDB.AddressInfo.CreateByUserID; boAddress.ID = adjusterMasterDB.AddressInfo.id; adjusterMasterBO.AddressInfo = boAddress; } if (adjusterMasterDB.ContactInfo != null) { BO.ContactInfo boContactInfo = new BO.ContactInfo(); boContactInfo.Name = adjusterMasterDB.ContactInfo.Name; boContactInfo.CellPhone = adjusterMasterDB.ContactInfo.CellPhone; boContactInfo.EmailAddress = adjusterMasterDB.ContactInfo.EmailAddress; boContactInfo.HomePhone = adjusterMasterDB.ContactInfo.HomePhone; boContactInfo.WorkPhone = adjusterMasterDB.ContactInfo.WorkPhone; boContactInfo.FaxNo = adjusterMasterDB.ContactInfo.FaxNo; boContactInfo.CreateByUserID = adjusterMasterDB.ContactInfo.CreateByUserID; boContactInfo.ID = adjusterMasterDB.ContactInfo.id; boContactInfo.OfficeExtension = adjusterMasterDB.ContactInfo.OfficeExtension; boContactInfo.AlternateEmail = adjusterMasterDB.ContactInfo.AlternateEmail; boContactInfo.PreferredCommunication = adjusterMasterDB.ContactInfo.PreferredCommunication; adjusterMasterBO.ContactInfo = boContactInfo; } //Common adjusterMasterBO.IsDeleted = adjusterMasterDB.IsDeleted; adjusterMasterBO.CreateByUserID = adjusterMasterDB.CreateByUserID; adjusterMasterBO.UpdateByUserID = adjusterMasterDB.UpdateByUserID; return((T)(object)adjusterMasterBO); }
//protected void saveCoverages(int policyID) { // LeadPolicyCoverage coverage = null; // decimal deductible = 0; // foreach (GridViewRow row in gvCoverages.Rows) { // if (row.RowType == DataControlRowType.DataRow) { // TextBox txtCoverage = row.FindControl("txtCoverage") as TextBox; // TextBox txtLimit = row.FindControl("txtLimit") as TextBox; // WebTextEditor txtDeductible = row.FindControl("txtDeductible") as WebTextEditor; // TextBox txtCoinsuranceForm = row.FindControl("txtCoinsuranceForm") as TextBox; // // skip empty rows // if (string.IsNullOrEmpty(txtCoverage.Text) && string.IsNullOrEmpty(txtLimit.Text) && string.IsNullOrEmpty(txtDeductible.Text)) // continue; // coverage = new LeadPolicyCoverage(); // coverage.LeadPolicyID = policyID; // decimal.TryParse(txtDeductible.Text, out deductible); // coverage.Deductible = deductible; // coverage.Description = txtCoverage.Text.Trim(); // LeadPolicyCoverageManager.Save(coverage); // } // } //} protected Leads saveLead() { Leads lead = new Leads(); AdjusterMaster adjuster = null; lead.ClientID = clientID; lead.UserId = userID; lead.Status = 1; //if (roleID == (int)UserRole.Adjuster) { // // assign adjuster // adjuster = AdjusterManager.GetAdjusterByUserID(userID); // if (adjuster != null) // lead.Adjuster = adjuster.AdjusterId; //} lead.ClaimantFirstName = txtInsuredFirstName.Text.Trim(); lead.ClaimantLastName = txtInsuredLastName.Text.Trim(); #region insured loss address lead.LossAddress = txtInsuredLossAddressLine.Text.Trim(); lead.LossAddress2 = txtInsuredLossAddressLine2.Text.Trim(); if (ddlInsuredLossState.SelectedIndex > 0) { lead.StateId = Convert.ToInt32(ddlInsuredLossState.SelectedValue); lead.StateName = ddlInsuredLossState.SelectedItem.Text; } if (this.ddlInsuredLossCity.SelectedIndex > 0) { lead.CityId = Convert.ToInt32(ddlInsuredLossCity.SelectedValue); lead.CityName = ddlInsuredLossCity.SelectedItem.Text; } if (this.ddlInsuredLossZipCode.SelectedIndex > 0) { lead.Zip = ddlInsuredLossZipCode.SelectedItem.Text; } #endregion #region insured mailing address lead.MailingAddress = txtInsuredMailingAddress.Text.Trim(); if (ddlInsuredMailingCity.SelectedIndex > 0) { lead.MailingCity = ddlInsuredMailingCity.SelectedItem.Text; } if (ddlInsuredMailingState.SelectedIndex > 0) { lead.MailingState = ddlInsuredMailingState.SelectedItem.Text; } if (ddlInsuredMailingZipCode.SelectedIndex > 0) { lead.MailingZip = ddlInsuredMailingZipCode.SelectedItem.Text; } #endregion lead.OriginalLeadDate = DateTime.Now; lead.PhoneNumber = txtInsuredPhone.Text.Trim(); lead.EmailAddress = txtInsuredEmail.Text.Trim(); lead.SecondaryPhone = txtInsuredFax.Text.Trim(); if (ddlTypeOfProperty.SelectedIndex > 0) { lead.TypeOfProperty = Convert.ToInt32(ddlTypeOfProperty.SelectedValue); } #region damage type 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 (Damagetxt != string.Empty && DamageId != string.Empty) { lead.TypeOfDamage = DamageId; lead.TypeofDamageText = Damagetxt; } #endregion lead = LeadsManager.Save(lead); return(lead); }
public static void notifyUser(int claimStatus, string insurerClaimId, string insurerName, int claimAdjusterId, string adjusterComapnyName, string updatedby, string commentNote, string emailTo, int carrierID, int claimid, string recipient, string claimAdjuster, string claimStatusName, string carrier, string[] recipId, string[] idofTable) { StringBuilder emailBody = new StringBuilder(); string password = null; string[] recipients = null; string smtpHost = null; int smtpPort = 0; int supervisorId = 0; AdjusterMaster objAdjusterMaster = null; CRM.Data.Entities.SecUser objSecUser = null; //string siteUrl = ConfigurationManager.AppSettings["siteUrl"].ToString(); string subject = "Please Read Note, Claim Ruler Status Change to: " + claimStatusName + " on Claim # " + insurerClaimId; CRM.Data.Entities.SecUser user = null; // get logged in user int userID = SessionHelper.getUserId(); // get logged in user email info user = SecUserManager.GetByUserId(userID); // load email credentials smtpHost = user.emailHost; string appurl = ConfigurationManager.AppSettings["appURL"].ToString(); int.TryParse(user.emailHostPort, out smtpPort); recipient = emailTo != string.Empty && recipient != string.Empty ? emailTo + "," + recipient : recipient; recipient = emailTo != string.Empty && recipient == string.Empty ? emailTo : recipient; objAdjusterMaster = new AdjusterMaster(); objAdjusterMaster = AdjusterManager.GetAdjusterId(claimAdjusterId); // code for add adjuster and supervisor email for add in recipients if (user.Email != string.Empty) { recipient = recipient + "," + user.Email; } if (!string.IsNullOrEmpty(objAdjusterMaster.email)) { recipient = recipient + "," + objAdjusterMaster.email; } if (!string.IsNullOrEmpty(Convert.ToString(objAdjusterMaster.SupervisorID))) { SecUserManager.GetByUserId(objAdjusterMaster.SupervisorID ?? 0); objSecUser = new Data.Entities.SecUser(); if (!string.IsNullOrEmpty(objSecUser.Email)) { recipient = recipient + "," + objSecUser.Email; } } // recipients recipients = new string[] { }; recipients = recipient.Split(','); // build email body // .containerBox emailBody.Append("<div>"); emailBody.Append("<div>"); emailBody.Append("Hi " + claimAdjuster + ",<br><br>"); emailBody.Append("<table>"); emailBody.Append("<tr><td style='width:100px;'></td>"); emailBody.Append("<td>"); emailBody.Append("<b>Update Claim Status/Review</b><br/>"); emailBody.Append("</td>"); emailBody.Append("</tr>"); emailBody.Append("</table>"); emailBody.Append("<table>"); emailBody.Append("<tr>"); emailBody.Append("<td style='width:200px;'>"); emailBody.Append("Update Status To:"); emailBody.Append("</td>"); emailBody.Append("<td>"); emailBody.Append(claimStatusName); emailBody.Append("</td>"); emailBody.Append("</tr>"); emailBody.Append("<tr>"); emailBody.Append("<td>"); emailBody.Append("Insurer Claim #:"); emailBody.Append("</td>"); emailBody.Append("<td><a href='" + appurl + "/protected/Admin/UsersLeads.aspx?s=" + insurerClaimId + "'>"); emailBody.Append(insurerClaimId); emailBody.Append("</a></td>"); emailBody.Append("</tr>"); emailBody.Append("<tr>"); emailBody.Append("<td>"); emailBody.Append("Insured Name:"); emailBody.Append("</td>"); emailBody.Append("<td>"); emailBody.Append(insurerName); emailBody.Append("</td>"); emailBody.Append("</tr>"); emailBody.Append("<tr>"); emailBody.Append("<td>"); emailBody.Append("Carrier:"); emailBody.Append("</td>"); emailBody.Append("<td>"); emailBody.Append(carrier); emailBody.Append("</td>"); emailBody.Append("</tr>"); emailBody.Append("<tr>"); emailBody.Append("<td>"); emailBody.Append("Adjuster:"); emailBody.Append("</td>"); emailBody.Append("<td>"); emailBody.Append(claimAdjuster); emailBody.Append("</td>"); emailBody.Append("</tr>"); emailBody.Append("<tr>"); emailBody.Append("<td>"); emailBody.Append("Adjuster Company Name:"); emailBody.Append("</td>"); emailBody.Append("<td>"); emailBody.Append(adjusterComapnyName); emailBody.Append("</td>"); emailBody.Append("</tr>"); emailBody.Append("<tr>"); emailBody.Append("<td>"); emailBody.Append("Updated By:"); emailBody.Append("</td>"); emailBody.Append("<td>"); emailBody.Append(user.UserName); emailBody.Append("</td>"); emailBody.Append("</tr>"); emailBody.Append("<tr>"); emailBody.Append("<td>"); emailBody.Append("Comment/Note:"); emailBody.Append("</td>"); emailBody.Append("<td>"); emailBody.Append(commentNote); emailBody.Append("</td>"); emailBody.Append("</tr>"); emailBody.Append("<tr>"); emailBody.Append("<td>"); emailBody.Append("Email To:"); emailBody.Append("</td>"); emailBody.Append("<td>"); emailBody.Append(emailTo); emailBody.Append("</td>"); emailBody.Append("</tr>"); if (recipId.Length > 0) { emailBody.Append("<tr>"); emailBody.Append("<td style='vertical-align:top'>"); emailBody.Append("Selected Recipients"); emailBody.Append("</td>"); emailBody.Append("<td>"); ////// emailBody.Append("<table style='border:1px solid;'>"); emailBody.Append("<tr>"); emailBody.Append("<td>"); emailBody.Append("First Name"); emailBody.Append("</td>"); emailBody.Append("<td>"); emailBody.Append("Last Name"); emailBody.Append("</td>"); emailBody.Append("<td>"); emailBody.Append("Company Name"); emailBody.Append("</td>"); emailBody.Append("<td>"); emailBody.Append("Email"); emailBody.Append("</td>"); emailBody.Append("<td>"); emailBody.Append("Contact Title"); emailBody.Append("</td>"); emailBody.Append("</tr>"); int index2 = 0; for (int index = 0; index < recipId.Length; index++) { index2 = 0; int.TryParse(recipId[index], out index2); if (idofTable[index] == "c") { Contact objContact = ContactManager.Get(index2); emailBody.Append("<tr>"); emailBody.Append("<td>"); emailBody.Append(objContact.FirstName); emailBody.Append("</td>"); emailBody.Append("<td>"); emailBody.Append(objContact.LastName); emailBody.Append("</td>"); emailBody.Append("<td>"); emailBody.Append(objContact.CompanyName); emailBody.Append("</td>"); emailBody.Append("<td>"); emailBody.Append(objContact.Email); emailBody.Append("</td>"); emailBody.Append("<td>"); emailBody.Append(objContact.ContactTitle); emailBody.Append("</td>"); emailBody.Append("</tr>"); } else { AdjusterMaster objAdjuster = AdjusterManager.GetAdjusterId(index2); emailBody.Append("<tr>"); emailBody.Append("<td>"); emailBody.Append(objAdjuster.FirstName); emailBody.Append("</td>"); emailBody.Append("<td>"); emailBody.Append(objAdjuster.LastName); emailBody.Append("</td>"); emailBody.Append("<td>"); emailBody.Append(objAdjuster.CompanyName); emailBody.Append("</td>"); emailBody.Append("<td>"); emailBody.Append(objAdjuster.email); emailBody.Append("</td>"); emailBody.Append("<td>"); emailBody.Append(""); emailBody.Append("</td>"); emailBody.Append("</tr>"); } } emailBody.Append("</table>"); emailBody.Append("</td>"); emailBody.Append("</tr>"); } emailBody.Append("</table>"); emailBody.Append("</div>"); // paneContentInner emailBody.Append("</div>"); // containerBox password = Core.SecurityManager.Decrypt(user.emailPassword); // Core.EmailHelper.sendEmail(user.Email, recipients, null, subject, emailBody.ToString(), null, user.emailHost, smtpPort, user.Email, password, true);//user.isSSL ?? string crsupportEmail = ConfigurationManager.AppSettings["smtpEmail"].ToString(); string crsupportEmailPassword = ConfigurationManager.AppSettings["smtpPassword"].ToString(); Core.EmailHelper.sendEmail(crsupportEmail, recipients, null, subject, emailBody.ToString(), null, crsupportEmail, crsupportEmailPassword); }
public static string SaveClaimStatus(int claimStatus, string insurerClaimId, string insurerName, int claimAdjusterId, string adjusterComapnyName, string updatedby, string commentNote, string emailTo, int carrierID, int claimID, string recipientId, string claimAdjuster, string claimStatusName, string carrier, string idOf) { string json = ""; Claim objclaim = null; AdjusterMaster objAdjusterMaster = null; Leads objLeads = null; CRM.Data.Entities.LeadPolicy objLeadPolicy = null; ClaimComment comment = null; Client objClient = null; int userID = SessionHelper.getUserId(); int leadID = 0; int policyId = 0; try { using (TransactionScope scope = new TransactionScope()) { using (ClaimManager repository = new ClaimManager()) { objclaim = new Claim(); objclaim.ClaimID = claimID; objclaim.StatusID = claimStatus; objclaim.InsurerClaimNumber = insurerClaimId; //objclaim.CarrierID = carrierID; objclaim.AdjusterID = claimAdjusterId; objclaim.StatusUpdatedBy = updatedby; objclaim.StatusCommentNote = commentNote; //objclaim.StatusEmailTo = EmailTo; repository.UpdateClaimStatus(objclaim); // AdjusterMaster objAdjusterMaster = new AdjusterMaster(); objAdjusterMaster.AdjusterId = claimAdjusterId; //objAdjusterMaster.CompanyName = AdjusterComapnyName; repository.UpdateAdjusterName(objAdjusterMaster); //leads leadID = repository.GetPolicyId(claimID); objLeads = new Leads(); objLeads.LeadId = leadID; objLeads.InsuredName = insurerName; repository.UpdateInsurerName(objLeads); //save carrier id in Lead policy policyId = repository.GetLeadPolicyId(claimID); objLeadPolicy = new Data.Entities.LeadPolicy(); objLeadPolicy.Id = policyId; objLeadPolicy.CarrierID = carrierID; repository.UpdateCarrierId(objLeadPolicy); //claim comment for add notes comment = new ClaimComment(); comment.ClaimID = claimID; comment.IsActive = true; comment.UserId = Core.SessionHelper.getUserId(); comment.CommentDate = DateTime.Now; comment.ActivityType = "Status Changed"; comment.CommentText = commentNote.Trim(); ClaimCommentManager.Save(comment); //client company name //Client c = ClaimsManager.GetClientByUserId(SessionHelper.getUserId()); //c.BusinessName = AdjusterComapnyName; //ClaimsManager.SaveClient(c); } scope.Complete(); } string[] recipId = recipientId.Split(','); string recipientEmailId = string.Empty; string[] idofTable = idOf.Split(','); int index2 = 0; for (int index = 0; index < recipId.Length; index++) { index2 = 0; int.TryParse(recipId[index], out index2); if (idofTable[index] == "c") { Contact objContact = ContactManager.Get(index2); if (!string.IsNullOrEmpty(objContact.Email)) { if (recipientEmailId == "") { recipientEmailId = objContact.Email; } else { recipientEmailId = recipientEmailId + "," + objContact.Email; } } } else { AdjusterMaster objAdjuster = AdjusterManager.GetAdjusterId(index2); if (!string.IsNullOrEmpty(objAdjuster.email)) { if (recipientEmailId == "") { recipientEmailId = objAdjuster.email; } else { recipientEmailId = recipientEmailId + "," + objAdjuster.email; } } } } if (!string.IsNullOrEmpty(recipientEmailId)) { notifyUser(claimStatus, insurerClaimId, insurerName, claimAdjusterId, adjusterComapnyName, updatedby, commentNote, "", carrierID, claimID, recipientEmailId, claimAdjuster, claimStatusName, carrier, recipId, idofTable); } json = "Status save successfully"; } catch (Exception ex) { Core.EmailHelper.emailError(ex); } return json; }
protected bool saveAdjuster() { AdjusterMaster adjuster = null; bool isSuccess = true; int yearsExperience = 0; int deploymentStateID = 0; int maxClaimNumner = 0; // 2013-08-07 tortega int clientID = Core.SessionHelper.getClientId(); decimal fee = 0; int adjusterID = Convert.ToInt32(hdId.Value); string adjusterName = string.Format("{0} {1}", txtFirstName.Text, txtLastName.Text); using (TransactionScope scope = new TransactionScope()) { bool exists = AdjusterManager.IsExist(adjusterName, clientID); if (adjusterID == 0 && exists) { lblMessage.Text = "Adjuster name already exists."; lblMessage.Visible = true; txtFirstName.Focus(); return false; } if (adjusterID > 0) { // update adjuster adjuster = AdjusterManager.GetAdjusterId(adjusterID); adjuster.Status = cbxStatus.Checked; } else { // mew adjuster adjuster = new AdjusterMaster(); adjuster.Status = true; } adjuster.AdjusterName = adjusterName; adjuster.FirstName = txtFirstName.Text; adjuster.LastName = txtLastName.Text; adjuster.FederalTaxID = txtFedID.Text.Trim(); adjuster.Address1 = txtAddress.Text.Trim(); adjuster.Address2 = txtAddress2.Text.Trim(); adjuster.CityName = txtCityName.Text.Trim(); adjuster.ZipCode = txtZip.Text.Trim(); adjuster.FederalTaxID = txtFedID.Text.Trim(); adjuster.CompanyName = txtCompanyName.Text.Trim(); adjuster.PhoneNumber = txtPhoneNumber.Text.Trim();//NEW OC 9/22/2014 adjuster.CompanyPhone = txtCompanyPhone.Text.Trim(); adjuster.FaxNumber = txtFaxNumber.Text.Trim(); //decimal.TryParse(txtFeeContract.Text, out fee); adjuster.FeePerContract = fee; adjuster.isEmailNotification = cbxNotification.Checked; adjuster.isNotifyUserUploadDocument = cbxNotifyUserUploadDocument.Checked; adjuster.email = txtEmail.Text; adjuster.isW9 = cbxisW9.Checked; int.TryParse(txtYearExperience.Text, out yearsExperience); adjuster.YearsExperiece = yearsExperience; adjuster.GeographicalSeriveArea = txtServiceArea.Text; adjuster.Certifications = txtCertification.Text; // 2013-08-07 tortega if (clientID > 0) adjuster.ClientId = clientID; adjuster.UseDeploymentAddress = cbxUseDeploymentAddress.Checked; if (ddlState.SelectedIndex > 0) adjuster.StateID = Convert.ToInt32(ddlState.SelectedValue); else adjuster.StateID = null; int.TryParse(txtMaxNumberClaims.Text, out maxClaimNumner); adjuster.MaxClaimNumber = maxClaimNumner; // 2014-05-02 adjuster.XactNetAddress = txtXactNetAddress.Text; adjuster.HourlyRate = txtHourlyRate.ValueDecimal; adjuster.CommissionRate = txtCommissionRate.ValueDecimal; // 2014-05-04 tortega if (ddlSupervisor.SelectedIndex > 0) adjuster.SupervisorID = Convert.ToInt32(ddlSupervisor.SelectedValue); int deploymentAddressId = 0; int.TryParse(ddlDeploymentAddress.SelectedValue, out deploymentAddressId); if (deploymentAddressId > 0) { AdjusterDeploymentAddress objAdjusterDeploymentAddress = AdjusterManager.GetDeployementAddress(deploymentAddressId); if (objAdjusterDeploymentAddress!=null) { adjuster.DeploymentAddress = objAdjusterDeploymentAddress.DeploymentAddress; adjuster.DeploymentAddress2 = objAdjusterDeploymentAddress.DeploymentAddress2; adjuster.DeploymentCity = objAdjusterDeploymentAddress.City; if (objAdjusterDeploymentAddress.ZipCode!=null) { adjuster.DeploymentZipCode = Convert.ToString(objAdjusterDeploymentAddress.ZipCode); } adjuster.DeploymentStateID =objAdjusterDeploymentAddress.States; } //fill control txtDeployAddress.Text = objAdjusterDeploymentAddress.DeploymentAddress; txtDeployAddress2.Text = objAdjusterDeploymentAddress.DeploymentAddress2; if (objAdjusterDeploymentAddress.States != null) { ddlDeployState.SelectedValue = Convert.ToString(objAdjusterDeploymentAddress.States); } else { ddlDeployState.SelectedValue = "0"; } txtDeployCity.Text = objAdjusterDeploymentAddress.City; if (objAdjusterDeploymentAddress.ZipCode!=null) { txtDeployZipCode.Text = Convert.ToString(objAdjusterDeploymentAddress.ZipCode); } } else { // deployment address adjuster.DeploymentAddress = txtDeployAddress.Text; adjuster.DeploymentAddress2 = txtDeployAddress2.Text; adjuster.DeploymentCity = txtDeployCity.Text; adjuster.DeploymentZipCode = txtDeployZipCode.Text; int.TryParse(ddlDeployState.SelectedValue, out deploymentStateID); if (deploymentStateID > 0) adjuster.DeploymentStateID = deploymentStateID; //code fro save deployment address if (chkSaveAddress.Checked) { AdjusterDeploymentAddress objAdjusterDeploymentAddress2 = new AdjusterDeploymentAddress(); objAdjusterDeploymentAddress2.UserId = SessionHelper.getUserId(); objAdjusterDeploymentAddress2.DeploymentAddress = txtDeployAddress.Text; objAdjusterDeploymentAddress2.DeploymentAddress2 = txtDeployAddress2.Text; if (ddlDeployState.SelectedIndex > 0) objAdjusterDeploymentAddress2.States = Convert.ToInt32(ddlDeployState.SelectedValue); else objAdjusterDeploymentAddress2.States = null; objAdjusterDeploymentAddress2.City = txtDeployCity.Text; objAdjusterDeploymentAddress2.IsActive = true; if (!string.IsNullOrEmpty(txtDeployZipCode.Text)) { objAdjusterDeploymentAddress2.ZipCode =Convert.ToInt32(txtDeployZipCode.Text); } AdjusterDeploymentAddress objAdjusterDeploymentAddress3 = AdjusterManager.SaveDeploymentAddress(objAdjusterDeploymentAddress2); adjuster.DeploymentAddressID = objAdjusterDeploymentAddress3.Id; } } AdjusterManager.Save(adjuster); scope.Complete(); isSuccess = true; } return isSuccess; }
private Claim createClaim(int policyID, DataRow dataRow) { decimal amount = 0; AdjusterMaster adjuster = null; string adjusterName = null; string causeofLoss = null; Claim claim = null; string claimstatus = null; int clientID = SessionHelper.getClientId(); Contact contact = null; DateTime dateTime = DateTime.MinValue; LeadContactType contactType = null; string ownerManagerName = null; string ownerManagerEntityName = null; int severity = 0; string supervisorName = null; string teamLead = null; TypeOfDamageMaster damageType = null; int userID = SessionHelper.getUserId(); string userFieldName = null; claim = new Claim(); claim.PolicyID = policyID; claim.IsActive = true; // Insurer Claim ID userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Insurer Claim ID"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { claim.InsurerClaimNumber = dataRow[userFieldName].ToString().Trim(); claim.AdjusterClaimNumber = claim.InsurerClaimNumber; } // Adjuster Claim Number userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Adjuster Claim Number"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { claim.AdjusterClaimNumber = dataRow[userFieldName].ToString().Trim(); } // Claim Status userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Claim Status"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { claimstatus = dataRow[userFieldName].ToString().Trim(); if (!string.IsNullOrEmpty(claimstatus)) { StatusMaster statusMaster = StatusManager.GetByStatusName(clientID, claimstatus); if (statusMaster.StatusId == 0) { statusMaster.StatusName = claimstatus; statusMaster.clientID = clientID; statusMaster.Status = true; statusMaster = StatusManager.Save(statusMaster); } claim.StatusID = statusMaster.StatusId; } } #region Dates // Date of Loss userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date of Loss"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) claim.LossDate = dateTime; } // Date Reported userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Reported"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) claim.DateOpenedReported = dateTime; } // Date First Closed userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date First Closed"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) claim.DateFirstClosed = dateTime; } // Date First Reopen userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date First Reopen"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) claim.DateFirstReOpened = dateTime; } // Date Assigned userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Assigned"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) claim.DateAssigned = dateTime; } // Date Acknowledged userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Acknowledged"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) claim.DateAcknowledged = dateTime; } // Date First Contact Attempted userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date First Contact Attempted"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) claim.DateFirstContactAttempt = dateTime; } //Date Contacted userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Contacted"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) claim.DateContacted = dateTime; } //Date Inspection Scheduled userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Inspection Scheduled"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) claim.DateInspectionScheduled = dateTime; } // Date Inspection Completed userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Inspection Completed"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) claim.DateInspectionCompleted = dateTime; } // Date Estimate Uploaded userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Estimate Uploaded"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) claim.DateEstimateUploaded = dateTime; } // Date of Initial Reserve Change userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date of Initial Reserve Change"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) claim.DateInitialReserveChange = dateTime; } // Date Indemnity Payment Requested userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Indemnity Payment Requested"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) claim.DateIndemnityPaymentRequested = dateTime; } // Date Indemnity Payment Approved userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Indemnity Payment Approved"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) claim.DateIndemnityPaymentApproved = dateTime; } // Date Indemnity Payment Issued userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Indemnity Payment Issued"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) claim.DateIndemnityPaymentIssued = dateTime; } // Date Completed userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Completed"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) claim.DateCompleted = dateTime; } // Date Closed userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Closed"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) claim.DateClosed = dateTime; } // Date Closed userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Closed"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) claim.DateClosed = dateTime; } #endregion userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Cycle Time"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (decimal.TryParse(dataRow[userFieldName].ToString(), out amount)) claim.CycleTime = amount; } userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "ReOpenCycle Time"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (decimal.TryParse(dataRow[userFieldName].ToString(), out amount)) claim.ReopenCycleTime = amount; } #region adjuster userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Adjuster Name"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { adjusterName = dataRow[userFieldName].ToString().Trim(); adjuster = AdjusterManager.GetByAdjusterName(clientID, adjusterName); if (adjuster.AdjusterId == 0) { // add adjuster adjuster = new AdjusterMaster(); adjuster.Status = true; adjuster.AdjusterName = adjusterName.Trim(); adjuster.ClientId = clientID; adjuster.InsertBy = userID; adjuster.InsertDate = DateTime.Now; adjuster.isEmailNotification = true; adjuster = AdjusterManager.Save(adjuster); } claim.AdjusterID = adjuster.AdjusterId; } #endregion #region supervisor userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Supervisor Name"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { supervisorName = dataRow[userFieldName].ToString().Trim(); if (!string.IsNullOrEmpty(supervisorName)) { contactType = LeadContactTypeManager.Get(clientID, "Supervisor"); if (contactType == null) contactType = addNewContactType(clientID, "Supervisor"); contact = ContactManager.Get(clientID, supervisorName); if (contact == null) { contact = addNewContact(clientID, supervisorName, contactType.ID); } claim.SupervisorID = contact.ContactID; } } #endregion #region Team Lead userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Team Lead Name"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { teamLead = dataRow[userFieldName].ToString().Trim(); if (!string.IsNullOrEmpty(teamLead)) { contactType = LeadContactTypeManager.Get(clientID, "Team Lead"); if (contactType == null) contactType = addNewContactType(clientID, "Team Lead"); contact = ContactManager.Get(clientID, teamLead); if (contact == null) { contact = addNewContact(clientID, teamLead, contactType.ID); } claim.TeamLeadID = contact.ContactID; } } #endregion #region Owner Manager Name userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Owner Manager Name"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { ownerManagerName = dataRow[userFieldName].ToString().Trim(); if (!string.IsNullOrEmpty(ownerManagerName)) { contactType = LeadContactTypeManager.Get(clientID, "Owner Manager"); if (contactType == null) contactType = addNewContactType(clientID, "Owner Manager"); contact = ContactManager.Get(clientID, ownerManagerName); if (contact == null) { contact = addNewContact(clientID, ownerManagerName, contactType.ID); } claim.ManagerID = contact.ContactID; } } #endregion #region Owner Manager Entity Name userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Owner Manager Entity Name"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { ownerManagerEntityName = dataRow[userFieldName].ToString().Trim(); if (!string.IsNullOrEmpty(ownerManagerEntityName)) { contactType = LeadContactTypeManager.Get(clientID, "Owner Manager Entity Name"); if (contactType == null) contactType = addNewContactType(clientID, "Owner Manager Entity Name"); contact = ContactManager.Get(clientID, ownerManagerEntityName); if (contact == null) { contact = addNewContact(clientID, ownerManagerEntityName, contactType.ID); } claim.ManagerEntityID = contact.ContactID; } } #endregion // severity userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Severity"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (int.TryParse(dataRow[userFieldName].ToString().Trim(), out severity)) claim.SeverityNumber = severity; } // event userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Event Type"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) claim.EventType = dataRow[userFieldName].ToString().Trim(); // event name userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Event Name"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) claim.EventName = dataRow[userFieldName].ToString().Trim(); // Cause of Loss Description userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Cause of Loss Description"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { causeofLoss = dataRow[userFieldName].ToString().Trim(); damageType = TypeofDamageManager.GetTypeOfDamage(clientID, causeofLoss); if (damageType.TypeOfDamageId == 0) { damageType.ClientId = clientID; damageType.Status = true; damageType.TypeOfDamage = causeofLoss; damageType = TypeofDamageManager.Save(damageType); } claim.CauseOfLoss = damageType.TypeOfDamageId.ToString(); } #region Amounts // Claim Workflow Type userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Claim Workflow Type"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) claim.ClaimWorkflowType = dataRow[userFieldName].ToString().Trim(); // Outstanding Indemnity Reserve userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Outstanding Indemnity Reserve"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount); claim.OutstandingIndemnityReserve = amount; } // Outstanding LAE Reserves userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Outstanding LAE Reserves"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount); claim.OutstandingLAEReserves = amount; } // Total Indemnity Paid userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Total Indemnity Paid"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount); claim.TotalIndemnityPaid = amount; } // Coverage A Paid userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Coverage A Paid"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount); claim.CoverageAPaid = amount; } // Coverage B Paid userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Coverage B Paid"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount); claim.CoverageBPaid = amount; } // Coverage C Paid userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Coverage C Paid"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount); claim.CoverageCPaid = amount; } // Coverage D Paid userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Coverage D Paid"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount); claim.CoverageDPaid = amount; } // Total Expenses Paid userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Total Expenses Paid"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount); claim.TotalExpensesPaid = amount; } #endregion claim = ClaimsManager.Save(claim); return claim; }
protected void UploadTemplate2_bak() { // original format designed by Vivek 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.LeadStatus = 1; // active objLead.OriginalLeadDate = DateTime.Now; objLead.TypeOfProperty = 18; //residential objLead.UserId = Convert.ToInt32(Session["UserId"]); if (table.Rows[i]["Create Date"] != string.Empty) { DateTime.TryParse(table.Rows[i]["Create Date"].ToString(), out DateSubmitted); objLead.DateSubmitted = DateSubmitted; objLead.OriginalLeadDate = DateSubmitted; } if (table.Rows[i]["Last Name"] != string.Empty) { str = table.Rows[i]["Last Name"].ToString(); if (str.Length > 50) { objLead.ClaimantLastName = str.Substring(0, 50); objLead.OwnerLastName = objLead.ClaimantLastName; } else { objLead.ClaimantLastName = str; objLead.OwnerLastName = str; } } if (table.Rows[i]["First Name"] != string.Empty) { str = table.Rows[i]["First Name"].ToString(); if (str.Length > 50) { objLead.ClaimantFirstName = str.Substring(0, 50); objLead.OwnerFirstName = objLead.ClaimantFirstName; } else { objLead.ClaimantFirstName = str; objLead.OwnerFirstName = str; } } if (table.Rows[i]["Middle Name"] != string.Empty) { str = table.Rows[i]["Middle Name"].ToString(); if (str.Length > 50) { objLead.ClaimantMiddleName = str.Substring(0, 50); } else { objLead.ClaimantMiddleName = str; } } if (table.Rows[i]["E-mail"] != string.Empty) { str = table.Rows[i]["E-mail"].ToString(); if (str.Length > 100) objLead.EmailAddress = str.Substring(0, 100); else objLead.EmailAddress = str; } if (table.Rows[i]["Personal E-mail"] != string.Empty) { str = table.Rows[i]["Personal E-mail"].ToString(); if (str.Length > 100) objLead.SecondaryEmail = str.Substring(0, 100); else objLead.SecondaryEmail = str; } if (table.Rows[i]["Mobile Phone"] != string.Empty) { str = table.Rows[i]["Mobile Phone"].ToString(); if (str.Length > 20) objLead.SecondaryPhone = str.Substring(0, 20); else objLead.SecondaryPhone = str; } if (table.Rows[i]["Salutation"] != string.Empty) { str = table.Rows[i]["Salutation"].ToString(); if (str.Length > 50) objLead.Salutation = str.Substring(0, 20); else objLead.Salutation = str; } string adjusterName = null; int? adjusterID = null; AdjusterMaster adjuster = null; if (table.Rows[i]["Adjuster Name"] != string.Empty) adjusterName = table.Rows[i]["Adjuster Name"].ToString(); string adjusterEmail = null; string adjusterFax = null; string AdjusterPhone = null; string AdjusterCo = null; string AdjusterAddress = null; if (table.Rows[i]["Adjuster Email"] != string.Empty) adjusterEmail = table.Rows[i]["Adjuster Email"].ToString(); if (table.Rows[i]["Adjuster Fax"] != string.Empty) adjusterFax = table.Rows[i]["Adjuster Fax"].ToString(); if (table.Rows[i]["Adjuster Phone"] != string.Empty) AdjusterPhone = table.Rows[i]["Adjuster Phone"].ToString(); if (table.Rows[i]["Adjuster Co"] != string.Empty) AdjusterCo = table.Rows[i]["Adjuster Co"].ToString(); if (table.Rows[i]["Adj Address"] != string.Empty) AdjusterAddress = table.Rows[i]["Adj Address"].ToString(); 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.email = adjusterEmail; adjuster.Address1 = AdjusterAddress; adjuster.PhoneNumber = AdjusterPhone; adjuster.FaxNumber = adjusterFax; adjuster.CompanyName = AdjusterCo; adjuster = AdjusterManager.Save(adjuster); } adjusterID = adjuster.AdjusterId; } if (table.Rows[i]["Date of Loss"] != string.Empty) { DateTime lossDate = DateTime.MinValue; if (DateTime.TryParse(table.Rows[i]["Date of Loss"].ToString(), out lossDate)) objLead.LossDate = lossDate; } if (table.Rows[i]["Loss Location"] != string.Empty) objLead.LossLocation = table.Rows[i]["Loss Location"].ToString(); if (table.Rows[i]["Address 1"] != string.Empty) objLead.LossAddress = table.Rows[i]["Address 1"].ToString(); if (table.Rows[i]["Address 2"] != string.Empty) objLead.LossAddress2 = table.Rows[i]["Address 2"].ToString(); 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 Code"] != string.Empty) objLead.Zip = table.Rows[i]["ZIP Code"].ToString(); if (table.Rows[i]["Company"] != string.Empty) objLead.BusinessName = table.Rows[i]["Company"].ToString(); if (table.Rows[i]["Adjuster Name"] != string.Empty) adjusterName = table.Rows[i]["Adjuster Name"].ToString(); if (table.Rows[i]["Phone"] != string.Empty) { str = table.Rows[i]["Phone"].ToString(); if (str.Length > 20) objLead.PhoneNumber = str.Substring(0, 20); else objLead.PhoneNumber = str.ToString(); } StatusMaster statusMaster = null; string statusName = null; if (table.Rows[i]["File Status"] != string.Empty) { statusName = table.Rows[i]["File Status"].ToString(); 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.Status = true; statusMaster.StatusName = statusName; statusMaster = StatusManager.Save(statusMaster); } } if (!string.IsNullOrEmpty(table.Rows[i]["Peril"].ToString())) { var id = TypeofDamageManager.getbyTypeOfDamage(table.Rows[i]["Peril"].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]["Peril"].ToString(); if (str.Length > 250) objLead.TypeofDamageText = str.Substring(0, 250).Replace("/", ","); else objLead.TypeofDamageText = str.Replace("/", ","); } objLead.Status = 1; // 2013-08-29 tortega if (clientID > 0) objLead.ClientID = clientID; Leads newLead = LeadsManager.Save(objLead); if (newLead != null) { if (table.Rows[i]["Certified Mail Number"] != string.Empty) AddComments(newLead.LeadId, "Certified Mail Number: " + table.Rows[i]["Certified Mail Number"].ToString()); //if (table.Rows[i]["Contract Signed Date"] != string.Empty) // AddComments(newLead.LeadId, "Contract Signed Date: " + table.Rows[i]["Contract Signed Date"].ToString()); if (table.Rows[i]["Last E-mail"] != string.Empty) AddComments(newLead.LeadId, "Last E-mail Date: " + table.Rows[i]["Last E-mail"].ToString()); if (table.Rows[i]["Last Meeting"] != string.Empty) AddComments(newLead.LeadId, "Last Meeting Date: " + table.Rows[i]["Last Meeting"].ToString()); if (table.Rows[i]["Letter Date"] != string.Empty) AddComments(newLead.LeadId, "Letter Date: " + table.Rows[i]["Letter Date"].ToString()); // 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 (adjusterID != null) policy.AdjusterID = adjusterID; if (table.Rows[i]["Claim Number"] != string.Empty) policy.ClaimNumber = table.Rows[i]["Claim Number"].ToString(); if (table.Rows[i]["Policy Number"] != string.Empty) policy.PolicyNumber = table.Rows[i]["Policy Number"].ToString(); if (table.Rows[i]["Policy Period"] != string.Empty) policy.PolicyPeriod = table.Rows[i]["Policy Period"].ToString(); if (table.Rows[i]["File Number"] != string.Empty) policy.InsurerFileNo = table.Rows[i]["File Number"].ToString(); if (statusMaster != null) policy.LeadStatus = statusMaster.StatusId; if (table.Rows[i]["Ins Carrier"] != string.Empty) policy.InsuranceCompanyName = table.Rows[i]["Ins Carrier"].ToString(); if (table.Rows[i]["Ins Co Address"] != string.Empty) policy.InsuranceAddress = table.Rows[i]["Ins Co Address"].ToString(); if (table.Rows[i]["Ins Co City"] != string.Empty) { string cityName = table.Rows[i]["Ins Co City"].ToString(); CityMaster cityMaster = City.GetByCityName(cityName); if (cityMaster != null && cityMaster.CityId > 0) policy.InsuranceCity = cityMaster.CityId; } if (table.Rows[i]["Ins Co State"] != string.Empty) { string stateName = table.Rows[i]["Ins Co State"].ToString(); StateMaster stateMaster = State.Getstateid(stateName); if (stateMaster != null && stateMaster.StateId > 0) policy.InsuranceState = stateMaster.StateId; } if (table.Rows[i]["Ins Co Zip"] != string.Empty) { string zipCode = table.Rows[i]["Ins Co Zip"].ToString(); ZipCodeMaster zipMaster = ZipCode.GetByZipCode(zipCode); if (zipMaster != null && zipMaster.ZipCodeID > 0) policy.InsuranceZipCode = zipMaster.ZipCodeID.ToString(); } LeadPolicyManager.Save(policy); } } //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); } }
//EMAIL TO: Specified User private void notifySpecifiedUser(AdjusterMaster adjuster, ClaimService service, Claim myClaim) { StringBuilder emailBody = new StringBuilder(); string password = null; string[] recipients = null; string smtpHost = null; int smtpPort = 0; string siteUrl = ConfigurationManager.AppSettings["siteUrl"].ToString(); string insuredName = Session["InsuredName"].ToString(); string subject = "Claim # " + myClaim.InsurerClaimNumber + ", Please Read Claim Note, Claim Ruler Note for : " + insuredName; CRM.Data.Entities.SecUser user = null; string itsgHost = ConfigurationManager.AppSettings["smtpHost"].ToString(); string itsgHostPort = ConfigurationManager.AppSettings["smtpPort"].ToString(); string itsgEmail = ConfigurationManager.AppSettings["smtpEmail"].ToString(); string itsgEmailPassword = ConfigurationManager.AppSettings["smtpPassword"].ToString(); string EmailService = ddlInvoiceServiceType.SelectedItem.Text; string EmailActivity = ddlActivity.SelectedItem.Text; string EmailDescription = txtServiceDescription.Text; string EmailInternal = txtMyComments.Text; string EmailQuantity = txtServiceQty.Text; string EmailDate = txtServiceDate.Text; string userName = SessionHelper.getUserName(); int.TryParse(itsgHostPort, out smtpPort); // get logged in user int userID = SessionHelper.getUserId(); //Convert.ToInt32(itsgHostPort); // get current user email info user = SecUserManager.GetByUserId(userID); // load email credentials smtpHost = user.emailHost; int.TryParse(user.emailHostPort, out smtpPort); // recipients recipients = new string[] { txtEmailTo.Text }; // build email body // .containerBox emailBody.Append("<div style=\"margin:auto;width:600px;border: 1px solid #DDDDE4; margin: auto;font-family: Tahoma, Arial,sans-serif;font-size: 12px;color: #808080;\">"); // .header //emailBody.Append("<div style=\"background-image:url(https://appv3.claimruler.com/images/email_header_small.jpg);background-repeat: no-repeat;background-size: 100% 100%;height:70px;\"></div>"); //emailBody.Append("<div><img src=\"http://app.claimruler.com/images/email_header_small.jpg\"></image></div>"); // .paneContentInner emailBody.Append("<div style=\"margin: 20px;\">"); emailBody.Append("Hi " + adjuster.adjusterName + ",<br><br>"); emailBody.Append("The following activity was just logged on Claim # " + myClaim.InsurerClaimNumber + " for Insured: " + insuredName + "<br><br><br>"); emailBody.Append("<table >"); emailBody.Append("<tr> "); emailBody.Append("<td align=\"left\"><b>Service:</b></td><td align=\"left\"> " + EmailService + "</td>"); emailBody.Append("</tr>"); // emailBody.Append("</table><br><br>"); emailBody.Append("<tr>"); emailBody.Append("<td align=\"left\"><b>Activity:</b></td><td align=\"left\"> " + EmailActivity + "</td>"); emailBody.Append("</tr>"); emailBody.Append("<tr> "); emailBody.Append("<td align=\"left\"><b>Description:</b></td><td align=\"left\"> " + EmailDescription + "</td>"); emailBody.Append("</tr>"); emailBody.Append("<tr> "); emailBody.Append("<td align=\"left\"><b>Internal Comments:</b></td><td align=\"left\"> " + EmailInternal + "</td>"); emailBody.Append("</tr>"); emailBody.Append("<tr></tr>"); emailBody.Append("<tr> "); emailBody.Append("<td align=\"left\"><b>Adjuster:</b></td><td align=\"left\"> " + adjuster.adjusterName + "</td>"); emailBody.Append("</tr>"); emailBody.Append("<tr> "); emailBody.Append("<td align=\"left\"><b>User Name:</b></td><td align=\"left\"> " + userName + "</td>"); emailBody.Append("</tr>"); emailBody.Append("<tr> "); emailBody.Append("<td align=\"left\"><b>Service Date:</b></td><td align=\"left\"> " + EmailDate + "</td>"); emailBody.Append("</tr>"); emailBody.Append("<tr> "); emailBody.Append("<td align=\"left\"><b>Timer Quantity:</b></td><td align=\"left\"> " + EmailQuantity + "</td>"); emailBody.Append("</tr>"); emailBody.Append("</table ><br><br>"); emailBody.Append("</div>"); // inner containerBox emailBody.Append("</div>"); // paneContentInner emailBody.Append("</div>"); // containerBox //Core.EmailHelper.sendEmail(user.Email, recipients, null, "Claim Assignment Notification", emailBody.ToString(), null, user.emailHost, smtpPort, smtpEmail, smtpPassword, true); password = Core.SecurityManager.Decrypt(user.emailPassword); //Core.EmailHelper.sendEmail(user.Email, recipients, null, subject, emailBody.ToString(), null, user.emailHost, smtpPort, user.Email, password, user.isSSL ?? true); Core.EmailHelper.sendEmail(itsgEmail, recipients, null, subject, emailBody.ToString(), null, itsgHost, Convert.ToInt32(itsgHostPort), itsgEmail, itsgEmailPassword); }
private void newAccountNotification(AdjusterMaster adjuster, CRM.Data.Entities.SecUser user) { StringBuilder emailText = new StringBuilder(); string[] recipients = new string[] { adjuster.email }; // get system email account string userEmail = ConfigurationManager.AppSettings["smtpEmail"].ToString(); string emailPassword = ConfigurationManager.AppSettings["smtpPassword"].ToString(); string appURL = ConfigurationManager.AppSettings["appURL"].ToString(); // name of CRM client //string clientName = adjuster.Client == null ? "" : adjuster.Client.BusinessName; string subject = /*clientName +*/ "IMPORTANT Account Information - New User Created (Claim Ruler Software)"; emailText.Append(string.Format("<br>Congratulations, {0}!<br>", adjuster.AdjusterName)); emailText.Append(/*string.Format*/"<br>You have been granted access to Claim Ruler in order for you to work on those claims that are assigned to you."/*, clientName)*/); emailText.Append("<br><br>Below is your account information:"); emailText.Append(string.Format("<br>User Name: <b>{0}</b>", user.UserName)); emailText.Append(string.Format("<br>Password: <b>{0}</b>", Core.SecurityManager.Decrypt(user.Password))); emailText.Append(string.Format("<br><br>Click {0} to login.", appURL)); Core.EmailHelper.sendEmail(/*adjuster.email*/userEmail, recipients, null, subject, emailText.ToString(), null, userEmail, emailPassword); }
public override object Save <T>(T entity) { BO.AdjusterMaster adjusterMasterBO = (BO.AdjusterMaster)(object) entity; BO.AddressInfo addressBO = adjusterMasterBO.AddressInfo; BO.ContactInfo contactinfoBO = adjusterMasterBO.ContactInfo; AdjusterMaster adjusterMasterDB = new AdjusterMaster(); using (var dbContextTransaction = _context.Database.BeginTransaction()) { bool IsEditMode = false; IsEditMode = (adjusterMasterBO != null && adjusterMasterBO.ID > 0) ? true : false; AddressInfo addressDB = new AddressInfo(); ContactInfo contactinfoDB = new ContactInfo(); #region Address if (addressBO != null) { bool Add_addressDB = false; addressDB = _context.AddressInfoes.Where(p => p.id == addressBO.ID).FirstOrDefault(); if (addressDB == null && addressBO.ID <= 0) { addressDB = new AddressInfo(); Add_addressDB = true; } else if (addressDB == null && addressBO.ID > 0) { dbContextTransaction.Rollback(); return(new BO.ErrorObject { errorObject = "", ErrorMessage = "Address details dosent exists.", ErrorLevel = ErrorLevel.Error }); } addressDB.Name = IsEditMode == true && addressBO.Name == null ? addressDB.Name : addressBO.Name; addressDB.Address1 = IsEditMode == true && addressBO.Address1 == null ? addressDB.Address1 : addressBO.Address1; addressDB.Address2 = IsEditMode == true && addressBO.Address2 == null ? addressDB.Address2 : addressBO.Address2; addressDB.City = IsEditMode == true && addressBO.City == null ? addressDB.City : addressBO.City; addressDB.State = IsEditMode == true && addressBO.State == null ? addressDB.State : addressBO.State; addressDB.ZipCode = IsEditMode == true && addressBO.ZipCode == null ? addressDB.ZipCode : addressBO.ZipCode; addressDB.Country = IsEditMode == true && addressBO.Country == null ? addressDB.Country : addressBO.Country; //[STATECODE-CHANGE] // addressDB.StateCode = IsEditMode == true && addressBO.StateCode == null ? addressDB.StateCode : addressBO.StateCode; //[STATECODE-CHANGE] if (Add_addressDB == true) { addressDB = _context.AddressInfoes.Add(addressDB); } _context.SaveChanges(); } else { if (IsEditMode == false) { dbContextTransaction.Rollback(); return(new BO.ErrorObject { errorObject = "", ErrorMessage = "Please pass valid address details.", ErrorLevel = ErrorLevel.Error }); } addressDB = null; } #endregion #region Contact Info if (contactinfoBO != null) { bool Add_contactinfoDB = false; contactinfoDB = _context.ContactInfoes.Where(p => p.id == contactinfoBO.ID).FirstOrDefault(); if (contactinfoDB == null && contactinfoBO.ID <= 0) { contactinfoDB = new ContactInfo(); Add_contactinfoDB = true; } else if (contactinfoDB == null && contactinfoBO.ID > 0) { dbContextTransaction.Rollback(); return(new BO.ErrorObject { errorObject = "", ErrorMessage = "Contact details dosent exists.", ErrorLevel = ErrorLevel.Error }); } contactinfoDB.Name = IsEditMode == true && contactinfoBO.Name == null ? contactinfoDB.Name : contactinfoBO.Name; contactinfoDB.CellPhone = IsEditMode == true && contactinfoBO.CellPhone == null ? contactinfoDB.CellPhone : contactinfoBO.CellPhone; contactinfoDB.EmailAddress = IsEditMode == true && contactinfoBO.EmailAddress == null ? contactinfoDB.EmailAddress : contactinfoBO.EmailAddress; contactinfoDB.HomePhone = IsEditMode == true && contactinfoBO.HomePhone == null ? contactinfoDB.HomePhone : contactinfoBO.HomePhone; contactinfoDB.WorkPhone = IsEditMode == true && contactinfoBO.WorkPhone == null ? contactinfoDB.WorkPhone : contactinfoBO.WorkPhone; contactinfoDB.FaxNo = IsEditMode == true && contactinfoBO.FaxNo == null ? contactinfoDB.FaxNo : contactinfoBO.FaxNo; contactinfoDB.IsDeleted = contactinfoBO.IsDeleted; contactinfoDB.OfficeExtension = IsEditMode == true && contactinfoBO.OfficeExtension == null ? contactinfoDB.OfficeExtension : contactinfoBO.OfficeExtension; contactinfoDB.AlternateEmail = IsEditMode == true && contactinfoBO.AlternateEmail == null ? contactinfoDB.AlternateEmail : contactinfoBO.AlternateEmail; contactinfoDB.PreferredCommunication = IsEditMode == true && contactinfoBO.PreferredCommunication == null ? contactinfoDB.PreferredCommunication : contactinfoBO.PreferredCommunication; if (Add_contactinfoDB == true) { contactinfoDB = _context.ContactInfoes.Add(contactinfoDB); } _context.SaveChanges(); } else { if (IsEditMode == false) { dbContextTransaction.Rollback(); return(new BO.ErrorObject { errorObject = "", ErrorMessage = "Please pass valid contact details.", ErrorLevel = ErrorLevel.Error }); } contactinfoDB = null; } #endregion #region AdjusterMaster if (adjusterMasterBO != null) { bool Add_adjusterMasterDB = false; adjusterMasterDB = _context.AdjusterMasters.Where(p => p.Id == adjusterMasterBO.ID).FirstOrDefault(); if (adjusterMasterDB == null && adjusterMasterBO.ID <= 0) { adjusterMasterDB = new AdjusterMaster(); Add_adjusterMasterDB = true; } else if (adjusterMasterDB == null && adjusterMasterBO.ID > 0) { dbContextTransaction.Rollback(); return(new BO.ErrorObject { errorObject = "", ErrorMessage = "Adjuster information dosent exists.", ErrorLevel = ErrorLevel.Error }); } adjusterMasterDB.CompanyId = adjusterMasterBO.CompanyId; adjusterMasterDB.InsuranceMasterId = adjusterMasterBO.InsuranceMasterId; adjusterMasterDB.FirstName = IsEditMode == true && adjusterMasterBO.FirstName == null ? adjusterMasterDB.FirstName : adjusterMasterBO.FirstName; adjusterMasterDB.MiddleName = IsEditMode == true && adjusterMasterBO.MiddleName == null ? adjusterMasterDB.MiddleName : adjusterMasterBO.MiddleName; adjusterMasterDB.LastName = IsEditMode == true && adjusterMasterBO.LastName == null ? adjusterMasterDB.LastName : adjusterMasterBO.LastName; adjusterMasterDB.AddressInfoId = (addressDB != null && addressDB.id > 0) ? addressDB.id : adjusterMasterDB.AddressInfoId; adjusterMasterDB.ContactInfoId = (contactinfoDB != null && contactinfoDB.id > 0) ? contactinfoDB.id : adjusterMasterDB.ContactInfoId; if (Add_adjusterMasterDB == true) { adjusterMasterDB = _context.AdjusterMasters.Add(adjusterMasterDB); } _context.SaveChanges(); } else { if (IsEditMode == false) { dbContextTransaction.Rollback(); return(new BO.ErrorObject { errorObject = "", ErrorMessage = "Please pass valid adjuster information details.", ErrorLevel = ErrorLevel.Error }); } adjusterMasterDB = null; } _context.SaveChanges(); #endregion dbContextTransaction.Commit(); adjusterMasterDB = _context.AdjusterMasters.Include("AddressInfo") .Include("ContactInfo").Include("InsuranceMaster").Where(p => p.Id == adjusterMasterDB.Id).FirstOrDefault <AdjusterMaster>(); } var res = Convert <BO.AdjusterMaster, AdjusterMaster>(adjusterMasterDB); return((object)res); }
private Claim createClaim(int policyID, DataRow dataRow) { decimal amount = 0; AdjusterMaster adjuster = null; string adjusterName = null; string causeofLoss = null; Claim claim = null; string claimstatus = null; int clientID = SessionHelper.getClientId(); Contact contact = null; DateTime dateTime = DateTime.MinValue; LeadContactType contactType = null; string ownerManagerName = null; string ownerManagerEntityName = null; int severity = 0; string supervisorName = null; string teamLead = null; TypeOfDamageMaster damageType = null; int userID = SessionHelper.getUserId(); string userFieldName = null; claim = new Claim(); claim.PolicyID = policyID; claim.IsActive = true; // Insurer Claim ID userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Insurer Claim ID"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { claim.InsurerClaimNumber = dataRow[userFieldName].ToString().Trim(); claim.AdjusterClaimNumber = claim.InsurerClaimNumber; } // Adjuster Claim Number userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Adjuster Claim Number"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { claim.AdjusterClaimNumber = dataRow[userFieldName].ToString().Trim(); } // Claim Status userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Claim Status"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { claimstatus = dataRow[userFieldName].ToString().Trim(); if (!string.IsNullOrEmpty(claimstatus)) { StatusMaster statusMaster = StatusManager.GetByStatusName(clientID, claimstatus); if (statusMaster.StatusId == 0) { statusMaster.StatusName = claimstatus; statusMaster.clientID = clientID; statusMaster.Status = true; statusMaster = StatusManager.Save(statusMaster); } claim.StatusID = statusMaster.StatusId; } } #region Dates // Date of Loss userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date of Loss"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) { claim.LossDate = dateTime; } } // Date Reported userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Reported"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) { claim.DateOpenedReported = dateTime; } } // Date First Closed userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date First Closed"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) { claim.DateFirstClosed = dateTime; } } // Date First Reopen userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date First Reopen"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) { claim.DateFirstReOpened = dateTime; } } // Date Assigned userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Assigned"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) { claim.DateAssigned = dateTime; } } // Date Acknowledged userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Acknowledged"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) { claim.DateAcknowledged = dateTime; } } // Date First Contact Attempted userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date First Contact Attempted"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) { claim.DateFirstContactAttempt = dateTime; } } //Date Contacted userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Contacted"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) { claim.DateContacted = dateTime; } } //Date Inspection Scheduled userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Inspection Scheduled"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) { claim.DateInspectionScheduled = dateTime; } } // Date Inspection Completed userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Inspection Completed"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) { claim.DateInspectionCompleted = dateTime; } } // Date Estimate Uploaded userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Estimate Uploaded"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) { claim.DateEstimateUploaded = dateTime; } } // Date of Initial Reserve Change userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date of Initial Reserve Change"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) { claim.DateInitialReserveChange = dateTime; } } // Date Indemnity Payment Requested userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Indemnity Payment Requested"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) { claim.DateIndemnityPaymentRequested = dateTime; } } // Date Indemnity Payment Approved userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Indemnity Payment Approved"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) { claim.DateIndemnityPaymentApproved = dateTime; } } // Date Indemnity Payment Issued userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Indemnity Payment Issued"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) { claim.DateIndemnityPaymentIssued = dateTime; } } // Date Completed userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Completed"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) { claim.DateCompleted = dateTime; } } // Date Closed userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Closed"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) { claim.DateClosed = dateTime; } } // Date Closed userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Closed"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime)) { claim.DateClosed = dateTime; } } #endregion userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Cycle Time"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (decimal.TryParse(dataRow[userFieldName].ToString(), out amount)) { claim.CycleTime = amount; } } userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "ReOpenCycle Time"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (decimal.TryParse(dataRow[userFieldName].ToString(), out amount)) { claim.ReopenCycleTime = amount; } } #region adjuster userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Adjuster Name"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { adjusterName = dataRow[userFieldName].ToString().Trim(); adjuster = AdjusterManager.GetByAdjusterName(clientID, adjusterName); if (adjuster.AdjusterId == 0) { // add adjuster adjuster = new AdjusterMaster(); adjuster.Status = true; adjuster.AdjusterName = adjusterName.Trim(); adjuster.ClientId = clientID; adjuster.InsertBy = userID; adjuster.InsertDate = DateTime.Now; adjuster.isEmailNotification = true; adjuster = AdjusterManager.Save(adjuster); } claim.AdjusterID = adjuster.AdjusterId; } #endregion #region supervisor userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Supervisor Name"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { supervisorName = dataRow[userFieldName].ToString().Trim(); if (!string.IsNullOrEmpty(supervisorName)) { contactType = LeadContactTypeManager.Get(clientID, "Supervisor"); if (contactType == null) { contactType = addNewContactType(clientID, "Supervisor"); } contact = ContactManager.Get(clientID, supervisorName); if (contact == null) { contact = addNewContact(clientID, supervisorName, contactType.ID); } claim.SupervisorID = contact.ContactID; } } #endregion #region Team Lead userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Team Lead Name"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { teamLead = dataRow[userFieldName].ToString().Trim(); if (!string.IsNullOrEmpty(teamLead)) { contactType = LeadContactTypeManager.Get(clientID, "Team Lead"); if (contactType == null) { contactType = addNewContactType(clientID, "Team Lead"); } contact = ContactManager.Get(clientID, teamLead); if (contact == null) { contact = addNewContact(clientID, teamLead, contactType.ID); } claim.TeamLeadID = contact.ContactID; } } #endregion #region Owner Manager Name userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Owner Manager Name"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { ownerManagerName = dataRow[userFieldName].ToString().Trim(); if (!string.IsNullOrEmpty(ownerManagerName)) { contactType = LeadContactTypeManager.Get(clientID, "Owner Manager"); if (contactType == null) { contactType = addNewContactType(clientID, "Owner Manager"); } contact = ContactManager.Get(clientID, ownerManagerName); if (contact == null) { contact = addNewContact(clientID, ownerManagerName, contactType.ID); } claim.ManagerID = contact.ContactID; } } #endregion #region Owner Manager Entity Name userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Owner Manager Entity Name"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { ownerManagerEntityName = dataRow[userFieldName].ToString().Trim(); if (!string.IsNullOrEmpty(ownerManagerEntityName)) { contactType = LeadContactTypeManager.Get(clientID, "Owner Manager Entity Name"); if (contactType == null) { contactType = addNewContactType(clientID, "Owner Manager Entity Name"); } contact = ContactManager.Get(clientID, ownerManagerEntityName); if (contact == null) { contact = addNewContact(clientID, ownerManagerEntityName, contactType.ID); } claim.ManagerEntityID = contact.ContactID; } } #endregion // severity userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Severity"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { if (int.TryParse(dataRow[userFieldName].ToString().Trim(), out severity)) { claim.SeverityNumber = severity; } } // event userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Event Type"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { claim.EventType = dataRow[userFieldName].ToString().Trim(); } // event name userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Event Name"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { claim.EventName = dataRow[userFieldName].ToString().Trim(); } // Cause of Loss Description userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Cause of Loss Description"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { causeofLoss = dataRow[userFieldName].ToString().Trim(); damageType = TypeofDamageManager.GetTypeOfDamage(clientID, causeofLoss); if (damageType.TypeOfDamageId == 0) { damageType.ClientId = clientID; damageType.Status = true; damageType.TypeOfDamage = causeofLoss; damageType = TypeofDamageManager.Save(damageType); } claim.CauseOfLoss = damageType.TypeOfDamageId.ToString(); } #region Amounts // Claim Workflow Type userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Claim Workflow Type"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { claim.ClaimWorkflowType = dataRow[userFieldName].ToString().Trim(); } // Outstanding Indemnity Reserve userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Outstanding Indemnity Reserve"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount); claim.OutstandingIndemnityReserve = amount; } // Outstanding LAE Reserves userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Outstanding LAE Reserves"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount); claim.OutstandingLAEReserves = amount; } // Total Indemnity Paid userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Total Indemnity Paid"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount); claim.TotalIndemnityPaid = amount; } // Coverage A Paid userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Coverage A Paid"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount); claim.CoverageAPaid = amount; } // Coverage B Paid userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Coverage B Paid"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount); claim.CoverageBPaid = amount; } // Coverage C Paid userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Coverage C Paid"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount); claim.CoverageCPaid = amount; } // Coverage D Paid userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Coverage D Paid"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount); claim.CoverageDPaid = amount; } // Total Expenses Paid userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Total Expenses Paid"); if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null) { decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount); claim.TotalExpensesPaid = amount; } #endregion claim = ClaimsManager.Save(claim); return(claim); }
protected void btnUpload_Click(object sender, EventArgs e) { string fileExtension = null; AdjusterMaster adjuster = null; string firstName = null; string lastName = null; AdjusterServiceArea serviceArea = null; AdjusterLicenseAppointmentType licenseAppointmentType = null; string licenseNumber = null; string licenseType = null; string licenseEffectiveDate = null; string licenseExpireDate = null; string appointmentType = null; StateMaster stateMaster = null; string str = null; lblMessage.Text = string.Empty; if (!fileUpload.HasFile) { lblMessage.Text = "No file selected."; lblMessage.CssClass = "error"; return; } // validate file fileExtension = System.IO.Path.GetExtension(fileUpload.PostedFile.FileName); if (!fileExtension.Equals(".csv", StringComparison.OrdinalIgnoreCase)) { lblMessage.Text = "CSV file format allowed only."; lblMessage.CssClass = "error"; return; } try { //save file in temp folder string destinationPath = Server.MapPath(string.Format("~//Temp//{0}.csv", Guid.NewGuid())); fileUpload.SaveAs(destinationPath); // load file for processing //DataTable table = CSVReader.ReadCSVFile(Server.MapPath("~//Temp//" + fileUpload.FileName), true); DataTable table = CSVHelper.ReadCSVFile(destinationPath); using (TransactionScope scope = new TransactionScope()) { for (int i = 0; i < table.Rows.Count; i++) { #region process each row adjuster = new AdjusterMaster(); adjuster.ClientId = clientID; adjuster.Status = true; adjuster.InsertBy = userID; adjuster.InsertDate = DateTime.Now; if (table.Rows[i]["First_Name"] != string.Empty) firstName = table.Rows[i]["First_Name"].ToString(); if (table.Rows[i]["Last_Name"] != string.Empty) lastName = table.Rows[i]["Last_Name"].ToString(); // skip blank rows if (string.IsNullOrEmpty(lastName) && string.IsNullOrEmpty(firstName)) continue; adjuster.FirstName = firstName.Length < 50 ? firstName : firstName.Substring(0, 50); adjuster.LastName = lastName.Length < 50 ? lastName : lastName.Substring(0, 50); if (table.Rows[i]["Middle_Initial"] != string.Empty) { str = table.Rows[i]["Middle_Initial"].ToString(); adjuster.MiddleInitial = str.Substring(0, 1); } adjuster.AdjusterName = string.Format("{0} {1} {2}", firstName, adjuster.MiddleInitial ?? "", lastName); if (table.Rows[i]["Suffix"] != string.Empty) adjuster.Suffix = table.Rows[i]["Suffix"].ToString().Substring(0,1); if (table.Rows[i]["Cell_Phone_Number"] != string.Empty) { str = table.Rows[i]["Cell_Phone_Number"].ToString(); if (str.Length > 20) adjuster.PhoneNumber = str.Substring(0, 20); else adjuster.PhoneNumber = str; } if (table.Rows[i]["Email"] != string.Empty) { str = table.Rows[i]["Email"].ToString(); adjuster.email = str.Length < 100 ? str : str.Substring(0, 100); } if (table.Rows[i]["Address_Line1"] != string.Empty) { str = table.Rows[i]["Address_Line1"].ToString(); adjuster.Address1 = str.Length < 100 ? str : str.Substring(0, 100); } if (table.Rows[i]["City"] != string.Empty) { str = table.Rows[i]["City"].ToString(); adjuster.Address1 = str.Length < 50 ? str : str.Substring(0, 50); } if (table.Rows[i]["State_Code"] != string.Empty) { str = table.Rows[i]["State_Code"].ToString(); stateMaster = State.Getstateid(str); if (stateMaster.StateId > 0) adjuster.StateID = stateMaster.StateId; else adjuster.StateID = null; } if (table.Rows[i]["ZIP_Code"] != string.Empty) { str = table.Rows[i]["ZIP_Code"].ToString(); adjuster.Address1 = str.Length < 10 ? str : str.Substring(0, 10); } // save adjuster adjuster = AdjusterManager.Save(adjuster); if (table.Rows[i]["License_Type"] != string.Empty) licenseType = table.Rows[i]["License_Type"].ToString(); if (table.Rows[i]["License_Number"] != string.Empty) licenseNumber = table.Rows[i]["License_Number"].ToString(); if (table.Rows[i]["License_Issue_Date"] != string.Empty) licenseEffectiveDate = table.Rows[i]["License_Issue_Date"].ToString(); if (table.Rows[i]["License_Expires_Date"] != string.Empty) licenseExpireDate = table.Rows[i]["License_Expires_Date"].ToString(); if (table.Rows[i]["Appointment_Type"] != string.Empty) { appointmentType = table.Rows[i]["Appointment_Type"].ToString(); if (!string.IsNullOrEmpty(appointmentType)) { licenseAppointmentType = AdjusterLicenseAppointmentTypeManager.Get(appointmentType, clientID); if (licenseAppointmentType == null) { licenseAppointmentType = new AdjusterLicenseAppointmentType(); licenseAppointmentType.IsActive = true; licenseAppointmentType.LicenseAppointmentType = appointmentType; licenseAppointmentType.ClientID = clientID; licenseAppointmentType = AdjusterLicenseAppointmentTypeManager.Save(licenseAppointmentType); } } } if (!string.IsNullOrEmpty(licenseType) && !string.IsNullOrEmpty(licenseNumber) && !string.IsNullOrEmpty(licenseEffectiveDate) && !string.IsNullOrEmpty(licenseExpireDate) && !string.IsNullOrEmpty(appointmentType)) { serviceArea = new AdjusterServiceArea(); serviceArea.AdjusterID = adjuster.AdjusterId; serviceArea.StateID = adjuster.StateID; serviceArea.LicenseNumber = licenseNumber.Length < 50 ? licenseNumber : licenseNumber.Substring(0, 50); serviceArea.LicenseType = licenseType.Length < 20 ? licenseType : licenseType.Substring(0, 20); DateTime effectiveDate = DateTime.MaxValue; DateTime expireDate = DateTime.MaxValue; if (DateTime.TryParse(licenseEffectiveDate, out effectiveDate)) serviceArea.LicenseEffectiveDate = effectiveDate; if (DateTime.TryParse(licenseExpireDate, out expireDate)) serviceArea.LicenseExpirationDate = expireDate; if (licenseAppointmentType != null) serviceArea.AppointmentTypeID = licenseAppointmentType.LicenseAppointmentTypeID; AdjusterStateLicenseManager.Save(serviceArea); } // create notes if (table.Rows[i]["Adjuster_Status_Code"] != string.Empty) { string adjuster_Status_Code = table.Rows[i]["Adjuster_Status_Code"].ToString(); addNote(adjuster.AdjusterId, adjuster_Status_Code); } if (table.Rows[i]["Adjuster_Reason_Code"] != string.Empty) { string sdjuster_Reason_Code = table.Rows[i]["Adjuster_Reason_Code"].ToString(); addNote(adjuster.AdjusterId, sdjuster_Reason_Code); } #endregion } scope.Complete(); lblMessage.Text = "Import completed successfully."; lblMessage.CssClass = "ok"; } } catch (Exception ex) { lblMessage.Text = "Import not completed successfully."; lblMessage.CssClass = "error"; Core.EmailHelper.emailError(ex); } }
public void UpdateAdjusterName(AdjusterMaster objAdjusterMaster) { AdjusterMaster objAdjusterMaster2 = DbContextHelper.DbContext.AdjusterMaster.First(x => x.AdjusterId == objAdjusterMaster.AdjusterId); objAdjusterMaster2.CompanyName = objAdjusterMaster.CompanyName; DbContextHelper.DbContext.SaveChanges(); }