Ejemplo n.º 1
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                StaffDataManagement staff = new StaffDataManagement();
                if (txtEmpCodePopup.Text.Trim() != "")
                {
                    //staff = SlmScr018Biz.GetStaffDataByEmpcode(txtEmpCodePopup.Text.Trim(), SetDept());

                    staff = SlmScr018Biz.GetStaffDataByEmpcode(txtEmpCodePopup.Text.Trim(), "");

                    if (staff != null)
                    {
                        txtStaffId.Text = staff.StaffId.ToString();
                        //txtEmpCodePopup.Text = staff.EmpCode;
                        txtUsernamePopup.Text = staff.Username;
                        txtMarketingCode.Text = staff.MarketingCode;
                        txtStaffNameTH.Text   = staff.StaffNameTH;
                        txtTellNo.Text        = staff.TelNo;
                        txtStaffEmail.Text    = staff.StaffEmail;

                        if (!string.IsNullOrEmpty(staff.UserType))
                        {
                            if (staff.UserType.ToUpper() == "I")
                            {
                                rbnUserTypeIndividual.Checked = true;
                                rbnUserTypeGroup.Checked      = false;
                            }
                            else if (staff.UserType.ToUpper() == "G")
                            {
                                rbnUserTypeGroup.Checked      = true;
                                rbnUserTypeIndividual.Checked = false;
                            }
                            else if (staff.UserType == null)
                            {
                                rbnUserTypeIndividual.Checked = false;
                                rbnUserTypeGroup.Checked      = false;
                            }
                            rbnUserTypeIndividual.Enabled = false;
                            rbnUserTypeGroup.Enabled      = false;
                        }

                        if (staff.PositionId != null)
                        {
                            cmbPosition.SelectedIndex = cmbPosition.Items.IndexOf(cmbPosition.Items.FindByValue(staff.PositionId.ToString()));
                        }

                        if (staff.StaffTypeId != null)
                        {
                            cmbStaffType.SelectedIndex = cmbStaffType.Items.IndexOf(cmbStaffType.Items.FindByValue(staff.StaffTypeId.ToString()));
                        }

                        txtTeam.Text = staff.Team;
                        cmbBranchCode.SelectedIndex = cmbBranchCode.Items.IndexOf(cmbBranchCode.Items.FindByValue(staff.BranchCode));

                        if (staff.HeadStaffId != null)
                        {
                            string branchCode = StaffBiz.GetBranchCode(staff.HeadStaffId.Value);
                            if (!string.IsNullOrEmpty(branchCode))
                            {
                                ListItem item = cmbHeadBranchCode.Items.FindByValue(branchCode);
                                if (item != null)
                                {
                                    cmbHeadBranchCode.SelectedIndex = cmbHeadBranchCode.Items.IndexOf(item);
                                }
                                else
                                {
                                    //Branch ที่ถูกปิด
                                    string branchName = BranchBiz.GetBranchName(branchCode);
                                    if (!string.IsNullOrEmpty(branchName))
                                    {
                                        cmbHeadBranchCode.Items.Insert(1, new ListItem(branchName, branchCode));
                                        cmbHeadBranchCode.SelectedIndex = 1;
                                    }
                                }
                            }

                            cmbHeadBranchCode_SelectedIndexChanged();
                            cmbHeadStaffId.SelectedIndex = cmbHeadStaffId.Items.IndexOf(cmbHeadStaffId.Items.FindByValue(staff.HeadStaffId.ToString()));
                        }

                        if (staff.DepartmentId != null)
                        {
                            cmbDepartment.SelectedIndex = cmbDepartment.Items.IndexOf(cmbDepartment.Items.FindByValue(staff.DepartmentId.ToString()));
                        }
                        else
                        {
                            cmbDepartment.SelectedIndex = -1;
                        }

                        if (staff.Is_Deleted != null)
                        {
                            if (staff.Is_Deleted == 0)
                            {
                                rdNormal.Checked = true;
                            }
                            else if (staff.Is_Deleted == 1)
                            {
                                rdRetire.Checked = true;
                            }
                            else
                            {
                                rdNormal.Checked = false;
                                rdRetire.Checked = false;
                            }
                        }
                    }
                    else
                    {
                        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;
                        rbnUserTypeIndividual.Checked = false;
                        rbnUserTypeGroup.Checked      = false;
                        rbnUserTypeIndividual.Enabled = false;
                        rbnUserTypeGroup.Enabled      = false;
                        AppUtil.ClientAlert(Page, "ไม่พบข้อมูลพนักงานเจ้าหน้าที่");
                    }
                }
                else
                {
                    AppUtil.ClientAlert(Page, "กรุณาระบุรหัสพนักงานธนาคาร");
                }
                upPopup.Update();
                mpePopupTransfer.Show();
            }
            catch (Exception ex)
            {
                string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                AppUtil.ClientAlert(Page, message);
                mpePopupTransfer.Show();
            }
        }
