public static Mortgagee Get(string mortgageeName, int clientID) { Mortgagee mortgagee = (from x in DbContextHelper.DbContext.Mortgagee where x.MortageeName == mortgageeName && x.Status == true & x.ClientID == clientID select x).FirstOrDefault(); return(mortgagee); }
public static Mortgagee Get(int id) { Mortgagee mortgagee = (from x in DbContextHelper.DbContext.Mortgagee.Include("CityMaster").Include("StateMaster").Include("ZipCodeMaster") where x.MortgageeID == id select x).FirstOrDefault(); return(mortgagee); }
protected bool saveLienholder() { int id = Convert.ToInt32(hf_id.Value); clientID = Core.SessionHelper.getClientId(); Mortgagee mortgagee = null; // 2013-08-07 tortega using (TransactionScope scope = new TransactionScope()) { if (id > 0) { mortgagee = MortgageeManager.Get(id); } else { bool exists = MortgageeManager.IsExist(txtName.Text.Trim(), clientID); if (exists) { lblMessage.Text = "Mortgagee name already exists."; lblMessage.CssClass = "error"; txtName.Focus(); return(false); } mortgagee = new Mortgagee(); mortgagee.Status = true; } mortgagee.ClientID = clientID; mortgagee.MortageeName = txtName.Text.Trim(); mortgagee.AddressLine1 = txtAddress.Text.Trim(); mortgagee.AddressLine2 = txtAddress2.Text.Trim(); mortgagee.CityID = Convert.ToInt32(ddlCity.SelectedValue); mortgagee.StateID = Convert.ToInt32(this.ddlState.SelectedValue); mortgagee.ZipCodeID = Convert.ToInt32(this.ddlLossZip.SelectedValue); mortgagee.Phone = txtPhone.Text.Trim(); mortgagee.Fax = txtFax.Text.Trim(); mortgagee.Email = txtEmail.Text; mortgagee.ContactName = txtContactName.Text; if (ddlCountry.SelectedIndex > 0) { mortgagee.CountryID = Convert.ToInt32(ddlCountry.SelectedValue); } MortgageeManager.Save(mortgagee); scope.Complete(); } return(true); }
public static Mortgagee Save(Mortgagee mortgagee) { if (mortgagee.MortgageeID == 0) { DbContextHelper.DbContext.Add(mortgagee); } DbContextHelper.DbContext.SaveChanges(); return(mortgagee); }
protected void gv_RowCommand(object sender, GridViewCommandEventArgs e) { Mortgagee mortgagee = null; if (e.CommandName == "DoEdit") { hf_id.Value = e.CommandArgument.ToString(); mortgagee = MortgageeManager.Get(Convert.ToInt32(e.CommandArgument)); if (mortgagee != null) { pnlEdit.Visible = true; pnlList.Visible = false; hf_id.Value = mortgagee.MortgageeID.ToString(); CollectionManager.FillCollection(ddlState, "StateId", "StateName", State.GetAll()); CollectionManager.FillCollection(ddlCity, "CityId", "CityName", City.GetAll(mortgagee.StateID ?? 0)); CollectionManager.FillCollection(ddlLossZip, "ZipCodeID", "ZipCode", ZipCode.getByCityID(mortgagee.CityID ?? 0)); txtName.Text = mortgagee.MortageeName; txtAddress.Text = mortgagee.AddressLine1; txtAddress2.Text = mortgagee.AddressLine2; txtFax.Text = mortgagee.Fax; txtPhone.Text = mortgagee.Phone; txtEmail.Text = mortgagee.Email; txtContactName.Text = mortgagee.ContactName; if (mortgagee.StateID != null) { ddlState.SelectedValue = mortgagee.StateID.ToString(); } if (mortgagee.CityID != null) { ddlCity.SelectedValue = mortgagee.CityID.ToString(); } if (mortgagee.ZipCodeID != null) { ddlLossZip.SelectedValue = mortgagee.ZipCodeID.ToString(); } this.ddlCountry.SelectedValue = (mortgagee.CountryID ?? 0).ToString(); } } if (e.CommandName == "DoDelete") { mortgagee = MortgageeManager.Get(Convert.ToInt32(e.CommandArgument)); if (mortgagee != null) { mortgagee.Status = false; MortgageeManager.Save(mortgagee); bindLienholders(); } } }
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; } }
protected bool saveLienholder() { int id = Convert.ToInt32(hf_id.Value); clientID = Core.SessionHelper.getClientId(); Mortgagee mortgagee = null; // 2013-08-07 tortega using (TransactionScope scope = new TransactionScope()) { if (id > 0) { mortgagee = MortgageeManager.Get(id); } else { bool exists = MortgageeManager.IsExist(txtName.Text.Trim(), clientID); if (exists) { lblMessage.Text = "Mortgagee name already exists."; lblMessage.CssClass = "error"; txtName.Focus(); return false; } mortgagee = new Mortgagee(); mortgagee.Status = true; } mortgagee.ClientID = clientID; mortgagee.MortageeName = txtName.Text.Trim(); mortgagee.AddressLine1 = txtAddress.Text.Trim(); mortgagee.AddressLine2 = txtAddress2.Text.Trim(); mortgagee.CityID = Convert.ToInt32(ddlCity.SelectedValue); mortgagee.StateID = Convert.ToInt32(this.ddlState.SelectedValue); mortgagee.ZipCodeID = Convert.ToInt32(this.ddlLossZip.SelectedValue); mortgagee.Phone = txtPhone.Text.Trim(); mortgagee.Fax = txtFax.Text.Trim(); mortgagee.Email = txtEmail.Text; mortgagee.ContactName = txtContactName.Text; if (ddlCountry.SelectedIndex > 0) mortgagee.CountryID = Convert.ToInt32(ddlCountry.SelectedValue); MortgageeManager.Save(mortgagee); scope.Complete(); } return true; }