Esempio n. 1
0
        protected void dgUpdate_Intake(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            Label   rowIntakeID  = (Label)e.Item.Cells[0].FindControl("txtID");
            TextBox txtTempMonth = (TextBox)e.Item.Cells[1].FindControl("txtMonth");

            if (txtTempMonth.Text.Trim() == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script type='text/javascript'>swal('Error!', 'Please fill in the intake information first!', 'error')</script>'");
            }
            else
            {
                Intake intake = new Intake();
                if (intake.Update(rowIntakeID.Text, txtTempMonth.Text) == false)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script type='text/javascript'>swal('Error!', 'This intake " + txtTempMonth.Text + " is existed already, try another month', 'error')</script>'");
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Success", "<script type='text/javascript'>swal({title: 'Updated!', text: 'This " + txtTempMonth.Text + " intake is updated successfully', type : 'success', confirmButtonText : 'OK'}, function (isConfirm) { if (isConfirm) { window.location.href = 'cpIntake.aspx'; }});</script>'");
                }
            }
        }