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