Ejemplo n.º 2
0
        private void LoadStaffData()
        {
            try
            {
                StaffDataManagement staff = new StaffDataManagement();
                if (txtStaffId.Text.Trim() != "")
                {
                    staff = SlmScr018Biz.GetStaffData(int.Parse(txtStaffId.Text.Trim()));
                }

                if (staff != null)
                {
                    txtUsername.Text = staff.Username;
                    lblUsername.Text = staff.Username;

                    if (!string.IsNullOrEmpty(staff.UserType))
                    {
                        if (staff.UserType.ToUpper() == "I")
                        {
                            rbnUserTypeIndividual.Checked = true;
                        }
                        else if (staff.UserType.ToUpper() == "G")
                        {
                            rbnUserTypeGroup.Checked = true;
                        }
                    }
                    rbnUserTypeIndividual.Enabled = false;
                    rbnUserTypeGroup.Enabled      = false;

                    txtEmpCode.Text       = staff.EmpCode;
                    txtEmpCodeOld.Value   = staff.EmpCode;
                    txtMarketingCode.Text = staff.MarketingCode;
                    chkMarketing.Checked  = staff.IsMarketing;
                    txtStaffNameTH.Text   = staff.StaffNameTH;
                    txtTellNo.Text        = staff.TelNo;
                    txtTellNo2.Text       = staff.TelNo2;
                    txtTellNo3.Text       = staff.TelNo3;
                    txtStaffEmail.Text    = staff.StaffEmail;
                    //txtInternalPhone.Text = staff.InternalPhone;
                    if (staff.PositionId != null)
                    {
                        cmbPosition.SelectedIndex = cmbPosition.Items.IndexOf(cmbPosition.Items.FindByValue(staff.PositionId.ToString()));
                    }
                    if (staff.StaffTypeId != null)
                    {
                        cmbStaffType.SelectedIndex = cmbStaffType.Items.IndexOf(cmbStaffType.Items.FindByValue(staff.StaffTypeId.ToString()));
                    }
                    if (staff.RoleServiceId != null)
                    {
                        cmbRoleService.SelectedIndex = cmbRoleService.Items.IndexOf(cmbRoleService.Items.FindByValue(staff.RoleServiceId.ToString()));
                    }

                    txtTeam.Text = staff.Team;

                    if (!string.IsNullOrEmpty(staff.BranchCode))
                    {
                        ListItem item = cmbBranchCode.Items.FindByValue(staff.BranchCode);
                        if (item != null)
                        {
                            cmbBranchCode.SelectedIndex = cmbBranchCode.Items.IndexOf(item);
                        }
                        else
                        {
                            //Branch ที่ถูกปิด
                            string branchName = BranchBiz.GetBranchName(staff.BranchCode);
                            if (!string.IsNullOrEmpty(branchName))
                            {
                                cmbBranchCode.Items.Insert(1, new ListItem(branchName, staff.BranchCode));
                                cmbBranchCode.SelectedIndex = 1;
                            }
                        }
                    }

                    txtOldBranchCode.Text = staff.BranchCode;

                    if (staff.HeadStaffId != null)
                    {
                        string branchCode = StaffBiz.GetBranchCode(staff.HeadStaffId.Value);
                        if (!string.IsNullOrEmpty(branchCode))
                        {
                            ListItem item = cmbHeadBranchCode.Items.FindByValue(branchCode);
                            if (item != null)
                            {
                                cmbHeadBranchCode.SelectedIndex = cmbHeadBranchCode.Items.IndexOf(item);
                            }
                            else
                            {
                                //Branch ที่ถูกปิด
                                string branchName = BranchBiz.GetBranchName(branchCode);
                                if (!string.IsNullOrEmpty(branchName))
                                {
                                    cmbHeadBranchCode.Items.Insert(1, new ListItem(branchName, branchCode));
                                    cmbHeadBranchCode.SelectedIndex = 1;
                                }
                            }
                        }

                        cmbHeadBranchCode_SelectedIndexChanged();

                        cmbHeadStaffId.SelectedIndex = cmbHeadStaffId.Items.IndexOf(cmbHeadStaffId.Items.FindByValue(staff.HeadStaffId.Value.ToString()));
                        cmbHeadStaffId.Enabled       = true;
                        lblHeadStaffId.Text          = "*";
                    }

                    if (staff.DepartmentId != null)
                    {
                        cmbDepartment.SelectedIndex = cmbDepartment.Items.IndexOf(cmbDepartment.Items.FindByValue(staff.DepartmentId.ToString()));
                    }

                    if (staff.Is_Deleted != null)
                    {
                        txtOldIsDeleted.Text = staff.Is_Deleted.ToString();
                        txtNewIsDeleted.Text = staff.Is_Deleted.ToString();
                        if (staff.Is_Deleted == 0)
                        {
                            rdNormal.Checked = true;
                        }
                        else if (staff.Is_Deleted == 1)
                        {
                            rdRetire.Checked = true;
                        }
                        else
                        {
                            rdNormal.Checked = false;
                            rdRetire.Checked = false;
                        }
                    }

                    // level
                    if (staff.Level != null)
                    {
                        AppUtil.SetComboValue(cmbLevel, staff.Level.ToString());
                    }

                    // ประเภทพนักงาน
                    if (staff.Category != null)
                    {
                        AppUtil.SetComboValue(cmbCategory, staff.Category.ToString());
                    }
                    SetHostVisible();

                    // ชื่อบริษัท
                    if (staff.Host != null)
                    {
                        AppUtil.SetComboValue(cmbHost, staff.Host.ToString());
                    }

                    // ทีม Telesale
                    if (staff.TeamTelesale != null)
                    {
                        AppUtil.SetComboValue(cmbTeamTelesale, staff.TeamTelesale.ToString());
                    }


                    // load license data
                    gvLicense.DataSource = SlmScr018Biz.GetLicenseInfo(staff.EmpCode);
                    gvLicense.DataBind();
                }
                upInfo.Update();
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 3
0
        private void LoadStaffData()
        {
            try
            {
                StaffDataManagement staff = new StaffDataManagement();
                if (txtStaffId.Text.Trim() != "")
                {
                    staff = SlmScr018Biz.GetStaffData(int.Parse(txtStaffId.Text.Trim()));
                }

                if (staff != null)
                {
                    txtUsername.Text      = staff.Username;
                    lblUsername.Text      = staff.Username;
                    txtEmpCode.Text       = staff.EmpCode;
                    txtMarketingCode.Text = staff.MarketingCode;
                    txtStaffNameTH.Text   = staff.StaffNameTH;
                    txtTellNo.Text        = staff.TelNo;
                    txtStaffEmail.Text    = staff.StaffEmail;
                    if (staff.PositionId != null)
                    {
                        cmbPosition.SelectedIndex = cmbPosition.Items.IndexOf(cmbPosition.Items.FindByValue(staff.PositionId.ToString()));
                    }
                    if (staff.StaffTypeId != null)
                    {
                        cmbStaffType.SelectedIndex = cmbStaffType.Items.IndexOf(cmbStaffType.Items.FindByValue(staff.StaffTypeId.ToString()));
                    }

                    txtTeam.Text = staff.Team;

                    if (!string.IsNullOrEmpty(staff.BranchCode))
                    {
                        ListItem item = cmbBranchCode.Items.FindByValue(staff.BranchCode);
                        if (item != null)
                        {
                            cmbBranchCode.SelectedIndex = cmbBranchCode.Items.IndexOf(item);
                        }
                        else
                        {
                            //Branch ที่ถูกปิด
                            string branchName = BranchBiz.GetBranchName(staff.BranchCode);
                            if (!string.IsNullOrEmpty(branchName))
                            {
                                cmbBranchCode.Items.Insert(1, new ListItem(branchName, staff.BranchCode));
                                cmbBranchCode.SelectedIndex = 1;
                            }
                        }
                    }

                    txtOldBranchCode.Text = staff.BranchCode;

                    if (staff.HeadStaffId != null)
                    {
                        string branchCode = StaffBiz.GetBranchCode(staff.HeadStaffId.Value);
                        if (!string.IsNullOrEmpty(branchCode))
                        {
                            ListItem item = cmbHeadBranchCode.Items.FindByValue(branchCode);
                            if (item != null)
                            {
                                cmbHeadBranchCode.SelectedIndex = cmbHeadBranchCode.Items.IndexOf(item);
                            }
                            else
                            {
                                //Branch ที่ถูกปิด
                                string branchName = BranchBiz.GetBranchName(branchCode);
                                if (!string.IsNullOrEmpty(branchName))
                                {
                                    cmbHeadBranchCode.Items.Insert(1, new ListItem(branchName, branchCode));
                                    cmbHeadBranchCode.SelectedIndex = 1;
                                }
                            }
                        }

                        cmbHeadBranchCode_SelectedIndexChanged();

                        cmbHeadStaffId.SelectedIndex = cmbHeadStaffId.Items.IndexOf(cmbHeadStaffId.Items.FindByValue(staff.HeadStaffId.Value.ToString()));
                        cmbHeadStaffId.Enabled       = true;
                        lblHeadStaffId.Text          = "*";
                    }

                    if (staff.DepartmentId != null)
                    {
                        cmbDepartment.SelectedIndex = cmbDepartment.Items.IndexOf(cmbDepartment.Items.FindByValue(staff.DepartmentId.ToString()));
                    }

                    if (staff.Is_Deleted != null)
                    {
                        txtOldIsDeleted.Text = staff.Is_Deleted.ToString();
                        txtNewIsDeleted.Text = staff.Is_Deleted.ToString();
                        if (staff.Is_Deleted == 0)
                        {
                            rdNormal.Checked = true;
                        }
                        else if (staff.Is_Deleted == 1)
                        {
                            rdRetire.Checked = true;
                        }
                        else
                        {
                            rdNormal.Checked = false;
                            rdRetire.Checked = false;
                        }
                    }
                }
                upInfo.Update();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
        public void SetLeadData(LeadData lead, bool isnew, bool iscopy = false)
        {
            // setdata
            if (lead.TitleId != null)
            {
                cmbTitle.SelectedIndex = cmbTitle.Items.IndexOf(cmbTitle.Items.FindByValue(lead.TitleId.Value.ToString()));
            }
            txtName.Text              = lead.Name;
            txtLastName.Text          = lead.LastName;
            txtslm_TicketId.Text      = lead.TicketId;
            txtTelNo_1.Text           = lead.TelNo_1;
            txtTelNo2.Text            = lead.TelNo_2;
            txtContactFirstDate.Text  = lead.ContactFirstDate == null ? "" : GetDateTimeString(lead.ContactFirstDate.Value);
            txtContactLatestDate.Text = lead.ContactLatestDate == null ? "" : GetDateTimeString(lead.ContactLatestDate.Value);
            txtAssignDate.Text        = lead.AssignedDateView == null ? "" : GetDateTimeString(lead.AssignedDateView.Value);
            txtCreateDate.Text        = lead.LeadCreateDate == null ? "" : GetDateString(lead.LeadCreateDate.Value);
            txtCreateTime.Text        = lead.LeadCreateDate == null ? "" : lead.LeadCreateDate.Value.ToString("HH:mm:ss");
            txtCreateBy.Text          = lead.LeadCreateBy;
            txtAssignFlag.Text        = lead.AssignedFlag;
            txtDelegateFlag.Text      = lead.Delegate_Flag != null?lead.Delegate_Flag.ToString() : "";

            if (!iscopy)
            {
                txtOldOwner.Text = lead.Owner;
            }
            txtTicketIdRefer.Text = lead.TicketIdRefer;

            AppUtil.SetComboValue(cmbStatus, lead.Status);
            AppUtil.SetComboValue(cmbCampaignId, lead.CampaignId);
            SetComboOwnerBranch();
            AppUtil.SetComboValue(cmbChannelId, lead.ChannelId);
            AppUtil.SetComboValue(cmbOwnerBranch, lead.Owner_Branch);
            cmbOwnerBranchSelectedIndexChanged(lead.Owner == "" ? null : lead.Owner);
            AppUtil.SetComboValue(cmbOwner, lead.Owner);


            if (isnew)
            {
                return;
            }

            // delegate branch/lead
            if (!string.IsNullOrEmpty(lead.Delegate_Branch))
            {
                ListItem item = cmbDelegateBranch.Items.FindByValue(lead.Delegate_Branch);
                if (item != null)
                {
                    cmbDelegateBranch.SelectedIndex = cmbDelegateBranch.Items.IndexOf(item);
                }
                else
                {
                    //check ว่ามีการกำหนด Brach ใน Table kkslm_ms_Access_Right ไหม ถ้ามีจะเท่ากับเป็น Branch ที่ถูกปิด ถ้าไม่มีแปลว่าไม่มีการเซตการมองเห็น
                    if (SlmScr011Biz.CheckBranchAccessRightExist(SLMConstant.Branch.All, cmbCampaignId.SelectedItem.Value, lead.Delegate_Branch))
                    {
                        //Branch ที่ถูกปิด
                        string branchName = BranchBiz.GetBranchName(lead.Delegate_Branch);
                        if (!string.IsNullOrEmpty(branchName))
                        {
                            cmbDelegateBranch.Items.Insert(1, new ListItem(branchName, lead.Delegate_Branch));
                            cmbDelegateBranch.SelectedIndex = 1;
                        }
                    }
                }

                cmbDelegateBranchSelectedIndexChanged(lead.Delegate);    //Bind Combo Delegate
            }

            if (!string.IsNullOrEmpty(lead.Delegate))
            {
                txtoldDelegate.Text           = lead.Delegate;
                cmbDelegateLead.SelectedIndex = cmbDelegateLead.Items.IndexOf(cmbDelegateLead.Items.FindByValue(lead.Delegate));
            }



            if (lead.AssignedFlag == "0" || lead.Delegate_Flag == 1)   //ยังไม่จ่ายงาน assignedFlag = 0, delegateFlag = 1
            {
                cmbDelegateBranch.Enabled = false;
                cmbDelegateLead.Enabled   = false;
                cmbOwnerBranch.Enabled    = false;
                cmbOwner.Enabled          = false;
                lblAlert.Text             = "ไม่สามารถแก้ไข Owner และ Delegate ได้ เนื่องจากอยู่ระหว่างรอระบบจ่ายงาน กรุณารอ 1 นาที";
            }
            else
            {
                AppUtil.CheckOwnerPrivilege(lead.Owner, lead.Delegate, cmbOwnerBranch, cmbOwner, cmbDelegateBranch, cmbDelegateLead);
            }
        }