protected void btnSAVE_Click(object sender, EventArgs e) { StdCategoryData dataSave = new StdCategoryData(); dataSave.StdCategory_Code = txtCATEGORY_CODE.Text; dataSave.StdCategory_Short = txtCATEGORY_SHORT.Text; dataSave.StdCategory_Thai = txtCATEGORY_THAINAME.Text; dataSave.StdCategory_Eng = txtCATEGORY_ENGNAME.Text; string result = ""; try { result = new StdCategory().updateStdCategory(dataSave); if (result == "OK") { Response.Redirect("list_Student_Category.aspx"); } else { Response.Redirect("list_Student_Category.aspx"); } } catch (Exception E) { //string response = E.Message.ToString(); //HttpContext.Current.Session["response"] = "Unit Test: " + response; //HttpContext.Current.Response.Redirect("err_response.aspx"); } }
protected void btnSAVE_Click(object sender, EventArgs e) { string sql = "Select * From STUDENT_CATEGORY Where CATEGORY_CODE='" + txtCATEGORY_CODE.Text + "'"; List <StdCategoryData> chkDup = new StdCategory().getStdCategoryManual(sql); if (chkDup.Count > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('รหัสประเภทนักศึกษาซ้ำ!');", true); } else { StdCategoryData data = new StdCategoryData(); data.StdCategory_Code = txtCATEGORY_CODE.Text; data.StdCategory_Short = txtCATEGORY_SHORT.Text; data.StdCategory_Thai = txtCATEGORY_THAINAME.Text; data.StdCategory_Eng = txtCATEGORY_ENGNAME.Text; string result = ""; result = new StdCategory().insertStdCategory(data); if (result == "OK") { Response.Redirect("list_Student_Category.aspx"); } } }
protected void btnOK_Click(object sender, EventArgs e) { try { string result = new StdCategory().deleteStdCategory(code); if (result == "OK") { Response.Redirect("list_Student_Category.aspx"); } else { Response.Redirect("list_Student_Category.aspx"); } } catch { Response.Redirect("list_Student_Category.aspx"); } }