示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DateTime today = DateTime.Today;
        //  ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect", "alert('คุณยังไม่ลงเวลาปฏิบัติงาน') window.location = '"+ Request.ApplicationPath + "/Page/index_doctor.aspx';", true);


        int id = Convert.ToInt32(Session["doc_id"]);

        int day = today.Day;

        if (day >= 17 && day < 20)
        {
            schedule_work_doctor2 month = schedule_work_doctor2.show_swd_doc();
            if (month != null)
            {
                string swd_month = month.swd_month_work;
                string check     = schedule_work_doctor2.check_register_swd(swd_month, id);
                if (check == "1")
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect",
                                                        "alert('คุณยังไม่ลงเวลาปฏิบัติงาน'); window.location='" +
                                                        Request.ApplicationPath + "../Page/Schedule_register.aspx';", true);
                }
            }
        }
    }
示例#2
0
    public static schedule_work_doctor2 show_swd_doc()
    {
        string query = string.Format("select swd_month_work from schedule_work_doctor Order by swd_id DESC");

        try
        {
            conn.Open();
            command.CommandText = query;
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                string month_th = reader.GetString(0);


                schedule_work_doctor2 app = new schedule_work_doctor2(month_th);
                return(app);
            }
        }
        finally
        {
            conn.Close();
        }
        return(null);
    }