Пример #1
0
        protected void modUpdateCommand1(Object sender, GridViewUpdateEventArgs e)
        {
            Label   lblStudyID10       = (Label)GridViewStudy.Rows[e.RowIndex].FindControl("lblStudyID10");
            Label   lblStudyUOC_ID10   = (Label)GridViewStudy.Rows[e.RowIndex].FindControl("lblStudyUOC_ID10");
            TextBox txtUNIV_NAME10     = (TextBox)GridViewStudy.Rows[e.RowIndex].FindControl("txtUNIV_NAME10");
            TextBox txtSTART_DATE10    = (TextBox)GridViewStudy.Rows[e.RowIndex].FindControl("txtSTART_DATE10");
            TextBox txtEND_DATE10      = (TextBox)GridViewStudy.Rows[e.RowIndex].FindControl("txtEND_DATE10");
            TextBox txtQUALIFICATION10 = (TextBox)GridViewStudy.Rows[e.RowIndex].FindControl("txtQUALIFICATION10");

            if (txtUNIV_NAME10.Text == "")
            {
                notification.Attributes["class"] = "alert alert_danger"; notification.InnerHtml = ""; notification.InnerHtml += "<div> <img src='Image/Small/red_alert.png' /> กรุณากรอก สถานศึกษา !</div>";
                return;
            }
            else if (txtSTART_DATE10.Text == "" && txtEND_DATE10.Text == "")
            {
                notification.Attributes["class"] = "alert alert_danger"; notification.InnerHtml = ""; notification.InnerHtml += "<div> <img src='Image/Small/red_alert.png' /> กรุณากรอก ตั้งแต่ - ถึง (เดือน ปี) !</div>";
                return;
            }
            else if (txtQUALIFICATION10.Text == "")
            {
                notification.Attributes["class"] = "alert alert_danger"; notification.InnerHtml = ""; notification.InnerHtml += "<div> <img src='Image/Small/red_alert.png' /> กรุณากรอก วุฒิ (สาขาวิชาเอก) !</div>";
                return;
            }
            else if (txtSTART_DATE10.Text != "" && txtEND_DATE10.Text != "")
            {
                DateTime dtEndDate10   = DateTime.Parse(txtEND_DATE10.Text);
                DateTime dtStartDate10 = DateTime.Parse(txtSTART_DATE10.Text);
                int      totalDay      = (int)(dtEndDate10 - dtStartDate10).TotalDays + 1;

                if (totalDay <= 0)
                {
                    notification.Attributes["class"] = "alert alert_danger";
                    notification.InnerHtml           = "";
                    notification.InnerHtml          += "<div> <img src='Image/Small/red_alert.png' /> ตั้งแต่ - ถึง (เดือน ปี) : เดือนไม่ถูกต้อง !</div>";
                    return;
                }
                else
                {
                    notification.Attributes["class"] = "none"; notification.InnerHtml = "";
                }
            }
            else
            {
                notification.Attributes["class"] = "none"; notification.InnerHtml = "";
            }

            PS_STUDY PStudy = new PS_STUDY(Convert.ToInt32(lblStudyID10.Text)
                                           , Convert.ToInt32(lblStudyUOC_ID10.Text)
                                           , txtUNIV_NAME10.Text
                                           , DateTime.Parse(txtSTART_DATE10.Text)
                                           , DateTime.Parse(txtEND_DATE10.Text)
                                           , txtQUALIFICATION10.Text);

            PStudy.UPDATE_PS_STUDY();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('อัพเดทข้อมูลเรียบร้อย')", true);
            GridViewStudy.EditIndex = -1;
            BindData();
        }
Пример #2
0
        protected void modDeleteCommand1(Object sender, GridViewDeleteEventArgs e)
        {
            int      id     = Convert.ToInt32(GridViewStudy.DataKeys[e.RowIndex].Value);
            PS_STUDY PStudy = new PS_STUDY();

            PStudy.STUDY_ID = id;
            PStudy.DELETE_PS_STUDY();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ลบข้อมูลเรียบร้อย')", true);

            GridViewStudy.EditIndex = -1;
            BindData();
        }
Пример #3
0
        void BindData()
        {
            PS_STUDY  PStudy = new PS_STUDY();
            DataTable dt1    = PStudy.SELECT_PS_STUDY("", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()), "", "", "", "");

            GridViewStudy.DataSource = dt1;
            GridViewStudy.DataBind();
            SetViewState(dt1);

            PS_PRO_LICENSE PLicense = new PS_PRO_LICENSE();
            DataTable      dt2      = PLicense.SELECT_PS_PRO_LICENSE("", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()), "", "", "", "");

            GridViewLicense.DataSource = dt2;
            GridViewLicense.DataBind();
            SetViewState(dt2);

            PS_TRAINING Training = new PS_TRAINING();
            DataTable   dt3      = Training.SELECT_PS_TRAINING("", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()), "", "", "", "");

            GridViewTraining.DataSource = dt3;
            GridViewTraining.DataBind();
            SetViewState(dt3);

            PS_PUNISHMENT Punishment = new PS_PUNISHMENT();
            DataTable     dt4        = Punishment.SELECT_PS_PUNISHMENT("", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()), "", "", "");

            GridViewPunish.DataSource = dt4;
            GridViewPunish.DataBind();
            SetViewState(dt4);

            PS_POSI_AND_SALARY PosiSalary = new PS_POSI_AND_SALARY();
            DataTable          dt5        = PosiSalary.SELECT_PS_POSI_AND_SALARY("", MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()), "", "", "", "", "", "", "", "");

            GridViewPosiSalary.DataSource = dt5;
            GridViewPosiSalary.DataBind();
            SetViewState(dt5);
        }
Пример #4
0
        protected void btnSave2_Click(object sender, EventArgs e)
        {
            if (tbStartDate10.Text != "" && tbEndDate10.Text != "")
            {
                DateTime dtEndDate10   = DateTime.Parse(tbEndDate10.Text);
                DateTime dtStartDate10 = DateTime.Parse(tbStartDate10.Text);
                int      totalDay      = (int)(dtEndDate10 - dtStartDate10).TotalDays + 1;

                if (totalDay <= 0)
                {
                    notification.Attributes["class"] = "alert alert_danger";
                    notification.InnerHtml           = "";
                    notification.InnerHtml          += "<div> <img src='Image/Small/red_alert.png' /> วันที่เริ่มโครงการ - วันที่สิ้นสุดโครงการ : เดือนไม่ถูกต้อง !</div>";
                    ScriptManager.GetCurrent(this.Page).SetFocus(this.tbStartDate10);
                    return;
                }
                else
                {
                    notification.Attributes["class"] = "none";
                    notification.InnerHtml           = "";
                }
            }

            PS_STUDY PStudy = new PS_STUDY();

            PStudy.UOC_ID        = Int32.Parse(MyCrypto.GetDecryptedQueryString(Request.QueryString["id"].ToString()));
            PStudy.UNIV_NAME     = tbUnivName10.Text;
            PStudy.START_DATE    = DateTime.Parse(tbStartDate10.Text);
            PStudy.END_DATE      = DateTime.Parse(tbEndDate10.Text);
            PStudy.QUALIFICATION = tbCertificate10.Text;
            PStudy.INSERT_PS_STUDY();

            ClearStudy10();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true);
            BindData();
        }