protected void btSave_Click(object sender, EventArgs e) { if (btSave.Text == "Save") { IncidentCategoryClass obj = new IncidentCategoryClass(); obj.IncidentCategoryName = tbIncidentCategoryName.Text; obj.IsActive = cbIsActive.Checked; MEMBERS.SQLReturnValue mRes; obj.Flag = "ADD"; mRes = IncidentCategoryClass.Insert_Update_IncidentCategory(obj); ScriptManager.RegisterStartupScript(this, this.GetType(), "noti", "setMessage('<b>" + mRes.MessageFromSQL + "</b>',1);", true); } else if (btSave.Text == "Edit") { IncidentCategoryClass obj = new IncidentCategoryClass(); obj.IncidentCategoryName = tbIncidentCategoryName.Text; obj.IsActive = cbIsActive.Checked; MEMBERS.SQLReturnValue mRes; obj.Flag = "EDIT"; obj.IncidentCategoryIDP = Int64.Parse(hfIncidentCategoryIDP.Value); mRes = IncidentCategoryClass.Insert_Update_IncidentCategory(obj); btSave.Text = "Save"; ScriptManager.RegisterStartupScript(this, this.GetType(), "noti", "setMessage('<b>" + mRes.MessageFromSQL + "</b>',1);", true); } ClearControls(); BindData(); }
protected void btSave_Click(object sender, EventArgs e) { IncidentCategoryClass obj = new IncidentCategoryClass(); obj.IncidentCategoryName = tbIncidentCategoryName.Text; obj.IsActive = cbIsActive.Checked; MEMBERS.SQLReturnValue mRes; if (hfID.Value == string.Empty) { obj.Flag = "ADD"; mRes = IncidentCategoryClass.Insert_Update_IncidentCategory(obj); } else { obj.Flag = "EDIT"; obj.IncidentCategoryIDP = Int64.Parse(hfID.Value); mRes = IncidentCategoryClass.Insert_Update_IncidentCategory(obj); } ScriptManager.RegisterStartupScript(this, this.GetType(), "noti", "setMessage('<b>" + mRes.MessageFromSQL + "</b>',1);", true); ClearControls(); BindData(); pnC.Visible = false; pnG.Visible = true; btAddNew.Visible = true; }