private void LoadDetailControl() { if (pnlLead.Visible == false) { return; } if (!String.IsNullOrEmpty(CampaignId)) { SlmScr010Biz bz = new SlmScr010Biz(); var ctl = bz.GetControlname(CampaignId, "V"); Session[SLMConstant.SessionName.screen_code] = ctl; if (ctl != "") { ctlLead = (Lead_Detail_Master)LoadControl("~/Shared/" + ctl); } else { ctlLead = (Lead_Detail_Master)LoadControl("~/Shared/Lead_Detail_Default.ascx"); } if (ctlLead != null) { if (plcControl.Controls.Count == 0) { ctlLead.CommonData = ctlCommon.GetCommonData(); plcControl.Controls.Add(ctlLead); } } else { AppUtil.ClientAlert(this, "Invalid Control Name, Please contact administrator"); } } }
private void LoadDetailControl() { if (!String.IsNullOrEmpty(CampaignId)) { SlmScr010Biz bz = new SlmScr010Biz(); var ctl = bz.GetControlname(CampaignId, "E"); if (ctl != "") { ctlLead = (Lead_Detail_Master)LoadControl("~/Shared/" + ctl); } else { ctlLead = (Lead_Detail_Master)LoadControl("~/Shared/Lead_Detail_Default.ascx"); } if (ctlLead != null) { ctlLead.CommonData = ctlCommon.GetCommonData(); plcControl.Controls.Add(ctlLead); } else { AppUtil.ClientAlert(this, "Invalid Control Name, Please contact administrator"); } } }
private void BuildCombo() { AppUtil.BuildCombo(cmbBranch, SlmScr010Biz.GetBranchData()); AppUtil.BuildCombo(cmbCardTypeId, CardTypeBiz.GetCardTypeList()); AppUtil.BuildCombo(cmbMaritalStatus, SlmScr046Biz.GetMaritalDataList()); AppUtil.BuildCombo(cmbOccupation, SlmScr010Biz.GetOccupationData(false)); var complst = SlmScr034Biz.GetImportInsComCodeListData(); //complst.RemoveAt(0); AppUtil.BuildCombo(cmbCompulCompCode, complst); AppUtil.BuildCombo(cmbVolCompanyCode, complst); AppUtil.BuildCombo(cmbVolTypeKey, SlmScr046Biz.GetCoverageType()); var titlelist = SlmScr046Biz.GetTitleDataList(); AppUtil.BuildCombo(cmbTitleId, titlelist); AppUtil.BuildCombo(cmbBenTitleId, titlelist); AppUtil.BuildCombo(cmbVolMktTitle, titlelist); AppUtil.BuildCombo(cmbDrv1TitleId, titlelist); AppUtil.BuildCombo(cmbDrv2TitleId, titlelist); AppUtil.BuildCombo(cmbBenTitleId, titlelist); AppUtil.BuildCombo(cmbGuar1Title, titlelist); AppUtil.BuildCombo(cmbGuar2Title, titlelist); AppUtil.BuildCombo(cmbGuar3Title, titlelist); AppUtil.BuildCombo(cmbBrandCode, SlmScr010Biz.GetBrandDataNew()); AppUtil.BuildCombo(cmbProvinceRegis, SlmScr046Biz.GetProvinceDataId()); AppUtil.BuildCombo(cmbCarByGovId, SlmScr046Biz.GetInsuranceTypeData()); var relate = SlmScr046Biz.GetRelationData(); AppUtil.BuildCombo(cmbGuar1Relation, relate); AppUtil.BuildCombo(cmbGuar2Relation, relate); AppUtil.BuildCombo(cmbGuar3Relation, relate); }
private void SetComboOwnerBranch() { var lst = SlmScr010Biz.GetBranchListByAccessRight(SLMConstant.Branch.Active, cmbCampaignId.SelectedItem.Value); AppUtil.BuildCombo(cmbOwnerBranch, lst); AppUtil.BuildCombo(cmbDelegateBranch, lst); }
protected override void OnInit(EventArgs e) { base.OnInit(e); //comment by nung 20170505 //BuildCombo(cmbActIssueBranch, SlmScr010Biz.GetIssueBranchData()); BuildCombo(cmbActIssueBranch, SlmScr010Biz.GetIssueActiveBranchData()); }
private void BuildAmphur() { //เขต/อำเภอ cmbAmphur.DataSource = SlmScr010Biz.GetAmphurDataNew(SLMUtil.SafeInt(cmbProvince.SelectedItem.Value)); cmbAmphur.DataTextField = "TextField"; cmbAmphur.DataValueField = "ValueField"; cmbAmphur.DataBind(); cmbAmphur.Items.Insert(0, new ListItem("", "")); }
private void SetCarTypeCombo() { var itm = SlmScr010Biz.GetInsuranceCarTypeDataByModel(cmbBrand.SelectedValue, cmbModel.SelectedValue).FirstOrDefault(); if (itm != null) { AppUtil.SetComboValue(cmbCarType, itm.ValueField); } }
protected override void OnInit(EventArgs e) { base.OnInit(e); //AppUtil.BuildCombo(cmbActIssueBranch, SlmScr010Biz.GetIssueBranchData()); //AppUtil.BuildCombo(cmbPolicyBranch, SlmScr010Biz.GetIssueBranchData()); AppUtil.BuildCombo(cmbActIssueBranch, SlmScr010Biz.GetIssueActiveBranchData()); AppUtil.BuildCombo(cmbPolicyBranch, SlmScr010Biz.GetIssueActiveBranchData()); }
private void BuildTambol() { //แขวง/ตำบล cmbTambol.DataSource = SlmScr010Biz.GetTambolDataNew(SLMUtil.SafeInt(cmbAmphur.SelectedItem.Value)); cmbTambol.DataTextField = "TextField"; cmbTambol.DataValueField = "ValueField"; cmbTambol.DataBind(); cmbTambol.Items.Insert(0, new ListItem("", "")); }
private void GetBranchOwnerDefault() { try { List <StaffData> stafflist = SlmScr016Biz.GetChannelStaffData(HttpContext.Current.User.Identity.Name); if (stafflist.Count > 0) { if (!string.IsNullOrEmpty(stafflist.FirstOrDefault().ChannelId)) { if ((stafflist.FirstOrDefault().ChannelId.ToUpper() == SLM.Resource.SLMConstant.ChannelId.Branch) || (stafflist.FirstOrDefault().ChannelId.ToUpper() == SLM.Resource.SLMConstant.ChannelId.Telesales) || (stafflist.FirstOrDefault().ChannelId.ToUpper() == SLM.Resource.SLMConstant.ChannelId.PriorityBanking)) { string branch = SlmScr010Biz.GetBranchData(HttpContext.Current.User.Identity.Name); if (branch != "") { //cmbChannelId.SelectedIndex = cmbChannelId.Items.IndexOf(cmbChannelId.Items.FindByValue(stafflist.FirstOrDefault().ChannelId)); cmbOwnerBranch.SelectedIndex = cmbOwnerBranch.Items.IndexOf(cmbOwnerBranch.Items.FindByValue(branch)); cmbOwnerBranchSelectedIndexChanged(); if (cmbOwner.Items.Count > 0) { ListItem item = cmbOwner.Items.OfType <ListItem>().Where(p => p.Value.Trim().ToLower() == HttpContext.Current.User.Identity.Name.Trim().ToLower()).FirstOrDefault(); if (item != null) { cmbOwner.SelectedIndex = cmbOwner.Items.IndexOf(item); } } //cmbOwner.SelectedIndex = cmbOwner.Items.IndexOf(cmbOwner.Items.FindByValue(HttpContext.Current.User.Identity.Name)); //txtOwnerBranchUserLogin.Text = branch; txtOwnerBranchBefore.Text = branch; if (cmbOwner.SelectedIndex >= 0) { txtOwnerLeadBefore.Text = cmbOwner.SelectedItem.Value; } } } else { cmbOwner.Items.Clear(); cmbOwner.Enabled = false; } } else { cmbOwner.Items.Clear(); cmbOwner.Enabled = false; } } } catch { throw; } }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { CampaignId = ""; ((Label)Page.Master.FindControl("lblTopic")).Text = "เพิ่มข้อมูล Lead (Add)"; ScreenPrivilegeData priData = RoleBiz.GetScreenPrivilege(HttpContext.Current.User.Identity.Name, "SLM_SCR_010"); if (priData == null || priData.IsView != 1) { AppUtil.ClientAlertAndRedirect(Page, "คุณไม่มีสิทธิ์เข้าใช้หน้าจอนี้", "SLM_SCR_003.aspx"); } //รับค่า Seaaion มากจากหน้า viewlead, ปุ่ม คัดลอกข้อมูลผู้มุ่งหวัง if (Session["ticket_id"] != null) { hdfCopyTicket.Value = Session["ticket_id"] as string; Session.Remove("ticket_id"); // load default data //var ticketid = Session["ticket_id"] as string; //LeadData lead = SlmScr010Biz.GetLeadData(ticketid); // Session["ticket_id"] = null; LeadData lead = SlmScr010Biz.GetLeadData(hdfCopyTicket.Value); lead.Delegate = ""; lead.Delegate_Branch = ""; lead.Delegate_Flag = 0; if (lead != null) { //CampaignId = lead.CampaignId; ctlCommon.SetLeadData(lead, true, true); //LoadDetailControl(); //ctlLead.LoadData(lead); } } ctlCommon.SetControlMode(Lead_Detail_Master.CtlMode.New); } } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; _log.Error(message); AppUtil.ClientAlert(Page, message); } }
private void SetOwnerBranchAccessRight() { try { List <BranchData> branch = new List <BranchData>(); if (cmbCampaignId.SelectedItem.Value == "") { txtOwnerBranchBefore.Text = ""; txtOwnerLeadBefore.Text = ""; //Owner Branch //SetComboOwnerBranch(); AppUtil.BuildCombo(cmbOwnerBranch, BranchBiz.GetBranchList(SLMConstant.Branch.Active)); cmbOwnerBranch.SelectedIndex = cmbOwnerBranch.Items.IndexOf(cmbOwnerBranch.Items.FindByValue(txtOwnerBranchBefore.Text.Trim())); cmbOwnerBranchSelectedIndexChanged(); cmbOwner.SelectedIndex = cmbOwner.Items.IndexOf(cmbOwner.Items.FindByValue(txtOwnerLeadBefore.Text.Trim())); } else { SetComboOwnerBranch(); if (SlmScr010Biz.CheckStaffAccessRightExist(cmbCampaignId.SelectedItem.Value, txtOwnerBranchBefore.Text.Trim(), txtOwnerLeadBefore.Text.Trim())) { if (cmbOwnerBranch.Items.Count > 1) { if (txtOwnerBranchBefore.Text.Trim() != "") { cmbOwnerBranch.SelectedIndex = cmbOwnerBranch.Items.IndexOf(cmbOwnerBranch.Items.FindByValue(txtOwnerBranchBefore.Text.Trim())); } else { cmbOwnerBranch.SelectedIndex = -1; } } cmbOwnerBranchSelectedIndexChanged(); cmbOwner.SelectedIndex = cmbOwner.Items.IndexOf(cmbOwner.Items.FindByValue(txtOwnerLeadBefore.Text.Trim())); } else { cmbOwnerBranchSelectedIndexChanged(); txtOwnerBranchBefore.Text = ""; txtOwnerLeadBefore.Text = ""; } } } catch { throw; } }
private void GetChannelDefault() { try { string channelId = SlmScr010Biz.GetChannelDefault(HttpContext.Current.User.Identity.Name); if (!string.IsNullOrEmpty(channelId)) { cmbChannelId.SelectedIndex = cmbChannelId.Items.IndexOf(cmbChannelId.Items.FindByValue(channelId)); } } catch { throw; } }
protected void btnNext_Click(object sender, EventArgs e) { try { if (!ctlCommon.ValidateData()) { AppUtil.ClientAlert(this, "ข้อมูลไม่ครบถ้วน"); return; } if (ctlCommon.CampaignID != "") { CampaignId = ctlCommon.CampaignID; LoadDetailControl(); ctlLead.SetControlMode(Lead_Detail_Master.CtlMode.New); tbNext.Visible = false; tbSave.Visible = true; ctlCommon.SetEnableCampaign(false); // copy lead //if (Session["ticket_id"] != null) if (hdfCopyTicket.Value.Trim() != "") { //var ticketId = Session["ticket_id"] as string; var lead = SlmScr010Biz.GetLeadData(hdfCopyTicket.Value); string type = new ConfigProductScreenBiz().GetFieldType(lead.CampaignId, lead.ProductId, SLMConstant.ConfigProductScreen.ActionType.View); // remove unsed data // load data from old lead ctlLead.LoadData(lead, true, type); } } } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; _log.Error(message); AppUtil.ClientAlert(Page, message); } }
protected override void OnInit(EventArgs e) { base.OnInit(e); BuildCombo(cmbOccupation, SlmScr010Biz.GetOccupationData(false)); BuildCombo(cmbBrand, SlmScr010Biz.GetBrandDataNew(), "กรุณาระบุ"); BuildCombo(cmbCarType, SlmScr010Biz.GetInsuranceCarTypeDataNew(), "กรุณาระบุ"); BuildCombo(cmbProvince, SlmScr010Biz.GetProvinceDataNew()); BuildCombo(cmbOProvince, SlmScr010Biz.GetProvinceDataNew()); BuildCombo(cmbDProvince, SlmScr010Biz.GetProvinceDataNew()); BuildCombo(cmbCardType, CardTypeBiz.GetCardTypeList()); BuildCombo(cmbDocBranch, BranchBiz.GetBranchList(1)); BuildCombo(cmbProvinceRegis, SlmScr010Biz.GetProvinceDataNew()); BuildCombo(cmbCountry, CountryBiz.GetCountryList()); AppUtil.SetAutoCompleteDropdown(new DropDownList[] { cmbBrand, cmbModel, cmbCountry } , Page , this.ClientID + "_Autocomplete"); }
private void InitialControl() { AppUtil.SetIntTextBox(txtWorkStartHourPopup); AppUtil.SetIntTextBox(txtWorkStartMinPopup); AppUtil.SetIntTextBox(txtWorkEndHourPopup); AppUtil.SetIntTextBox(txtWorkEndMinPopup); AppUtil.SetTimeControlScript(txtWorkStartHourPopup, txtWorkStartMinPopup); AppUtil.SetTimeControlScript(txtWorkEndHourPopup, txtWorkEndMinPopup); //Search cmbChannelSearch.DataSource = ChannelBiz.GetChannelList(); cmbChannelSearch.DataTextField = "TextField"; cmbChannelSearch.DataValueField = "ValueField"; cmbChannelSearch.DataBind(); cmbChannelSearch.Items.Insert(0, new ListItem("", "")); //Popup cmbChannelPopup.DataSource = ChannelBiz.GetChannelList(); cmbChannelPopup.DataTextField = "TextField"; cmbChannelPopup.DataValueField = "ValueField"; cmbChannelPopup.DataBind(); cmbChannelPopup.Items.Insert(0, new ListItem("", "")); //UpperBranch cmbUpperBranchPopup.DataSource = BranchBiz.GetBranchList(1); cmbUpperBranchPopup.DataTextField = "TextField"; cmbUpperBranchPopup.DataValueField = "ValueField"; cmbUpperBranchPopup.DataBind(); cmbUpperBranchPopup.Items.Insert(0, new ListItem("", "")); //จังหวัด cmbProvince.DataSource = SlmScr010Biz.GetProvinceDataNew(); cmbProvince.DataTextField = "TextField"; cmbProvince.DataValueField = "ValueField"; cmbProvince.DataBind(); cmbProvince.Items.Insert(0, new ListItem("", "")); }
private void InitialDropdownlist(LeadDataPhoneCallHistory data) { try { //ประเภทบุคคล cmbCardType.DataSource = CardTypeBiz.GetCardTypeList(); cmbCardType.DataTextField = "TextField"; cmbCardType.DataValueField = "ValueField"; cmbCardType.DataBind(); cmbCardType.Items.Insert(0, new ListItem("", "")); cmbOwnerBranch.DataSource = SlmScr010Biz.GetBranchListByAccessRight(SLMConstant.Branch.Active, data.CampaignId); cmbOwnerBranch.DataTextField = "TextField"; cmbOwnerBranch.DataValueField = "ValueField"; cmbOwnerBranch.DataBind(); cmbOwnerBranch.Items.Insert(0, new ListItem("", "")); cmbOwnerBranchSelectedIndexChanged(); //Do not remove cmbDelegateBranch.DataSource = SlmScr010Biz.GetBranchListByAccessRight(SLMConstant.Branch.Active, data.CampaignId); cmbDelegateBranch.DataTextField = "TextField"; cmbDelegateBranch.DataValueField = "ValueField"; cmbDelegateBranch.DataBind(); cmbDelegateBranch.Items.Insert(0, new ListItem("", "")); cmbDelegateBranchSelectedIndexChanged(); //Do not remove //Status cmbLeadStatus.DataSource = OptionBiz.GetStatusListByActivityConfig(data.ProductId, data.LeadStatus); cmbLeadStatus.DataTextField = "TextField"; cmbLeadStatus.DataValueField = "ValueField"; cmbLeadStatus.DataBind(); } catch (Exception ex) { throw ex; } }
private void SetYeargroupCombo() { BuildCombo(cmbYearGroup, SlmScr010Biz.GetModelYearNew(cmbBrand.SelectedValue, cmbModel.SelectedValue), "กรุณาระบุ"); }
private void BuildModelCombo() { AppUtil.BuildCombo(cmbModel, SlmScr010Biz.GetModelDataNew(cmbBrandCode.SelectedValue)); }
private void BuildYearGroupCombo() { AppUtil.BuildCombo(cmbYearGroup, SlmScr010Biz.GetModelYearNew(cmbBrandCode.SelectedValue, cmbModel.SelectedValue)); }
protected void btnSavePopup_Click(object sender, EventArgs e) { try { if (txtStaffId.Text.Trim() == "") { AppUtil.ClientAlert(Page, "กรุณาระบุพนักงานที่ต้องการโอนงาน Owner"); mpePopupTransfer.Show(); return; } else if (cmbBranchCode.SelectedItem.Value == "") { AppUtil.ClientAlert(Page, "ไม่สามารถโอนงานได้ เนื่องจากไม่มีข้อมูลสาขาของพนักงานที่ต้องการโอนงาน"); mpePopupTransfer.Show(); return; } else if (rbnUserTypeGroup.Checked == true) { AppUtil.ClientAlert(Page, "ไม่สามารถโอนงานได้ เนื่องจากเป็น ประเภท User Group(Dummy)"); mpePopupTransfer.Show(); return; } else { if (gvOwner.Rows.Count > 0) { List <string> ticketlist = new List <string>(); List <string> notPassList = new List <string>(); for (int i = 0; i < gvOwner.Rows.Count; i++) { CheckBox cbSelect = (CheckBox)gvOwner.Rows[i].FindControl("cbSelect"); if (cbSelect != null && cbSelect.Checked == true) { //Check Access Right string ticketId = ((Label)gvOwner.Rows[i].FindControl("lbTicketId")).Text.Trim(); string campaignId = ((Label)gvOwner.Rows[i].FindControl("lblCampaignId")).Text.Trim(); if (!SlmScr010Biz.PassPrivilegeCampaign(SLMConstant.Branch.Active, campaignId, txtUsernamePopup.Text.Trim())) { notPassList.Add(ticketId); } else { ticketlist.Add(ticketId); } } } SlmScr018Biz.UpdateTransferOwnerLead(ticketlist, txtUsernamePopup.Text.Trim(), int.Parse(txtStaffId.Text.Trim()), HttpContext.Current.User.Identity.Name, cmbBranchCode.SelectedItem.Value, txtusername.Text.Trim()); txtEmpCodePopup.Text = ""; txtStaffId.Text = ""; txtUsernamePopup.Text = ""; txtMarketingCode.Text = ""; txtStaffNameTH.Text = ""; txtTellNo.Text = ""; txtStaffEmail.Text = ""; cmbPosition.SelectedIndex = -1; cmbStaffType.SelectedIndex = -1; txtTeam.Text = ""; cmbBranchCode.SelectedIndex = -1; cmbHeadBranchCode.SelectedIndex = -1; cmbHeadBranchCode_SelectedIndexChanged(); cmbHeadStaffId.SelectedIndex = -1; cmbDepartment.SelectedIndex = -1; rdNormal.Checked = false; rdRetire.Checked = false; GetOwnerList(); upResult.Update(); //if (UpdatedDataChanged != null) UpdatedDataChanged("tabDelegate"); string alertTicketIdList = ""; foreach (string ticketId in notPassList) { alertTicketIdList += (alertTicketIdList != "" ? ", " : "") + ticketId; } if (alertTicketIdList == "") { AppUtil.ClientAlert(Page, "บันทึกข้อมูลเรียบร้อยแล้ว"); } else { AppUtil.ClientAlert(Page, "บันทึกข้อมูลเรียบร้อยแล้ว โดยมี Ticket Id ที่โอนไม่ได้ดังนี้" + Environment.NewLine + alertTicketIdList); } } } } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; AppUtil.ClientAlert(Page, message); mpePopupTransfer.Show(); } }
private void SetCC() { txtCarCC.Text = SlmScr010Biz.GetCCFromSubModel(cmbSubModel.SelectedValue); }
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); }
private void SetModelCombo() { BuildCombo(cmbModel, SlmScr010Biz.GetModelDataNew(cmbBrand.SelectedValue), "กรุณาระบุ"); }
// load and save data override public override bool SaveData(string leadID, string UserID) { bool ret = true; try { // prepare data var ins = ctlLeadIns.GetInsData(); var addrLst = ctlLeadIns.GetInsAddrData(); ins.slm_ActNo = txtActNo.Text.Trim(); ins.slm_ActStartCoverDate = tdActStart.DateValue; ins.slm_ActEndCoverDate = tdActEnd.DateValue; ins.slm_ActIssuePlace = SLMUtil.SafeInt(cmbActIssue.SelectedValue); ins.slm_ActIssueBranch = cmbActIssueBranch.SelectedValue; LeadData ldata = new LeadData(); ldata.TicketId = CommonData.TicketID; ldata.TitleId = CommonData.TitleID; ldata.Name = CommonData.FName; ldata.LastName = CommonData.LName; ldata.ChannelId = CommonData.ChannelID; ldata.CampaignId = CommonData.CampaignID; ldata.TelNo_1 = CommonData.Phone1; ldata.TelNo_2 = CommonData.Phone2; ldata.Owner_Branch = CommonData.Branch; ldata.Owner = CommonData.Owner; ldata.IsCustomer = ins.IsCustomer ? "Y" : "N"; ldata.CardType = SLMUtil.SafeInt(ins.CardType); ldata.CitizenId = ins.CitizenId; ldata.CountryId = ins.CountryId; ldata.slm_SubStatus = "15"; ldata.Detail = txtDetails.Text.Trim(); if (ins.Birthdate.Year > 1) { ldata.Birthdate = ins.Birthdate; } ldata.Occupation = SLMUtil.SafeInt(ins.Occupation); ldata.TicketIdRefer = CommonData.TicketIDRefer; ldata.ProvinceRegis = string.IsNullOrEmpty(ins.ProvinceRegis) ? null : (int?)int.Parse(ins.ProvinceRegis); //owner, delegate ldata.HasNewOwner = CommonData.ActOwner; ldata.HasNewDelegate = CommonData.ActDelegate; //owner if (CommonData.Owner != "") //owner lead { ldata.Owner = CommonData.Owner; ldata.NewOwner = CommonData.Owner; ldata.NewOwner2 = CommonData.Owner; StaffData StaffData = SlmScr010Biz.GetStaffData(CommonData.Owner); if (StaffData != null) { ldata.StaffId = Convert.ToInt32(StaffData.StaffId); //LData.Owner_Branch = StaffData.BranchCode; } } ldata.slmOldOwner = CommonData.OldOwner; ldata.OldOwner = CommonData.OldOwner; ldata.OldOwner2 = CommonData.OldOwner; ldata.Type2 = CommonData.Type2; ldata.Delegate_Branch = CommonData.DelegateBranch; ldata.Delegate = CommonData.DelegateLead; //delegate if (!string.IsNullOrEmpty(CommonData.DelegateFlag)) { ldata.Delegate_Flag = Convert.ToDecimal(CommonData.DelegateFlag); //Add if (ldata.Delegate_Flag == 1) { ldata.Delegate_Branch = CommonData.DelegateBranch; ldata.Delegate = CommonData.DelegateLead; ldata.NewDelegate = CommonData.DelegateLead; ldata.OldDelegate = CommonData.OldDelegateLead; ldata.Type = CommonData.Type; } } else { ldata.Delegate_Flag = 0; } if (string.IsNullOrEmpty(ldata.Delegate)) { ldata.Delegate_Flag = 0; } if (ldata.CardType == 0) { ldata.CardType = null; } if (ldata.Occupation == 0) { ldata.Occupation = null; } // get create by branch StaffData createbyData = SlmScr010Biz.GetStaffData(HttpContext.Current.User.Identity.Name); if (createbyData != null) { ldata.CreatedBy_Branch = createbyData.BranchCode; } // saving string ticketid; LeadInfoBiz bz = new LeadInfoBiz(); if (!bz.SaveInsData(ldata, ins, addrLst, UserID, out ticketid, 2)) { throw new Exception(bz.ErrorMessage); } // post action CommonData.R_TicketID = ticketid; if (ldata.HasAdamsUrl) { CommonData.R_Message = "ต้องการแนบเอกสารต่อใช่หรือไม่?"; CommonData.R_HasAdams = true; } else { CommonData.R_Message = "ต้องการไปหน้าแสดงรายละเอียดผู้มุ่งหวังใช่หรือไม่?"; CommonData.R_HasAdams = false; } } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; _log.Debug(message); ret = false; CommonData.R_Message = message; } return(ret); }
private void SetDAmphur() { BuildCombo(cmbDAmphur, SlmScr010Biz.GetAmphurDataNew(SLMUtil.SafeInt(cmbDProvince.SelectedValue))); }
private void SetSubModelCombo() { BuildCombo(cmbSubModel, SlmScr010Biz.GetSubModelDataNew(cmbBrand.SelectedValue, cmbModel.SelectedValue, SLMUtil.SafeInt(cmbYearGroup.SelectedValue)), "กรุณาระบุ"); }
private void SetOTambol() { BuildCombo(cmbOTambol, SlmScr010Biz.GetTambolDataNew(SLMUtil.SafeInt(cmbOAmphur.SelectedValue))); }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { ((Label)Page.Master.FindControl("lblTopic")).Text = "แก้ไขข้อมูล Lead (Edit)"; Page.Form.DefaultButton = btnSave.UniqueID; ctlCommon.SetControlMode(Lead_Detail_Master.CtlMode.Edit); if (Request["ticketid"] != null && Request["ticketid"].ToString().Trim() != string.Empty) { CheckTicketIdPrivilege(Request["ticketid"].ToString().Trim()); } else { AppUtil.ClientAlertAndRedirect(Page, "Ticket Id not found", "SLM_SCR_003.aspx"); return; } if (!string.IsNullOrEmpty(Request["ticketid"])) { var ticketid = Request["ticketid"]; LeadData lead = SlmScr010Biz.GetLeadData(ticketid); if (lead == null) { AppUtil.ClientAlertAndRedirect(Page, "ไม่พบ Ticket Id " + ticketid + " ในระบบ", "SLM_SCR_003.aspx"); return; } if (!CheckTicketCloseOrTicketCOC(lead)) { return; } CampaignId = lead.CampaignId; ctlCommon.SetLeadData(lead); LoadDetailControl(); ctlLead.LoadData(lead); //InitialControl(); //SetScript(); } else { AppUtil.ClientAlertAndRedirect(Page, "Ticket Id not found", "SLM_SCR_003.aspx"); return; } ScreenPrivilegeData priData = RoleBiz.GetScreenPrivilege(HttpContext.Current.User.Identity.Name, "SLM_SCR_011"); if (priData == null || priData.IsView != 1) { AppUtil.ClientAlertAndRedirect(Page, "คุณไม่มีสิทธิ์เข้าใช้หน้าจอนี้", "SLM_SCR_003.aspx"); return; } //Check สิทธิ์ภัทรในการเข้าใช้งาน StaffData staff = StaffBiz.GetStaff(HttpContext.Current.User.Identity.Name); ConfigBranchPrivilegeData data = ConfigBranchPrivilegeBiz.GetConfigBranchPrivilege(staff.BranchCode); if (data != null) { if (data.IsEdit != null && data.IsEdit.Value == false) { AppUtil.ClientAlertAndRedirect(Page, "คุณไม่มีสิทธิ์เข้าใช้หน้าจอนี้", "SLM_SCR_003.aspx"); return; } } //------------------------------------------------------------------------------------------------------ } } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; _log.Error(message); AppUtil.ClientAlert(Page, message); } }
public bool ValidateData(bool isValidateNewLead = true) { if (!isValidateNewLead) //หน้า Edit { if (!IsLastestOwnerDelegate()) { AppUtil.ClientAlertAndRedirect(Page, "ข้อมูลผู้มุ่งหวังนี้ถูกจ่ายงานให้พนักงานท่านอื่นแล้ว ระบบจะทำการ Refresh หน้าจอให้", "SLM_SCR_011.aspx?ticketid=" + txtslm_TicketId.Text.Trim()); return(false); } } int i = 0; if (txtName.Text.Trim() == string.Empty) { vtxtName.Text = "กรุณาระบุชื่อ"; i += 1; } else { vtxtName.Text = ""; } if (cmbCampaignId.SelectedItem.Value == string.Empty) { vcmbCampaignId.Text = "กรุณาระบุแคมเปญ"; i += 1; } else { vcmbCampaignId.Text = ""; } if (cmbChannelId.SelectedItem.Value == string.Empty) { vcmbChannelId.Text = "กรุณาระบุช่องทาง"; i += 1; } else { vcmbChannelId.Text = ""; } //****************************Owner********************************************************** if (isValidateNewLead) { if (cmbOwnerBranch.SelectedItem.Value != string.Empty && cmbOwner.Items.Count > 0 && cmbOwner.SelectedItem.Value == string.Empty) { vcmbOwner.Text = "กรุณาระบุ Owner Lead"; i += 1; } else { vcmbOwner.Text = ""; if (cmbCampaignId.SelectedItem.Value != string.Empty && cmbOwnerBranch.SelectedItem.Value != string.Empty && cmbOwner.Items.Count > 0 && cmbOwner.SelectedItem.Value != string.Empty) { if (!SlmScr010Biz.PassPrivilegeCampaign(SLMConstant.Branch.Active, cmbCampaignId.SelectedItem.Value, cmbOwner.SelectedItem.Value)) { vcmbOwner.Text = "Owner Lead ไม่มีสิทธิ์ในแคมเปญนี้"; i += 1; } else { vcmbOwner.Text = ""; } } } } else { //หน้า Edit //OwnerBranch, Owner string clearOwnerBranchText = "Y"; if (!AppUtil.ValidateOwner(newassignflag, cmbOwnerBranch, vcmbOwnerBranch, cmbOwner, vcmbOwner, cmbCampaignId.SelectedItem.Value, ref clearOwnerBranchText)) { i += 1; } //Branch ที่ถูกปิด if (cmbOwnerBranch.Items.Count > 0 && cmbOwnerBranch.SelectedItem.Value != "" && !BranchBiz.CheckBranchActive(cmbOwnerBranch.SelectedItem.Value)) { vcmbOwnerBranch.Text = "สาขานี้ถูกปิดแล้ว"; i += 1; } else { if (clearOwnerBranchText == "Y") { vcmbOwnerBranch.Text = ""; } } } //****************************Delegate********************************************************** //Delegate มีเฉพาะหน้า Edit if (!isValidateNewLead) { if (cmbDelegateBranch.Items.Count > 0 && cmbDelegateBranch.SelectedItem.Value != "" && !BranchBiz.CheckBranchActive(cmbDelegateBranch.SelectedItem.Value)) { vcmbDelegateBranch.Text = "สาขานี้ถูกปิดแล้ว"; i += 1; } else { vcmbDelegateBranch.Text = ""; } if (cmbDelegateBranch.SelectedItem.Value != string.Empty && cmbDelegateLead.SelectedItem.Value == string.Empty) { vcmbDelegateLead.Text = "กรุณาระบุ Delegate Lead"; i += 1; } else { vcmbDelegateLead.Text = ""; } } //****************************หมายเลขโทรศัพท์ 1******************************************** decimal result1; if (txtTelNo_1.Text.Trim() == string.Empty) { vtxtTelNo_1.Text = "กรุณาระบุหมายเลขโทรศัพท์ 1(มือถือ)ให้ถูกต้อง"; i += 1; } else if (txtTelNo_1.Text.Trim().Length < 9 || txtTelNo_1.Text.Trim().Length > 10) { vtxtTelNo_1.Text = "กรุณาระบุหมายเลขโทรศัพท์ 1(มือถือ)ให้ถูกต้อง"; i += 1; } else if (txtTelNo_1.Text.Trim() != string.Empty && !decimal.TryParse(txtTelNo_1.Text.Trim(), out result1)) { vtxtTelNo_1.Text = "หมายเลขโทรศัพท์ 1(มือถือ)ต้องเป็นตัวเลขเท่านั้น"; i += 1; } else if (txtTelNo_1.Text.Trim().StartsWith("0") == false) { vtxtTelNo_1.Text = "หมายเลขโทรศัพท์ 1(มือถือ)ต้องขึ้นต้นด้วยเลข 0 เท่านั้น"; i += 1; } else { vtxtTelNo_1.Text = ""; } //****************************หมายเลขโทรศัพท์ 2******************************************** decimal result2; if (txtTelNo2.Text.Trim() != string.Empty && txtTelNo2.Text.Trim().Length < 9) { vtxtTelNo2.Text = "หมายเลขโทรศัพท์ 2 ต้องมีอย่างน้อย 9 หลัก"; i += 1; } else if (txtTelNo2.Text.Trim() != string.Empty && !decimal.TryParse(txtTelNo2.Text.Trim(), out result2)) { vtxtTelNo2.Text = "หมายเลขโทรศัพท์ 2 ต้องเป็นตัวเลขเท่านั้น"; i += 1; } else if (txtTelNo2.Text.Trim() != string.Empty && txtTelNo2.Text.Trim().StartsWith("0") == false) { vtxtTelNo2.Text = "หมายเลขโทรศัพท์ 2 ต้องขึ้นต้นด้วยเลข 0 เท่านั้น"; i += 1; } else { vtxtTelNo2.Text = ""; } //****************************หมายเลขโทรศัพท์ 3******************************************** //****************************Ticket ID Refer******************************************** SlmScr003Biz biz = new SlmScr003Biz(); if (txtTicketIdRefer.Text.Trim() != string.Empty && txtslm_TicketId.Text == txtTicketIdRefer.Text.Trim()) { vtxtTicketIdRefer.Text = "Ticket ID Refer ต้องไม่เท่ากับ Ticket ID"; i += 1; } else if (SlmScr003Biz.ValidateTicketIDRefer(txtTicketIdRefer.Text.Trim())) { vtxtTicketIdRefer.Text = "ไม่พบ Ticket ID Refer ที่ระบุ"; i += 1; } //ValidateTicketIDRefer return(i == 0); }