private bool IsLastestOwnerDelegate() { try { List <string> flagList = LeadInfoBiz.GetAssignedFlagAndDelegateFlag(txtslm_TicketId.Text.Trim()); newassignflag = flagList[0]; newDelegateFlag = flagList[1]; if (newassignflag != txtAssignFlag.Text.Trim()) { return(false); } if (newDelegateFlag != txtDelegateFlag.Text.Trim()) { return(false); } return(true); } catch { throw; } }
private bool ValidateData() { try { int i = 0; //เช็กสถานะ require cardId if (LeadInfoBiz.CheckRequireCardId(cmbLeadStatus.SelectedItem.Value)) { if (cmbCardType.SelectedItem.Value == "") { i += 1; vtxtCardType.Text = "กรุณาระบุประเภทบุคคล"; } if (txtCitizenId.Text.Trim() == "") { i += 1; vtxtCitizenId.Text = "กรุณาระบุเลขที่บัตร"; } if (cmbCardType.SelectedItem.Value != "" && txtCitizenId.Text.Trim() != "") { if (!AppUtil.ValidateCardId(cmbCardType, txtCitizenId, vtxtCitizenId)) { i += 1; } } } else { //Validate เลขที่บัตร if (cmbCardType.SelectedItem.Value != "") { if (txtCitizenId.Text.Trim() == "") { vtxtCitizenId.Text = "กรุณาระบุเลขที่บัตร"; i += 1; } else { if (!AppUtil.ValidateCardId(cmbCardType, txtCitizenId, vtxtCitizenId)) { i += 1; } } } else if (cmbCardType.SelectedItem.Value == "" && txtCitizenId.Text.Trim() != "") { vtxtCardType.Text = "กรุณาระบุประเภทบุคคล"; i += 1; } else { vtxtCardType.Text = ""; vtxtCitizenId.Text = ""; } } //OwnerBranch, Owner string clearOwnerBranchText = "Y"; if (cmbOwnerBranch.SelectedItem.Value != txtOldOwnerBranch.Text.Trim() || cmbOwner.SelectedItem.Value != txtOldOwner.Text.Trim()) { if (!AppUtil.ValidateOwner(_currentAssignedFlag, cmbOwnerBranch, vcmbOwnerBranch, cmbOwner, vcmbOwner, txtCampaignId.Text.Trim(), 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 = ""; } } } else { vcmbOwnerBranch.Text = ""; vcmbOwner.Text = ""; } //DelegateBranch, Delegate if (cmbDelegateBranch.SelectedItem.Value != txtOldDelegateBranch.Text.Trim() || cmbDelegate.SelectedItem.Value != txtOldDelegate.Text.Trim()) { if (cmbDelegateBranch.SelectedItem.Value != string.Empty && cmbDelegate.SelectedItem.Value == string.Empty) { vcmbDelegate.Text = "กรุณาระบุ Delegate Lead"; i += 1; } else { vcmbDelegate.Text = ""; } if (cmbDelegateBranch.Items.Count > 0 && cmbDelegateBranch.SelectedItem.Value != "" && !BranchBiz.CheckBranchActive(cmbDelegateBranch.SelectedItem.Value)) { vcmbDelegateBranch.Text = "สาขานี้ถูกปิดแล้ว"; i += 1; } else { vcmbDelegateBranch.Text = ""; } } else { vcmbDelegateBranch.Text = ""; vcmbDelegate.Text = ""; } //รายละเอียดเพิ่มเติม if (txtContactDetail.Text.Trim() == "") { vtxtContactDetail.Text = "กรุณากรอกข้อมูลรายละเอียดก่อนทำการบันทึก"; i += 1; } else { vtxtContactDetail.Text = ""; } upPopup.Update(); return(i > 0 ? false : true); } catch (Exception ex) { throw ex; } }
protected void btnSave_Click(object sender, EventArgs e) { try { List <string> flagList = LeadInfoBiz.GetAssignedFlagAndDelegateFlag(txtTicketID.Text.Trim()); _currentAssignedFlag = flagList[0]; _currentDelegateFlag = flagList[1]; if (cmbOwnerBranch.Items.Count > 0 && cmbOwner.Items.Count > 0) { if (cmbOwnerBranch.SelectedItem.Value != txtOldOwnerBranch.Text.Trim() || cmbOwner.SelectedItem.Value != txtOldOwner.Text.Trim()) { if (_currentAssignedFlag != txtAssignedFlag.Text.Trim()) { AppUtil.ClientAlertAndRedirect(Page, "ไม่สามารถบันทึกผลการติดต่อได้ เนื่องจากมีคนเปลี่ยน Owner รบกวนรอ 1 นาที แล้วกลับมาบันทึกผลการติดต่อได้", "SLM_SCR_004.aspx?ticketid=" + txtTicketID.Text.Trim() + "&tab=008"); return; } } } if (cmbDelegateBranch.Items.Count > 0 && cmbDelegate.Items.Count > 0) { if (cmbDelegateBranch.SelectedItem.Value != txtOldDelegateBranch.Text.Trim() || cmbDelegate.SelectedItem.Value != txtOldDelegate.Text.Trim()) { if (_currentDelegateFlag != txtDelegateFlag.Text.Trim()) { AppUtil.ClientAlertAndRedirect(Page, "ไม่สามารถบันทึกผลการติดต่อได้ เนื่องจากมีคนเปลี่ยน Delegate รบกวนรอ 1 นาที แล้วกลับมาบันทึกผลการติดต่อได้", "SLM_SCR_004.aspx?ticketid=" + txtTicketID.Text.Trim() + "&tab=008"); return; } } } if (ValidateData()) { SlmScr008Biz.InsertPhoneCallHistory(txtTicketID.Text.Trim(), cmbCardType.SelectedItem.Value, txtCitizenId.Text.Trim(), cmbLeadStatus.SelectedItem.Value, txtOldStatus.Text.Trim(), cmbOwnerBranch.SelectedItem.Value, cmbOwner.SelectedItem.Value, txtOldOwner.Text.Trim() , cmbDelegateBranch.SelectedItem.Value, cmbDelegate.SelectedItem.Value, txtOldDelegate.Text.Trim(), txtContactPhone.Text.Trim(), txtContactDetail.Text.Trim(), HttpContext.Current.User.Identity.Name); txtTicketIdSearch.Text = txtTicketID.Text.Trim(); txtCitizenIdSearch.Text = txtCitizenId.Text.Trim(); txtTelNo1Search.Text = txtTelNo1.Text.Trim(); DoBindGridview(0); CheckActivityConfig(txtProductId.Text.Trim(), cmbLeadStatus.SelectedItem.Value); if (UpdatedDataChanged != null) { UpdatedDataChanged(cmbLeadStatus.SelectedItem.Text); } ClearData(); mpePopup.Hide(); AppUtil.ClientAlert(Page, "บันทึกข้อมูลเรียบร้อย"); } else { mpePopup.Show(); } } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; _log.Debug(message); AppUtil.ClientAlert(Page, message); } }
protected void btnAddResultContact_Click(object sender, EventArgs e) { try { var data = LeadInfoBiz.GetLeadDataPhoneCallHistory(txtTicketIdSearch.Text.Trim()); if (data != null) { txtTicketID.Text = data.TicketId; txtFirstname.Text = data.Name; txtLastname.Text = data.LastName; txtProductId.Text = data.ProductId; txtCampaignId.Text = data.CampaignId; txtCampaign.Text = data.CampaignName; txtTelNo1.Text = data.TelNo1; txtCitizenId.Text = data.CitizenId; txtAssignedFlag.Text = data.AssignedFlag; txtDelegateFlag.Text = data.DelegateFlag != null?data.DelegateFlag.ToString() : ""; InitialDropdownlist(data); if (data.CardType != null) { cmbCardType.SelectedIndex = cmbCardType.Items.IndexOf(cmbCardType.Items.FindByValue(data.CardType.Value.ToString())); lblCitizenId.Text = "*"; txtCitizenId.Enabled = true; txtCitizenId.Text = data.CitizenId; AppUtil.SetCardTypeValidation(cmbCardType.SelectedItem.Value, txtCitizenId); } else { txtCitizenId.Text = data.CitizenId; } //Owner Branch if (!string.IsNullOrEmpty(data.OwnerBranch)) { txtOldOwnerBranch.Text = data.OwnerBranch; ListItem item = cmbOwnerBranch.Items.FindByValue(data.OwnerBranch); if (item != null) { cmbOwnerBranch.SelectedIndex = cmbOwnerBranch.Items.IndexOf(item); } else { //check ว่ามีการกำหนด Brach ใน Table kkslm_ms_Access_Right ไหม ถ้ามีจะเท่ากับเป็น Branch ที่ถูกปิด ถ้าไม่มีแปลว่าไม่มีการเซตการมองเห็น if (SlmScr011Biz.CheckBranchAccessRightExist(SLMConstant.Branch.All, txtCampaignId.Text.Trim(), data.OwnerBranch)) { //Branch ที่ถูกปิด string branchName = BranchBiz.GetBranchName(data.OwnerBranch); if (!string.IsNullOrEmpty(branchName)) { cmbOwnerBranch.Items.Insert(1, new ListItem(branchName, data.OwnerBranch)); cmbOwnerBranch.SelectedIndex = 1; } } } cmbOwnerBranchSelectedIndexChanged(); //Bind Combo Owner } //Owner if (!string.IsNullOrEmpty(data.Owner)) { txtOldOwner.Text = data.Owner; cmbOwner.SelectedIndex = cmbOwner.Items.IndexOf(cmbOwner.Items.FindByValue(data.Owner)); } //Delegate Branch if (!string.IsNullOrEmpty(data.DelegateBranch)) { txtOldDelegateBranch.Text = data.DelegateBranch; ListItem item = cmbDelegateBranch.Items.FindByValue(data.DelegateBranch); if (item != null) { cmbDelegateBranch.SelectedIndex = cmbDelegateBranch.Items.IndexOf(item); } else { //check ว่ามีการกำหนด Brach ใน Table kkslm_ms_Access_Right ไหม ถ้ามีจะเท่ากับเป็น Branch ที่ถูกปิด ถ้าไม่มีแปลว่าไม่มีการเซตการมองเห็น if (SlmScr011Biz.CheckBranchAccessRightExist(SLMConstant.Branch.All, txtCampaignId.Text.Trim(), data.DelegateBranch)) { //Branch ที่ถูกปิด string branchName = BranchBiz.GetBranchName(data.DelegateBranch); if (!string.IsNullOrEmpty(branchName)) { cmbDelegateBranch.Items.Insert(1, new ListItem(branchName, data.DelegateBranch)); cmbDelegateBranch.SelectedIndex = 1; } } } cmbDelegateBranchSelectedIndexChanged(); //Bind Combo Delegate } if (!string.IsNullOrEmpty(data.Delegate)) { txtOldDelegate.Text = data.Delegate; cmbDelegate.SelectedIndex = cmbDelegate.Items.IndexOf(cmbDelegate.Items.FindByValue(data.Delegate)); } //Lead Status if (cmbLeadStatus.Items.Count > 0) { cmbLeadStatus.SelectedIndex = cmbLeadStatus.Items.IndexOf(cmbLeadStatus.Items.FindByValue(data.LeadStatus)); txtOldStatus.Text = data.LeadStatus; } cmbLeadStatus.Enabled = data.AssignedFlag == "1" ? true : false; if (data.AssignedFlag == "1" && data.LeadStatus != "00") { cmbLeadStatus.Items.Remove(cmbLeadStatus.Items.FindByValue("00")); //ถ้าจ่ายงานแล้ว และสถานะปัจจุบันไม่ใช่สนใจ ให้เอาสถานะ สนใจ ออก } //เช็กสิทธิการแก้ไขข้อมูล if (txtAssignedFlag.Text.Trim() == "0" || txtDelegateFlag.Text.Trim() == "1") //ยังไม่จ่ายงาน assignedFlag = 0, delegateFlag = 1 { cmbDelegateBranch.Enabled = false; cmbDelegate.Enabled = false; cmbOwnerBranch.Enabled = false; cmbOwner.Enabled = false; lblTab008Info.Text = "ไม่สามารถแก้ไข Owner และ Delegate ได้ เนื่องจากอยู่ระหว่างรอระบบจ่ายงาน กรุณารอ 1 นาที"; } else { AppUtil.CheckOwnerPrivilege(data.Owner, data.Delegate, cmbOwnerBranch, cmbOwner, cmbDelegateBranch, cmbDelegate); } upPopup.Update(); mpePopup.Show(); } else { AppUtil.ClientAlert(Page, "ไม่พบ Ticket Id " + txtTicketID.Text.Trim() + " ในระบบ"); } } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; _log.Debug(message); AppUtil.ClientAlert(Page, message); } }
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); }
// 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); }
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); }