protected void btnDelete_Click(object sender, EventArgs e) { LinkButton ClassID = (LinkButton)sender; TblClassInformation.Delete(ClassID.CommandArgument); lblmsg.Text = helper.DisplayNotificationMessage(msgDiv, "Class has been deleted permanently", "alert alert-danger alert-icon alert-dismissible", icon, "icon mdi mdi-close-circle-o"); BindClass(); }
protected void btnEdit_Click(object sender, EventArgs e) { LinkButton ClassID = (LinkButton)sender; TblClassInformation obj = new TblClassInformation(ClassID.CommandArgument); ddlLevel.SelectedValue = obj.LevelID.ToString(); txtClass.Text = obj.ClassName; hfClassID.Value = ClassID.CommandArgument; lblPopUpHeading.Text = "Update Class"; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); }
protected void btnSave_Click(object sender, EventArgs e) { try { if (helper.ExecutePlainQuery("select * from Tbl_ClassInformation where ClassName='" + txtClass.Text + "' and BranchID=" + Session["BranchID"]).Rows.Count > 0 && String.IsNullOrEmpty(hfClassID.Value)) { lblmsg.Text = helper.DisplayNotificationMessage(msgDiv, txtClass.Text + " already exists!", "alert alert-danger alert-icon alert-dismissible", icon, "icon mdi mdi-check"); } else { string msg = "Class has been added!"; TblClassInformation obj = new TblClassInformation(); obj.IsNew = true; if (!String.IsNullOrEmpty(hfClassID.Value)) { obj.IsNew = false; obj = new TblClassInformation(hfClassID.Value); msg = "Class has been updated!"; } obj.ClassName = txtClass.Text; obj.LevelID = Convert.ToInt32(ddlLevel.SelectedValue); // obj.IsActive = true; if (obj.IsNew) { obj.CreateBy = Session["BranchUserID"].ToString(); } if (ddlLevel.SelectedValue == "1") { obj.AdmissionFee = Convert.ToInt32(txtAdmissionFee.Text); obj.MothlyFee = Convert.ToInt32(txtMOnthlyFee.Text); } obj.BranchID = Convert.ToInt32(Session["BranchID"]); obj.UpdatedBy = Session["BranchUserID"].ToString(); obj.Save(); lblmsg.Text = helper.DisplayNotificationMessage(msgDiv, msg, "alert alert-success alert-icon alert-dismissible", icon, "icon mdi mdi-check"); helper.ClearInputs(Page.Controls); hfClassID.Value = null; lblPopUpHeading.Text = "Add Class"; BindClass(); } } catch (Exception ex) { lblmsg.Text = helper.DisplayNotificationMessage(msgDiv, ex.ToString(), "alert alert-danger alert-icon alert-dismissible", icon, "icon mdi mdi-close-circle-o"); } }