예제 #1
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;
            }
        }
예제 #2
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();
            }
        }
예제 #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;
            }
        }