protected void Page_Load(object sender, EventArgs e) { if (Session["User"] == null) { Response.Redirect("/"); } txtEmp_id.Enabled = false; if (!this.IsPostBack) { string sql = "SELECT emp_id,CONCAT(emp_name,' ',emp_lname) AS emp_name FROM tbl_emp_profile ep where emp_staus_working = '1' ORDER BY emp_name"; dBScript.GetDownList(txtEmp, sql, "emp_name", "emp_id"); txtEmp.Items.Insert(0, new ListItem("", "")); BindData(); BindDataHis(); string sql_cpoint = "SELECT * FROM tbl_cpoint"; dBScript.GetDownList(txtCpoint, sql_cpoint, "cpoint_name", "cpoint_id"); btnSave.Visible = false; } if (Session["User"] != null) { if (dBScript.Notallow(new string[] { "5", "4", "3" }, Session["UserPrivilegeId"].ToString())) { Response.Redirect("/"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { resultCard.Visible = false; string sql_year = "SELECT * FROM tbl_year"; dbScript.GetDownList(txtYear, sql_year, "year", "year"); string sql_cpoint = "SELECT * FROM tbl_cpoint"; dbScript.GetDownList(txtCpoint, sql_cpoint, "cpoint_name", "cpoint_id"); dbScript.GetDownList(txtSearchCpoint, sql_cpoint, "cpoint_name", "cpoint_id"); txtSearchCpoint.Items.Insert(0, new ListItem("เลือก", "")); string sql_pos = "SELECT * FROM tbl_pos"; dbScript.GetDownList(txtSearchPos, sql_pos, "pos_name", "pos_id"); txtSearchPos.Items.Insert(0, new ListItem("เลือก", "")); string sql_affi = "SELECT * FROM tbl_affiliation"; dbScript.GetDownList(txtSearchAffi, sql_affi, "affi_name", "affi_id"); txtSearchAffi.Items.Insert(0, new ListItem("เลือก", "")); } if (Session["User"] != null) { if (Session["UserPrivilegeId"].ToString() == "5" && Session["emp_login_id"].ToString() != null) { Response.Redirect("/LeaveEmp/empLeaveHistoryForm?empID=" + dbScript.getMd5Hash(Session["emp_login_id"].ToString())); } } }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request.Params["id"])) { txtGuest_id.Value = Request.Params["id"].ToString(); } if (Session["User"] != null) { if (int.Parse(Session["UserPrivilegeId"].ToString()) > 1) { DivAddGuest.Visible = false; btnAddTitleGuest.Visible = false; txtOfferDate.Enabled = false; txtReferTitle.Enabled = false; txtReferDate.Enabled = false; txtRefer.Enabled = false; txtTo.Enabled = false; txtTitle.Enabled = false; } } else { } if (!this.IsPostBack) { BindData(); dBScript.GetDownList(txtProfix, "select * from tbl_profix", "profix_name", "profix_id"); dBScript.GetDownList(txtPos, "select * from tbl_pos", "pos_name", "pos_id"); dBScript.GetDownList(txtCpoint, "select * from tbl_cpoint", "cpoint_name", "cpoint_id"); dBScript.GetDownList(txtAff, "select * from tbl_affiliation", "affi_name", "affi_id"); txtAff.Items.Insert(0, new ListItem("เลือก", "")); if (txtGuest_id.Value.ToString() == "") { DivAddGuest.Visible = false; btnReport.Visible = false; btnReportCopy.Visible = false; } else { string sql_select_guest = "SELECT * FROM tbl_guest guest WHERE guest_id = '" + txtGuest_id.Value + "'"; MySqlDataReader rs = dBScript.selectSQL(sql_select_guest); if (rs.Read()) { txtTitle.Text = rs.GetString("guest_title"); txtTo.Text = rs.GetString("guest_title_to"); txtRefer.Text = rs.GetString("guest_refer"); txtReferDate.Text = rs.GetString("guest_refer_date"); txtReferTitle.Text = rs.GetString("guest_refer_title"); txtOfferDate.Text = rs.GetString("guest_offer_date"); } rs.Close(); dBScript.CloseConnection(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request.Params["add"])) { //Response.Write("<script>$('#ModalCheckEmp').modal('show');</script>"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ModalCheckEmp", "$('#ModalCheckEmp').modal('show');", true); } if (int.Parse(Session["UserPrivilegeId"].ToString()) > 2) { btnAddEmp.Visible = false; } if (!this.IsPostBack) { //getSeclctEmp("emp_name", "ASC"); DivEmp.Visible = false; string sql_cpoint = "SELECT * FROM tbl_cpoint"; dbScript.GetDownList(txtCpoint, sql_cpoint, "cpoint_name", "cpoint_id"); dbScript.GetDownList(txtSearchCpoint, sql_cpoint, "cpoint_name", "cpoint_id"); txtSearchCpoint.Items.Insert(0, new ListItem("เลือก", "")); string sql_pos = "SELECT * FROM tbl_pos"; dbScript.GetDownList(txtPos, sql_pos, "pos_name", "pos_id"); dbScript.GetDownList(txtSearchPos, sql_pos, "pos_name", "pos_id"); txtSearchPos.Items.Insert(0, new ListItem("เลือก", "")); string sql_affi = "SELECT * FROM tbl_affiliation"; dbScript.GetDownList(txtAffi, sql_affi, "affi_name", "affi_id"); dbScript.GetDownList(txtSearchAffi, sql_affi, "affi_name", "affi_id"); txtSearchAffi.Items.Insert(0, new ListItem("เลือก", "")); string sql_EmpType = "SELECT * FROM tbl_type_emp"; dbScript.GetDownList(txtSearchType, sql_EmpType, "type_emp_name", "type_emp_id"); txtSearchType.Items.Insert(0, new ListItem("เลือก", "")); } dbScript.CloseConnection(); if (Session["User"] != null) { if (Session["UserPrivilegeId"].ToString() == "5" && Session["emp_login_id"] != null) { Response.Redirect("/Profile/empForm?empID=" + dbScript.getMd5Hash(Session["emp_login_id"].ToString())); } } if (!string.IsNullOrEmpty(Request.Params["pos"]) && !string.IsNullOrEmpty(Request.Params["cpoint"])) { if (Request.Params["cpoint"] == "60") { txtSearchCpoint.Items.Insert(0, new ListItem("ฝ่ายฯ ทั้งหมด", "60")); } txtSearchPos.SelectedValue = Request.Params["pos"]; txtSearchCpoint.SelectedValue = Request.Params["cpoint"]; DivSearch.Visible = false; DivAdd.Visible = false; getSeclctEmp("emp_name", "ASC"); } }
//ReportDocument rpt = new ReportDocument(); protected void Page_Load(object sender, EventArgs e) { if (Session["User"] == null) { Response.Redirect("/Login/Login"); } if (!this.IsPostBack) { dBScript.GetDownList(pos_id, "SELECT * FROM tbl_pos ORDER BY pos_name ASC", "pos_name", "pos_id"); pos_id.Items.Insert(0, new ListItem("เลือก", "")); dBScript.GetDownList(cpoint_id, "SELECT IF(cpoint_id LIKE '60%','60',cpoint_id) AS cpoint_id1, IF(cpoint_id LIKE '60%','ฝ่ายฯ ',cpoint_name) AS cpoint_name FROM tbl_cpoint GROUP BY cpoint_id1 ORDER BY cpoint_id ASC", "cpoint_name", "cpoint_id1"); cpoint_id.Items.Insert(0, new ListItem("เลือก", "")); GetReport("", ""); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserPrivilegeId"] == null) { Response.Redirect("/"); } if (Session["User"] != null) { if (dBScript.Notallow(new string[] { "5", "4", "3", "2" }, Session["UserPrivilegeId"].ToString())) { Response.Redirect("/"); } } if (!this.IsPostBack) { string sql_privilege = "SELECT * FROM tbl_privilege ORDER BY privilege_name"; dBScript.GetDownList(txtPrivilege, sql_privilege, "privilege_name", "privilege_id"); BindData(); } }