protected void lbAdvanceSearch_Click(object sender, EventArgs e) { try { if (pnAdvanceSearch.Style["display"] == "" || pnAdvanceSearch.Style["display"] == "none") { lbAdvanceSearch.Text = "[-] <b>Advance Search</b>"; pnAdvanceSearch.Style["display"] = "block"; txtAdvanceSearch.Text = "Y"; } else { lbAdvanceSearch.Text = "[+] <b>Advance Search</b>"; pnAdvanceSearch.Style["display"] = "none"; txtAdvanceSearch.Text = "N"; } StaffBiz.SetCollapse(HttpContext.Current.User.Identity.Name, txtAdvanceSearch.Text.Trim() == "N" ? true : false); } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; _log.Error(message); AppUtil.ClientAlert(Page, message); } }
protected void cmbHeadBranchCode_SelectedIndexChanged(object sender, EventArgs e) { try { cmbHeadStaffId.DataSource = StaffBiz.GetHeadStaffList(cmbHeadBranchCode.SelectedItem.Value); cmbHeadStaffId.DataTextField = "TextField"; cmbHeadStaffId.DataValueField = "ValueField"; cmbHeadStaffId.DataBind(); cmbHeadStaffId.Items.Insert(0, new ListItem("", "")); if (cmbHeadBranchCode.SelectedItem.Value != "") { lblHeadStaffId.Text = "*"; cmbHeadStaffId.Enabled = true; } else { vcmbHeadStaffId.Text = ""; lblHeadStaffId.Text = ""; cmbHeadStaffId.Enabled = false; } } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; AppUtil.ClientAlert(Page, message); } }
private void cmbDelegateBranchSelectedIndexChanged(string owner = null) { try { //Delegate Lead // List<ControlListData> source = StaffBiz.GetStaffAllDataByAccessRight(cmbCampaignId.SelectedItem.Value, cmbDelegateBranch.SelectedItem.Value); List <ControlListData> source = StaffBiz.GetStaffAllDataNotDummyByAccessRight(cmbCampaignId.SelectedItem.Value, cmbDelegateBranch.SelectedItem.Value, owner); //คำนวณงานในมือ AppUtil.CalculateAmountJobOnHandForDropdownlist(cmbDelegateBranch.SelectedItem.Value, source); AppUtil.BuildCombo(cmbDelegateLead, source); if (cmbDelegateBranch.SelectedItem.Value != string.Empty) { cmbDelegateLead.Enabled = true; } else { cmbDelegateLead.Enabled = false; } } catch { throw; } }
protected void btnCheckUsername_Click(object sender, EventArgs e) { try { if (txtUserName.Text.Trim() != string.Empty) { vtxtUserName.Text = ""; if (StaffBiz.CheckUsernameExist(txtUserName.Text.Trim(), null)) { vtxtUserName.Text = "Windows Username นี้มีอยู่แล้วในระบบแล้ว"; vtxtUserName.ForeColor = System.Drawing.Color.Red; } else { vtxtUserName.Text = "Windows Username ใช้งานได้"; vtxtUserName.ForeColor = System.Drawing.Color.Green; } } else { vtxtUserName.Text = ""; } } catch (Exception ex) { AppUtil.ClientAlert(Page, ex.InnerException != null ? ex.InnerException.Message : ex.Message); } }
public static string GetRecursiveTeam(string username) { List <string> teamList = new List <string>(); List <StaffData> staffList = StaffBiz.GetStaffList(); var logInStaffId = staffList.Where(p => p.UserName.Trim().ToUpper() == username.Trim().ToUpper()).Select(p => p.StaffId).FirstOrDefault(); var logInCocTeam = staffList.Where(p => p.UserName.Trim().ToUpper() == username.Trim().ToUpper()).Select(p => p.CocTeam).FirstOrDefault(); if (logInStaffId != null) { if (!string.IsNullOrEmpty(logInCocTeam) && logInCocTeam.Trim().ToUpper().StartsWith("COC")) { teamList.Add(logInCocTeam); } FindTeamRecusive(logInStaffId, teamList, staffList); } string tmpList = ""; foreach (string team in teamList) { tmpList += (tmpList == "" ? "" : ",") + "'" + team + "'"; } return(tmpList); }
private bool CheckTicketIdPrivilege(string ticketId) { decimal?staffTypeId = StaffBiz.GetStaffType(HttpContext.Current.User.Identity.Name); string staff_type_id = staffTypeId != null?staffTypeId.Value.ToString() : ""; string username = HttpContext.Current.User.Identity.Name; if (!RoleBiz.CheckTicketIdPrivilege(ticketId, username, AppUtil.GetRecursiveStaff(username), AppUtil.GetRecursiveTeam(username), staff_type_id)) { string message = "ข้อมูลผู้มุ่งหวังรายนี้ ท่านไม่มีสิทธิในการมองเห็น"; string lastOwnerName = LeadBiz.GetLastOwnerName(ticketId); if (!string.IsNullOrEmpty(lastOwnerName)) { message += " ณ ปัจจุบันผู้เป็นเจ้าของ คือ " + lastOwnerName.ToString().Trim(); } AppUtil.ClientAlertAndRedirect(Page, message, "COC_SCR_002.aspx"); return(false); } else { return(true); } }
private void cmbDelegateBranchSelectedIndexChanged() { try { //Delegate Lead List <ControlListData> source = StaffBiz.GetStaffAllDataByAccessRight(txtCampaignId.Text.Trim(), cmbDelegateBranch.SelectedItem.Value); AppUtil.CalculateAmountJobOnHandForDropdownlist(cmbDelegateBranch.SelectedItem.Value, source); cmbDelegate.DataSource = source; cmbDelegate.DataTextField = "TextField"; cmbDelegate.DataValueField = "ValueField"; cmbDelegate.DataBind(); cmbDelegate.Items.Insert(0, new ListItem("", "")); if (cmbDelegateBranch.SelectedItem.Value != string.Empty) { cmbDelegate.Enabled = true; } else { cmbDelegate.Enabled = false; } } catch (Exception ex) { throw ex; } }
public static string GetRecursiveStaff(string username) { string userList = ""; ArrayList arrlist = new ArrayList(); List <StaffData> staffList = StaffBiz.GetStaffList(); var logInStaffId = staffList.Where(p => p.UserName.Trim().ToUpper() == username.Trim().ToUpper()).Select(p => p.StaffId).FirstOrDefault(); var logInEmpCode = staffList.Where(p => p.UserName.Trim().ToUpper() == username.Trim().ToUpper()).Select(p => p.EmpCode).FirstOrDefault(); if (logInStaffId != null) { if (!string.IsNullOrEmpty(logInEmpCode)) { arrlist.Add("'" + logInEmpCode + "'"); } FindStaffRecusive(logInStaffId, arrlist, staffList); } foreach (string empCode in arrlist) { userList += (userList == "" ? "" : ",") + empCode; } return(userList); }
private void BindDelegateLead() { cmbDelegateLeadSearch.DataSource = StaffBiz.GetStaffNotDummyList(cmbDelegateBranchSearch.SelectedItem.Value); cmbDelegateLeadSearch.DataTextField = "TextField"; cmbDelegateLeadSearch.DataValueField = "ValueField"; cmbDelegateLeadSearch.DataBind(); cmbDelegateLeadSearch.Items.Insert(0, new ListItem("", "")); }
//private string SetDept() //{ // decimal? stafftype = SlmScr019Biz.GetStaffTypeData(HttpContext.Current.User.Identity.Name); // if (stafftype != null) // { // if (stafftype == SLMConstant.StaffType.ITAdministrator) // return "IT"; // else // { // int? dept = SlmScr019Biz.GetDeptData(HttpContext.Current.User.Identity.Name); // return dept.ToString(); // } // } // else // return ""; //} private void cmbHeadBranchCode_SelectedIndexChanged() { cmbHeadStaffId.DataSource = StaffBiz.GetHeadStaffList(cmbHeadBranchCode.SelectedItem.Value); cmbHeadStaffId.DataTextField = "TextField"; cmbHeadStaffId.DataValueField = "ValueField"; cmbHeadStaffId.DataBind(); cmbHeadStaffId.Items.Insert(0, new ListItem("", "")); }
private void BindCreateByLead() { cmbCreatebySearch.DataSource = StaffBiz.GetStaffList(cmbCreatebyBranchSearch.SelectedItem.Value); //SlmScr003Biz.GetStaffAllData(cmbCreatebyBranchSearch.SelectedItem.Value); cmbCreatebySearch.DataTextField = "TextField"; cmbCreatebySearch.DataValueField = "ValueField"; cmbCreatebySearch.DataBind(); cmbCreatebySearch.Items.Insert(0, new ListItem("", "")); }
private void BindOwnerLead() { cmbOwner.DataSource = StaffBiz.GetStaffList(cmbOwnerBranch.SelectedItem.Value); cmbOwner.DataTextField = "TextField"; cmbOwner.DataValueField = "ValueField"; cmbOwner.DataBind(); cmbOwner.Items.Insert(0, new ListItem("", "")); }
private void BindOwnerLead() { // cmbOwnerLeadSearch.DataSource = StaffBiz.GetStaffList(cmbOwnerBranchSearch.SelectedItem.Value); //SlmScr003Biz.GetStaffAllData(cmbOwnerBranchSearch.SelectedItem.Value); cmbOwnerLeadSearch.DataSource = StaffBiz.GetStaffNotDummyList(cmbOwnerBranchSearch.SelectedItem.Value); //SlmScr003Biz.GetStaffAllData(cmbOwnerBranchSearch.SelectedItem.Value); cmbOwnerLeadSearch.DataTextField = "TextField"; cmbOwnerLeadSearch.DataValueField = "ValueField"; cmbOwnerLeadSearch.DataBind(); cmbOwnerLeadSearch.Items.Insert(0, new ListItem("", "")); }
protected void btnSave_Click(object sender, EventArgs e) { try { if (ValidateData()) { StaffDataManagement data = new StaffDataManagement(); data.Username = txtUserName.Text.Trim(); data.EmpCode = txtEmpCode.Text.Trim(); data.MarketingCode = txtMarketingCode.Text.Trim(); data.StaffNameTH = txtStaffNameTH.Text.Trim(); data.TelNo = txtTellNo.Text.Trim(); data.StaffEmail = txtStaffEmail.Text.Trim(); data.PositionId = cmbPosition.SelectedItem.Value; data.StaffTypeId = decimal.Parse(cmbStaffType.SelectedItem.Value); data.Team = txtTeam.Text.Trim(); data.BranchCode = cmbBranchCode.SelectedItem.Value; if (cmbHeadStaffId.Items.Count > 0) { if (!string.IsNullOrEmpty(cmbHeadStaffId.SelectedItem.Value)) { data.HeadStaffId = int.Parse(cmbHeadStaffId.SelectedItem.Value); } } if (cmbDepartment.Items.Count > 0) { if (!string.IsNullOrEmpty(cmbDepartment.SelectedItem.Value)) { data.DepartmentId = int.Parse(cmbDepartment.SelectedItem.Value); } } if (cmbCocTeam.Items.Count > 0) { if (!string.IsNullOrEmpty(cmbCocTeam.SelectedItem.Value)) { data.CocTeam = cmbCocTeam.SelectedItem.Value; } } string staffId = StaffBiz.InsertStaff(data, HttpContext.Current.User.Identity.Name); Session[coc_staffid] = staffId; AppUtil.ClientAlertAndRedirect(Page, "บันทึกข้อมูลเจ้าหน้าที่สำเร็จ", "COC_SCR_007.aspx"); } else { AppUtil.ClientAlert(Page, "กรุณาระบุข้อมูลให้ครบถ้วน"); } } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; _log.Debug(message); AppUtil.ClientAlert(Page, message); } }
private void GetStaffByTeam(string cocTeam) { cmbTransferee.DataSource = StaffBiz.GetStaffByTeam(cocTeam); cmbTransferee.DataTextField = "TextField"; cmbTransferee.DataValueField = "ValueField"; cmbTransferee.DataBind(); cmbTransferee.Items.Remove(cmbTransferee.Items.FindByValue(txtEmpCode.Text.Trim())); cmbTransferee.Items.Insert(0, new ListItem("", "")); btnTransferJob.Enabled = cmbTransferee.Items.Count > 0 ? true : false; }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { //เก็บไว้ส่งไปที่ Adam, AolSummaryReport StaffData staff = SlmScr003Biz.GetStaff(HttpContext.Current.User.Identity.Name); txtEmpCode.Text = staff.EmpCode; txtStaffTypeId.Text = staff.StaffTypeId != null?staff.StaffTypeId.ToString() : ""; txtStaffTypeDesc.Text = staff.StaffTypeDesc; txtStaffId.Text = staff.StaffId.ToString(); txtStaffBranchCode.Text = staff.BranchCode; //Set AdvanceSearch if (staff.Collapse == null || staff.Collapse == true) { lbAdvanceSearch.Text = "[+] <b>Advance Search</b>"; pnAdvanceSearch.Style["display"] = "none"; txtAdvanceSearch.Text = "N"; } else { lbAdvanceSearch.Text = "[-] <b>Advance Search</b>"; pnAdvanceSearch.Style["display"] = "block"; txtAdvanceSearch.Text = "Y"; } InitialControl(); if (Session[searchcondition] != null) { SetSerachCondition((SearchLeadCondition)Session[searchcondition]); //Page Load กลับมาจากหน้าอื่น Session[searchcondition] = null; } //else // DoSearchLeadData(0, string.Empty, SortDirection.Ascending); //First Load ครั้งแรก StaffData Staff = StaffBiz.GetDefaultSearch(HttpContext.Current.User.Identity.Name); if (Staff != null) { ViewState["SearchDefault"] = Staff.DefaultSearch; } } } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; _log.Debug(message); AppUtil.ClientAlert(Page, message); } }
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { try { LoginUserData staffData = StaffBiz.GetLoginUserData(Login1.UserName.Trim()); if (staffData != null) //if (staffData != null && IsAuthenticated(Login1.UserName.Trim(), Login1.Password.Trim())) { Guid sessionId = Guid.NewGuid(); LoginBiz.InsertSession(Login1.UserName.Trim(), sessionId); FormsAuthenticationTicket ticket = new FormsAuthenticationTicket( 1, Login1.UserName.Trim(), DateTime.Now, DateTime.Now.AddMinutes(FormsAuthentication.Timeout.TotalMinutes), Login1.RememberMeSet, staffData != null ? staffData.StaffNameTH + "|" + staffData.BranchName + "|" + sessionId.ToString() : _displayName + "|" + "", FormsAuthentication.FormsCookiePath); string encTicket = FormsAuthentication.Encrypt(ticket); Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket)); //Response.Redirect(FormsAuthentication.GetRedirectUrl(Login1.UserName, Login1.RememberMeSet), false); InsertLoginLog(true, ""); if (Request["ticketid"] != null && Request["accflag"] == "email") { Response.Redirect("COC_SCR_003.aspx?ticketid=" + Request["ticketid"], false); } else { Response.Redirect(FormsAuthentication.DefaultUrl, false); } } else { InsertLoginLog(false, "Logon failure: unknown user name or bad password."); _log.Debug("Logon failure: unknown user name or bad password."); AppUtil.ClientAlert(Page, "Logon failure: unknown user name or bad password."); } } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; InsertLoginLog(false, message); _log.Debug("(" + Login1.UserName + ") " + message); AppUtil.ClientAlert(Page, "Logon failure: unknown user name or bad password."); } }
private void cmbHeadBranchCode_SelectedIndexChanged() { var list = StaffBiz.GetHeadStaffList(cmbHeadBranchCode.SelectedItem.Value); var editedStaff = list.Where(p => p.ValueField == txtStaffId.Text.Trim()).FirstOrDefault(); list.Remove(editedStaff); cmbHeadStaffId.DataSource = list; cmbHeadStaffId.DataTextField = "TextField"; cmbHeadStaffId.DataValueField = "ValueField"; cmbHeadStaffId.DataBind(); cmbHeadStaffId.Items.Insert(0, new ListItem("", "")); }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { ScreenPrivilegeData priData = RoleBiz.GetScreenPrivilege(HttpContext.Current.User.Identity.Name, "COC_SCR_003"); if (priData == null || priData.IsView != 1) { AppUtil.ClientAlertAndRedirect(Page, "คุณไม่มีสิทธิ์เข้าใช้หน้าจอนี้", "COC_SCR_002.aspx"); return; } if (Request["ticketid"] != null && Request["ticketid"].ToString().Trim() != string.Empty) { txtTicketID.Text = Request["ticketid"].ToString(); if (!CheckTicketIdPrivilege(txtTicketID.Text.Trim())) { return; } ((Label)Page.Master.FindControl("lblTopic")).Text = "แสดงข้อมูล Lead: " + txtTicketID.Text.Trim() + " (View)"; StaffData staff = StaffBiz.GetStaffInfo(HttpContext.Current.User.Identity.Name); if (staff != null) { txtUserLoginChannelId.Text = staff.ChannelId; } GetLeadData(); tabExistingLead.GetExistingLeadList(txtCitizenId.Text.Trim(), txtTelNo1.Text.Trim()); tabExistingProduct.GetExistingProductList(txtCitizenId.Text.Trim()); tabOwnerLogging.GetOwnerLogingList(txtTicketID.Text.Trim()); tabPhoneCallHistory.InitialControl(lead); tabNoteHistory.InitialControl(lead); upTabMain.Update(); } else { AppUtil.ClientAlertAndRedirect(Page, "Ticket Id not found", "COC_SCR_002.aspx"); } } } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; _log.Debug(message); AppUtil.ClientAlertAndRedirect(Page, message, "COC_SCR_002.aspx"); } }
private void InitialControl() { //Search // cmbProductSearch.DataSource = ProductBiz.GetProductList(); cmbProductSearch.DataSource = ProductBiz.GetProductListNew(); cmbProductSearch.DataTextField = "TextField"; cmbProductSearch.DataValueField = "ValueField"; cmbProductSearch.DataBind(); cmbProductSearch.Items.Insert(0, new ListItem("", "")); //cmbCampaignSearch.DataSource = CampaignBiz.GetCampaignList(""); cmbCampaignSearch.DataSource = CampaignBiz.GetCampaignListNew(""); cmbCampaignSearch.DataTextField = "TextField"; cmbCampaignSearch.DataValueField = "ValueField"; cmbCampaignSearch.DataBind(); cmbCampaignSearch.Items.Insert(0, new ListItem("", "")); cmbBranchSearch.DataSource = BranchBiz.GetBranchList(SLMConstant.Branch.All); cmbBranchSearch.DataTextField = "TextField"; cmbBranchSearch.DataValueField = "ValueField"; cmbBranchSearch.DataBind(); cmbBranchSearch.Items.Insert(0, new ListItem("", "")); cmbStaffTypeSearch.DataSource = StaffBiz.GetStaffTypeAllList(); cmbStaffTypeSearch.DataTextField = "TextField"; cmbStaffTypeSearch.DataValueField = "ValueField"; cmbStaffTypeSearch.DataBind(); cmbStaffTypeSearch.Items.Insert(0, new ListItem("", "")); //Popup // cmbProductPopup.DataSource = ProductBiz.GetProductList(); cmbProductPopup.DataSource = ProductBiz.GetProductListNew(); cmbProductPopup.DataTextField = "TextField"; cmbProductPopup.DataValueField = "ValueField"; cmbProductPopup.DataBind(); cmbProductPopup.Items.Insert(0, new ListItem("", "")); //cmbCampaignPopup.DataSource = CampaignBiz.GetCampaignList(""); cmbCampaignPopup.DataSource = CampaignBiz.GetCampaignListNew(""); cmbCampaignPopup.DataTextField = "TextField"; cmbCampaignPopup.DataValueField = "ValueField"; cmbCampaignPopup.DataBind(); cmbCampaignPopup.Items.Insert(0, new ListItem("", "")); cmbStaffTypePopup.DataSource = StaffBiz.GetStaffTypeAllList(); cmbStaffTypePopup.DataTextField = "TextField"; cmbStaffTypePopup.DataValueField = "ValueField"; cmbStaffTypePopup.DataBind(); cmbStaffTypePopup.Items.Insert(0, new ListItem("", "")); }
protected void btnTransferJob_Click(object sender, EventArgs e) { try { var status = StaffBiz.GetStaffStatus(txtUsername.Text.Trim()); if (status == 1) { AppUtil.ClientAlert(Page, "ไม่สามารถโอนงานได้ เนื่องจากพนักงานยังมีสถานะพร้อมรับงานอยู่"); return; } if (cmbTransferee.SelectedItem.Value == "") { AppUtil.ClientAlert(Page, "กรุณาเลือกพนักงานที่จะโอนงานให้"); return; } List <string> ticketIdList = new List <string>(); foreach (GridViewRow row in gvJobOnHand.Rows) { if (((CheckBox)row.FindControl("cbTranserJob")).Checked) { ticketIdList.Add(((Label)row.FindControl("lblTicketId")).Text.Trim()); } } if (ticketIdList.Count > 0) { LeadBiz.TransferJob(ticketIdList, cmbTransferee.SelectedItem.Value, txtCurrentCocTeam.Text.Trim(), HttpContext.Current.User.Identity.Name); List <LeadDataPopupMonitoring> mainList = DoGetJobOnHandList(); BindJobOnHandGridview((COC.Application.Shared.GridviewPageController)pcJobOnHand, mainList.ToArray(), 0); upJobOnHand.Update(); AppUtil.ClientAlert(Page, "โอนงานเรียบร้อย"); } else { AppUtil.ClientAlert(Page, "กรุณาเลือกงานที่ต้องการโอน"); } } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; _log.Debug(message); AppUtil.ClientAlert(Page, message); } }
private void DoSearchData(int pageIndex) { try { List <StaffDataManagement> list = StaffBiz.SearchStaffList(txtUsernameSearch.Text.Trim(), cmbBranchSearch.SelectedItem.Value, txtEmpCodeSearch.Text.Trim(), txtMarketingCodeSearch.Text.Trim() , txtStaffNameTHSearch.Text.Trim(), cmbPositionSearch.SelectedItem.Value, cmbStaffTypeSearch.SelectedItem.Value, txtTeamSearch.Text.Trim(), cmbDepartmentSearch.SelectedItem.Value, cmbCOCTeamSearch.SelectedItem.Value); BindGridview((COC.Application.Shared.GridviewPageController)pcTop, list.ToArray(), pageIndex); pcTop.Visible = true; upResult.Update(); } catch (Exception ex) { throw ex; } }
protected void cmbBranchCode_SelectedIndexChanged(object sender, EventArgs e) { try { cmbHeadStaffId.DataSource = StaffBiz.GetStaffHeadList(cmbBranchCode.SelectedItem.Value); cmbHeadStaffId.DataTextField = "TextField"; cmbHeadStaffId.DataValueField = "ValueField"; cmbHeadStaffId.DataBind(); cmbHeadStaffId.Items.Insert(0, new ListItem("", "")); } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; AppUtil.ClientAlert(Page, message); } }
private void SetAvailableButton() { string status = StaffBiz.GetActiveStatusByAvailableConfig(txtUsername.Text.Trim()); if (status == "0") { SetUnavailable(); } else if (status == "1") { SetAvailable(); } else { HideStatusDetail(); } }
private void GetCurrentStatus() { string status = StaffBiz.GetCurrentStatus(txtUsername.Text.Trim()); if (status == string.Empty) { HideStatusDetail(); } else if (status == "1") { SetAvailable(); } else { SetUnavailable(); } }
private void cmbOwnerBranchSelectedIndexChanged(string userName = null) { try { //Owner Lead List <ControlListData> source = null; if (cmbOwnerBranch.SelectedItem != null) { if (cmbCampaignId.SelectedItem.Value == "") { // source = StaffBiz.GetStaffList(cmbOwnerBranch.SelectedItem.Value); //SlmScr010Biz.GetStaffAllData(cmbOwnerBranch.SelectedItem.Value); source = StaffBiz.GetStaffNotDummyList(cmbOwnerBranch.SelectedItem.Value); } else { // source = StaffBiz.GetStaffAllDataByAccessRight(cmbCampaignId.SelectedItem.Value, cmbOwnerBranch.SelectedItem.Value); source = StaffBiz.GetStaffAllDataNotDummyByAccessRight(cmbCampaignId.SelectedItem.Value, cmbOwnerBranch.SelectedItem.Value, userName); } //คำนวณงานในมือ AppUtil.CalculateAmountJobOnHandForDropdownlist(cmbOwnerBranch.SelectedItem.Value, source); AppUtil.BuildCombo(cmbOwner, source); if (cmbOwnerBranch.SelectedItem.Value != string.Empty) { cmbOwner.Enabled = true; } else { cmbOwner.Enabled = false; } } else { cmbOwner.Items.Clear(); cmbOwner.Enabled = false; } } catch (Exception ex) { throw ex; } }
private void SetDept() { decimal?stafftype = StaffBiz.GetStaffType(HttpContext.Current.User.Identity.Name); if (stafftype != null) { if (stafftype == COCConstant.StaffType.ITAdministrator) { cmbDepartment.Enabled = true; } else { cmbDepartment.Enabled = false; int?dept = StaffBiz.GetDepartmentId(HttpContext.Current.User.Identity.Name); if (dept != null) { cmbDepartment.SelectedIndex = cmbDepartment.Items.IndexOf(cmbDepartment.Items.FindByValue(dept.ToString())); } } } }
private void InitialControl() { ////Role cmbStaffTypeSearch.DataSource = StaffBiz.GetStaffTyeList(); cmbStaffTypeSearch.DataTextField = "TextField"; cmbStaffTypeSearch.DataValueField = "ValueField"; cmbStaffTypeSearch.DataBind(); cmbStaffTypeSearch.Items.Insert(0, new ListItem("", "")); ////Market Branch cmbBranchSearch.DataSource = BranchBiz.GetBranchList(); cmbBranchSearch.DataTextField = "TextField"; cmbBranchSearch.DataValueField = "ValueField"; cmbBranchSearch.DataBind(); cmbBranchSearch.Items.Insert(0, new ListItem("", "")); ////Department cmbDepartmentSearch.DataSource = DepartmentBiz.GetDepartmentList(); cmbDepartmentSearch.DataTextField = "TextField"; cmbDepartmentSearch.DataValueField = "ValueField"; cmbDepartmentSearch.DataBind(); cmbDepartmentSearch.Items.Insert(0, new ListItem("", "")); ////COC Team cmbCOCTeamSearch.DataSource = StaffBiz.GetTeamList(); cmbCOCTeamSearch.DataTextField = "TextField"; cmbCOCTeamSearch.DataValueField = "ValueField"; cmbCOCTeamSearch.DataBind(); cmbCOCTeamSearch.Items.Insert(0, new ListItem("", "")); //Position cmbPositionSearch.DataSource = PositionBiz.GetPositionList(COCConstant.Position.All); cmbPositionSearch.DataTextField = "TextField"; cmbPositionSearch.DataValueField = "ValueField"; cmbPositionSearch.DataBind(); cmbPositionSearch.Items.Insert(0, new ListItem("", "")); upSearch.Update(); }
private void InitialControl() { //Role cmbStaffType.DataSource = StaffBiz.GetStaffTyeList(); cmbStaffType.DataTextField = "TextField"; cmbStaffType.DataValueField = "ValueField"; cmbStaffType.DataBind(); cmbStaffType.Items.Insert(0, new ListItem("", "")); //Market Branch cmbBranchCode.DataSource = BranchBiz.GetBranchList(); cmbBranchCode.DataTextField = "TextField"; cmbBranchCode.DataValueField = "ValueField"; cmbBranchCode.DataBind(); cmbBranchCode.Items.Insert(0, new ListItem("", "")); //Department cmbDepartment.DataSource = DepartmentBiz.GetDepartmentList(); cmbDepartment.DataTextField = "TextField"; cmbDepartment.DataValueField = "ValueField"; cmbDepartment.DataBind(); cmbDepartment.Items.Insert(0, new ListItem("", "")); ////COC Team cmbCocTeam.DataSource = StaffBiz.GetTeamList(); cmbCocTeam.DataTextField = "TextField"; cmbCocTeam.DataValueField = "ValueField"; cmbCocTeam.DataBind(); cmbCocTeam.Items.Insert(0, new ListItem("", "")); //Position cmbPosition.DataSource = PositionBiz.GetPositionList(COCConstant.Position.Active); cmbPosition.DataTextField = "TextField"; cmbPosition.DataValueField = "ValueField"; cmbPosition.DataBind(); cmbPosition.Items.Insert(0, new ListItem("", "")); }
private bool ValidateInput() { int i = 0; int nameAbbMaxLength = 100; int nameENMaxlength = 500; int nameTHMaxlength = 500; if (txtPositionNameAbb.Text.Trim() == "") { alertPositionNameAbb.Text = "กรุณาระบุ ชื่อย่อ"; i += 1; } else { if (txtPositionNameAbb.Text.Trim().Length > nameAbbMaxLength) { alertPositionNameAbb.Text = "กรุณาระบุ ชื่อย่อไม่เกิน " + nameAbbMaxLength.ToString() + " ตัวอักษร"; i += 1; } else alertPositionNameAbb.Text = ""; } if (txtPositionNameEN.Text.Trim() != "" && txtPositionNameEN.Text.Trim().Length > nameENMaxlength) { alertPositionNameEN.Text = "กรุณาระบุ ชื่อเต็มไม่เกิน " + nameENMaxlength.ToString() + " ตัวอักษร"; i += 1; } else alertPositionNameEN.Text = ""; if (txtPositionNameTH.Text.Trim() == "") { alertPositionNameTH.Text = "กรุณาระบุ ชื่อตำแหน่ง"; i += 1; } else { if (txtPositionNameTH.Text.Trim().Length > nameTHMaxlength) { alertPositionNameTH.Text = "กรุณาระบุ ชื่อตำแหน่งไม่เกิน " + nameTHMaxlength.ToString() + " ตัวอักษร"; i += 1; } else alertPositionNameTH.Text = ""; } if (txtPositionId.Text.Trim() != "" && rbInActive.Checked) { if (StaffBiz.CheckEmployeeInPosition(int.Parse(txtPositionId.Text.Trim()))) { alertStatus.Text = "ไม่สามารถยกเลิกการใช้งานได้ เนื่องจากยังมีพนักงานอยู่ในตำแหน่ง"; i += 1; } else alertStatus.Text = ""; } else alertStatus.Text = ""; return i > 0 ? false : true; }