Ejemplo n.º 1
0
        protected void modUpdateCommand2(Object sender, GridViewUpdateEventArgs e)
        {
            Label   lblProID11          = (Label)GridViewLicense.Rows[e.RowIndex].FindControl("lblProID11");
            Label   lblProUOC_ID11      = (Label)GridViewLicense.Rows[e.RowIndex].FindControl("lblProUOC_ID11");
            TextBox txtLICENSE_NAME11   = (TextBox)GridViewLicense.Rows[e.RowIndex].FindControl("txtLICENSE_NAME11");
            TextBox txtDEPARTMENT11     = (TextBox)GridViewLicense.Rows[e.RowIndex].FindControl("txtDEPARTMENT11");
            TextBox txtLICENSE_NUMBER11 = (TextBox)GridViewLicense.Rows[e.RowIndex].FindControl("txtLICENSE_NUMBER11");
            TextBox txtSTART_DATE11     = (TextBox)GridViewLicense.Rows[e.RowIndex].FindControl("txtSTART_DATE11");

            if (txtLICENSE_NAME11.Text == "")
            {
                notification.Attributes["class"] = "alert alert_danger"; notification.InnerHtml = ""; notification.InnerHtml += "<div> <img src='Image/Small/red_alert.png' /> กรุณากรอก ชื่อใบอนุญาต !</div>";
                return;
            }
            else if (txtDEPARTMENT11.Text == "")
            {
                notification.Attributes["class"] = "alert alert_danger"; notification.InnerHtml = ""; notification.InnerHtml += "<div> <img src='Image/Small/red_alert.png' /> กรุณากรอก หน่วยงาน !</div>";
                return;
            }
            else if (txtLICENSE_NUMBER11.Text == "")
            {
                notification.Attributes["class"] = "alert alert_danger"; notification.InnerHtml = ""; notification.InnerHtml += "<div> <img src='Image/Small/red_alert.png' /> กรุณากรอก เลขที่ใบอนุญาต !</div>";
                return;
            }
            else if (txtSTART_DATE11.Text == "")
            {
                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 = "";
            }

            PS_PRO_LICENSE PStudy = new PS_PRO_LICENSE(Convert.ToInt32(lblProID11.Text)
                                                       , Convert.ToInt32(lblProUOC_ID11.Text)
                                                       , txtLICENSE_NAME11.Text
                                                       , txtDEPARTMENT11.Text
                                                       , txtLICENSE_NUMBER11.Text
                                                       , DateTime.Parse(txtSTART_DATE11.Text));

            PStudy.UPDATE_PS_PRO_LICENSE();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('อัพเดทข้อมูลเรียบร้อย')", true);
            GridViewLicense.EditIndex = -1;
            BindData();
        }