public override bool LoadData(LeadData ld, bool isCopy = false, string _type = "") { bool ret = true; try { LeadInfoBiz.LeadDetailInsData ins = new LeadInfoBiz.LeadDetailInsData(); List <LeadInfoBiz.LeadDetailAddress> addrLst = new List <LeadInfoBiz.LeadDetailAddress>(); LeadInfoBiz bz = new LeadInfoBiz(); if (!bz.GetInsDetail(ld.TicketId, out ins, out addrLst, Page.User.Identity.Name)) { if (!isCopy || _type == "1" || _type == "2" || _type == "3") { throw new Exception(bz.ErrorMessage); // throw new Exception(bz.ErrorMessage); } } // set for current control if (!isCopy) { txtActNo.Text = ins.slm_ActNo; txtDetails.Text = ld.Detail; } if (!isCopy || _type == "2" || _type == "3") { tdActStart.DateValue = ins.slm_ActStartCoverDate == null ? new DateTime() : ins.slm_ActStartCoverDate.Value; tdActEnd.DateValue = ins.slm_ActEndCoverDate == null ? new DateTime() : ins.slm_ActEndCoverDate.Value; AppUtil.SetComboValue(cmbActIssue, ins.slm_ActIssuePlace.ToString()); ListItem item = cmbActIssueBranch.Items.FindByValue(ins.slm_ActIssueBranch); if (item != null) { AppUtil.SetComboValue(cmbActIssueBranch, ins.slm_ActIssueBranch); } else { if (!isCopy) { var branchName = SlmScr010Biz.GetBranchName(ins.slm_ActIssueBranch); if (!string.IsNullOrEmpty(branchName)) { cmbActIssueBranch.Items.Insert(1, new ListItem(branchName, ins.slm_ActIssueBranch)); cmbActIssueBranch.SelectedIndex = 1; } } } SetActIssueBranch(); } if (isCopy && _type != "1" && _type != "2" && _type != "3") // copy from default { if (ins == null) { ins = new LeadInfoBiz.LeadDetailInsData(); } ins.IsCustomer = ld.IsCustomer == "Y"; ins.CardType = ld.CardType.ToString(); ins.CitizenId = ld.CitizenId; ins.CountryId = ld.CountryId; ins.Birthdate = ld.Birthdate ?? new DateTime(); ins.Occupation = ld.Occupation.ToString(); ins.slm_ContractNo = ld.ContractNo; ins.slm_RedbookYearGroup = ld.slm_RedbookYearGroup; ins.slm_RedbookBrandCode = ld.slm_RedbookBrandCode; ins.slm_RedbookKKKey = ld.slm_RedbookKKKey; ins.slm_RedbookModelCode = ld.slm_RedbookModelCode; ins.slm_LicenseNo = ld.LicenseNo; ins.IsCustomer = ld.IsCustomer == "1"; if (addrLst == null) { addrLst = new List <LeadInfoBiz.LeadDetailAddress>(); } if (addrLst.Count == 0) { addrLst.Add(new LeadInfoBiz.LeadDetailAddress() { slm_AddressType = "C", slm_AddressNo = ld.AddressNo, slm_BuildingName = ld.BuildingName, slm_Floor = ld.Floor, slm_Soi = ld.Soi, slm_Street = ld.Street, slm_Province = ld.Province, slm_Amphur = ld.Amphur, slm_Tambon = ld.Tambon, slm_PostalCode = ld.PostalCode }); } } // set for share control ctlLeadIns.SetInsData(ins, isCopy); ctlLeadIns.SetInsAddrData(addrLst); } catch (Exception ex) { ret = false; throw ex; } return(ret); }
public LeadInfoBiz.LeadDetailInsData GetInsData() { var ins = new LeadInfoBiz.LeadDetailInsData(); ins.slm_RenewInsureId = SLMUtil.SafeDecimal(hdfID.Value); ins.slm_ContractNo = txtContractNo.Text.Trim(); if (cmbCardType.SelectedIndex > 0) { ins.CardType = cmbCardType.SelectedValue; } if (cmbCountry.SelectedIndex > 0) { ins.CountryId = Convert.ToInt32(cmbCountry.SelectedValue); } ins.IsCustomer = chkOldCustomer.Checked; ins.CitizenId = txtCitizenId.Text.Trim(); if (tdBirthdate.DateValue.Year != 1) { ins.Birthdate = tdBirthdate.DateValue; } ins.MaritalStatus = rdoMarital.SelectedValue; if (cmbOccupation.SelectedIndex > 0) { ins.Occupation = cmbOccupation.SelectedValue; } ins.slm_CC = txtCarCC.Text.Trim(); if (cmbBrand.SelectedIndex > 0) { ins.slm_RedbookBrandCode = cmbBrand.SelectedValue; } if (cmbModel.SelectedIndex > 0) { ins.slm_RedbookModelCode = cmbModel.SelectedValue; } if (cmbYearGroup.SelectedIndex > 0) { ins.slm_RedbookYearGroup = SLMUtil.SafeInt(cmbYearGroup.SelectedValue); } if (cmbSubModel.SelectedIndex > 0) { ins.slm_RedbookKKKey = cmbSubModel.SelectedValue; } //ins.slm_CoverageTypeId = SLMUtil.SafeInt(cmbCarType.SelectedValue); if (cmbCarType.SelectedIndex > 0) { ins.slm_InsurancecarTypeId = SLMUtil.SafeInt(cmbCarType.SelectedValue); } ins.slm_LicenseNo = txtCarLicense.Text.Trim(); if (cmbProvinceRegis.SelectedItem.Value != "") { ins.ProvinceRegis = cmbProvinceRegis.SelectedItem.Value; } ins.slm_ChassisNo = txtCarChassie.Text.Trim(); ins.slm_EngineNo = txtCarEngine.Text.Trim(); ins.slm_SendDocFlag = chkSendToBranch.Checked ? "3" : "1"; if (chkSendToBranch.Checked) { ins.slm_SendDocBrandCode = cmbDocBranch.SelectedValue; } // default? ins.slm_PolicyDiscountAmt = SLMUtil.SafeInt(hdfPolicyDiscountAmt.Value); ins.slm_PolicyGrossVat = SLMUtil.SafeInt(hdfPolicyGrossVat.Value); ins.slm_PolicyGrossStamp = SLMUtil.SafeInt(hdfPolicyGrossStamp.Value); ins.slm_PolicyGrossPremium = SLMUtil.SafeInt(hdfPolicyGrossPremium.Value); ins.slm_PolicyGrossPremiumTotal = SLMUtil.SafeInt(hdfPolicyGrossPremiumTotal.Value); ins.slm_ActGrossPremium = SLMUtil.SafeInt(hdfActGrossPremium.Value); ins.slm_ActNetPremium = SLMUtil.SafeInt(hdfActNetPremium.Value); ins.slm_ActVat = SLMUtil.SafeInt(hdfActVat.Value); ins.slm_ActStamp = SLMUtil.SafeInt(hdfActStamp.Value); return(ins); }
public void SetInsData(LeadInfoBiz.LeadDetailInsData ins, bool isCopy = false) { if (!isCopy) { hdfID.Value = ins.slm_RenewInsureId.ToString(); } txtContractNo.Text = ins.slm_ContractNo; chkOldCustomer.Checked = ins.IsCustomer; AppUtil.SetComboValue(cmbCardType, ins.CardType); if (cmbCardType.SelectedValue != "") { txtCitizenId.Text = ins.CitizenId; txtCitizenId.ReadOnly = false; txtCitizenId.Enabled = true; lblCitizenId.Text = "*"; lblCountryId.Text = "*"; //if (cmbCardType.SelectedValue == AppConstant.CardType.Foreigner) //{ // lblCountryId.Text = "*"; // cmbCountry.Enabled = true; //} } tdBirthdate.DateValue = ins.Birthdate; AppUtil.SetComboValue(cmbCountry, ins.CountryId.ToString()); rdoMarital.SelectedIndex = rdoMarital.Items.IndexOf(rdoMarital.Items.FindByValue(ins.MaritalStatus)); AppUtil.SetComboValue(cmbOccupation, ins.Occupation); txtCarCC.Text = ins.slm_CC; AppUtil.SetComboValue(cmbBrand, ins.slm_RedbookBrandCode); SetModelCombo(); AppUtil.SetComboValue(cmbModel, ins.slm_RedbookModelCode); SetYeargroupCombo(); AppUtil.SetComboValue(cmbYearGroup, ins.slm_RedbookYearGroup.ToString()); SetSubModelCombo(); AppUtil.SetComboValue(cmbSubModel, ins.slm_RedbookKKKey); AppUtil.SetComboValue(cmbCarType, ins.slm_InsurancecarTypeId.ToString()); txtCarLicense.Text = ins.slm_LicenseNo; if (!string.IsNullOrEmpty(ins.ProvinceRegis)) { cmbProvinceRegis.SelectedIndex = cmbProvinceRegis.Items.IndexOf(cmbProvinceRegis.Items.FindByValue(ins.ProvinceRegis)); } txtCarChassie.Text = ins.slm_ChassisNo; txtCarEngine.Text = ins.slm_EngineNo; if (ins.slm_SendDocFlag != null) { chkSendToBranch.Checked = ins.slm_SendDocFlag == "3"; } if (ins.slm_SendDocBrandCode != null) { AppUtil.SetComboValue(cmbDocBranch, ins.slm_SendDocBrandCode); } cmbDocBranch.Visible = chkSendToBranch.Checked; SetDAddress(); hdfPolicyDiscountAmt.Value = ins.slm_PolicyDiscountAmt.ToString(); hdfPolicyGrossVat.Value = ins.slm_PolicyGrossVat.ToString(); hdfPolicyGrossStamp.Value = ins.slm_PolicyGrossStamp.ToString(); hdfPolicyGrossPremium.Value = ins.slm_PolicyGrossPremium.ToString(); hdfPolicyGrossPremiumTotal.Value = ins.slm_PolicyGrossPremiumTotal.ToString(); hdfActGrossPremium.Value = ins.slm_ActGrossPremium.ToString(); hdfActNetPremium.Value = ins.slm_ActNetPremium.ToString(); hdfActVat.Value = ins.slm_ActVat.ToString(); hdfActStamp.Value = ins.slm_ActStamp.ToString(); updMain.Update(); updAddress.Update(); }
public override bool LoadData(LeadData ld, bool isCopy = false, string _type = "") { bool ret = true; try { LeadInfoBiz.LeadDetailInsData ins = new LeadInfoBiz.LeadDetailInsData(); List <LeadInfoBiz.LeadDetailAddress> addrLst = new List <LeadInfoBiz.LeadDetailAddress>(); LeadInfoBiz bz = new LeadInfoBiz(); if (!bz.GetInsDetail(ld.TicketId, out ins, out addrLst, Page.User.Identity.Name)) { if (!isCopy || _type == "1" || _type == "2" || _type == "3") { throw new Exception(bz.ErrorMessage); // throw new Exception(bz.ErrorMessage); } } // set for current control if (!isCopy) { txtDetails.Text = ld.Detail; } if (isCopy && _type != "1" && _type != "2" && _type != "3") // copy from default { if (ins == null) { ins = new LeadInfoBiz.LeadDetailInsData(); } ins.IsCustomer = ld.IsCustomer == "Y"; ins.CardType = ld.CardType.ToString(); ins.CitizenId = ld.CitizenId; ins.CountryId = ld.CountryId; ins.Birthdate = ld.Birthdate ?? new DateTime(); ins.Occupation = ld.Occupation.ToString(); ins.slm_ContractNo = ld.ContractNo; ins.slm_RedbookYearGroup = ld.slm_RedbookYearGroup; ins.slm_RedbookBrandCode = ld.slm_RedbookBrandCode; ins.slm_RedbookKKKey = ld.slm_RedbookKKKey; ins.slm_RedbookModelCode = ld.slm_RedbookModelCode; ins.slm_LicenseNo = ld.LicenseNo; ins.IsCustomer = ld.IsCustomer == "1"; if (addrLst == null) { addrLst = new List <LeadInfoBiz.LeadDetailAddress>(); } if (addrLst.Count == 0) { addrLst.Add(new LeadInfoBiz.LeadDetailAddress() { slm_AddressType = "C", slm_AddressNo = ld.AddressNo, slm_BuildingName = ld.BuildingName, slm_Floor = ld.Floor, slm_Soi = ld.Soi, slm_Street = ld.Street, slm_Province = ld.Province, slm_Amphur = ld.Amphur, slm_Tambon = ld.Tambon, slm_PostalCode = ld.PostalCode }); } } // set for share control ctlLeadIns.SetInsData(ins, isCopy); ctlLeadIns.SetInsAddrData(addrLst); } catch { ret = false; throw; } return(ret); }