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");
            }
        }
        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()));
                }
            }
        }
Beispiel #3
0
        protected void btnLoginEmp_Click(object sender, EventArgs e)
        {
            MsgBox("");
            string          sql = "SELECT * FROM tbl_emp_profile WHERE emp_id_card ='" + txtLoginIDCard.Text.Trim() + "' AND emp_staus_working = '1' ORDER BY id DESC";
            MySqlDataReader rs  = dBScript.selectSQL(sql);

            if (rs.Read())
            {
                if (!rs.IsDBNull(0))
                {
                    // Storee Session
                    Session.Add("User", txtUser.Text);
                    Session.Add("UserName", rs.GetString("emp_name") + " " + rs.GetString("emp_lname"));
                    Session.Add("UserPrivilegeId", "5");
                    Session.Add("UserPrivilege", "Employee");
                    Session.Add("emp_login_id", rs.GetString("emp_id"));
                    Session.Timeout = 60;

                    //Page.ClientScript.RegisterStartupScript(Page.GetType(), "Message Box", "<script language = 'javascript'>alert('dd')</script>");
                    //dBScript.userLoginUpdate(txtUser.Text);
                    Response.Redirect("/Profile/empForm?empID=" + dBScript.getMd5Hash(rs.GetString("emp_id")));
                }
                else
                {
                    MsgBox("ไม่พบข้อมูลในระบบ ลองใหม่อีกครั้ง");
                }
            }
            else
            {
                MsgBox("ไม่พบข้อมูลในระบบ ลองใหม่อีกครั้ง");
            }
        }
Beispiel #4
0
        protected void GridViewGuestList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            Label lbGueatName = (Label)(e.Row.FindControl("lbGueatName"));

            if (lbGueatName != null)
            {
                lbGueatName.Text = DataBinder.Eval(e.Row.DataItem, "profix_name").ToString() + DataBinder.Eval(e.Row.DataItem, "guest_list_name").ToString() + " " + DataBinder.Eval(e.Row.DataItem, "guest_list_lname").ToString();
            }

            Label lbGuestPos = (Label)(e.Row.FindControl("lbGuestPos"));

            if (lbGuestPos != null)
            {
                lbGuestPos.Text = DataBinder.Eval(e.Row.DataItem, "pos_name").ToString();
            }

            Label lbGuestCpoint = (Label)(e.Row.FindControl("lbGuestCpoint"));

            if (lbGuestCpoint != null)
            {
                lbGuestCpoint.Text = DataBinder.Eval(e.Row.DataItem, "cpoint_name").ToString();
            }

            HyperLink LabelAddEmp = (HyperLink)(e.Row.FindControl("LabelAddEmp"));

            if (LabelAddEmp != null)
            {
                LabelAddEmp.Text = "รายงานตัวเรียบร้อยแล้ว";
            }

            LinkButton btnAddEmp = (LinkButton)(e.Row.FindControl("btnAddEmp"));

            if (btnAddEmp != null)
            {
                btnAddEmp.CommandName = DataBinder.Eval(e.Row.DataItem, "guest_list_id").ToString();
                if (DataBinder.Eval(e.Row.DataItem, "guest_list_idcard").ToString() != "")
                {
                    btnAddEmp.Visible       = false;
                    LabelAddEmp.NavigateUrl = "/Profile/empForm?empID=" + dBScript.getMd5Hash(dBScript.getEmpDataIDCard("emp_id", DataBinder.Eval(e.Row.DataItem, "guest_list_idcard").ToString()));
                }
                else
                {
                    DateTime date;
                    date = dBScript.DateCalculationK(DataBinder.Eval(e.Row.DataItem, "guest_offer_date").ToString(), 5);

                    if (DateTime.Now.Date <= date.Date.AddDays(5))
                    {
                        LabelAddEmp.Visible = false;
                        btnAddEmp.Visible   = true;
                    }
                    else
                    {
                        if (int.Parse(Session["UserPrivilegeId"].ToString()) > 1)
                        {
                            LabelAddEmp.Visible  = true;
                            LabelAddEmp.Text     = "ไม่มารายงานตัว";
                            LabelAddEmp.CssClass = "badge badge-danger";
                            btnAddEmp.Visible    = false;
                        }
                        else
                        {
                            //LabelAddEmp.Visible = false;
                            LabelAddEmp.Visible  = true;
                            LabelAddEmp.Text     = "เกินกำหนด";
                            LabelAddEmp.CssClass = "badge badge-danger";
                        }
                    }
                }
            }
        }
Beispiel #5
0
 protected void btnView_Command(object sender, CommandEventArgs e)
 {
     Response.Redirect("/Profile/empForm?empID=" + dbScript.getMd5Hash(e.CommandArgument.ToString()) + "&view=true");
 }