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 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); }