Exemple #1
0
        protected void GridViewEmp_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            Label lbempStatusDate = (Label)(e.Row.FindControl("lbempStatusDate"));

            if (lbempStatusDate != null)
            {
                lbempStatusDate.Text = dbScript.convertDateShortThai((string)DataBinder.Eval(e.Row.DataItem, "history_date"));
            }

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

            if (btnView != null)
            {
                btnView.CommandArgument = (string)DataBinder.Eval(e.Row.DataItem, "emp_id");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            lbUserOnline.Text = int.Parse(Application["TotalOnlineUsers"].ToString()).ToString(" 0 คน");

            if (!this.IsPostBack)
            {
                string          sql = "SELECT COUNT('id') AS EmpSum FROM tbl_emp_profile WHERE emp_staus_working = '1'";
                MySqlDataReader rs  = dBScript.selectSQL(sql);
                if (rs.Read())
                {
                    lbCountEmp.Text = "ทั้งหมด " + rs.GetString("EmpSum") + " คน";
                }
                rs.Close();
                BindDataLeave();
                BindRetire();
                dBScript.CloseConnection();

                string sql_guest = "SELECT guest_offer_date FROM  tbl_guest ORDER BY STR_TO_DATE(guest_offer_date, '%d-%m-%Y') DESC ";
                LabelGuest.Text = "รายการล่าสุด " + dBScript.convertDateShortThai(dBScript.GetSelectData(sql_guest));

                lbYear.Text  = dBScript.getBudgetYear();
                txtYear.Text = dBScript.getBudgetYear();
            }
            if (Session["User"] != null)
            {
                if (dBScript.Notallow(new string[] { "5" }, Session["UserPrivilegeId"].ToString()))
                {
                    Response.Redirect("/Profile/empViwe");
                }

                if (dBScript.Notallow(new string[] { "5", "4", "3" }, Session["UserPrivilegeId"].ToString()))
                {
                    boxChangPos.Visible   = false;
                    boxMigrateEmp.Visible = false;
                    boxResignEmp.Visible  = false;
                }
            }
        }