protected void btnAssigntoEmployee_Click(object sender, EventArgs e) { string msg = "Subject has been assigned!"; TblAssignSubject obj = new TblAssignSubject(); obj.IsNew = true; if (!String.IsNullOrEmpty(hfAssignID.Value)) { obj.IsNew = false; obj = new TblAssignSubject(hfAssignID.Value); msg = "Subject assignment has been updated!"; } obj.AssignTo = Convert.ToInt32(ddlEmployees.SelectedValue); obj.Save(); BindGrid(); lblmsg.Text = helper.DisplayNotificationMessage(msgDiv, msg, "alert alert-success alert-icon alert-dismissible", icon, "icon mdi mdi-check"); hfAssignID.Value = null; }
protected void btnEdit_Click(object sender, EventArgs e) { try { LinkButton AssignID = (LinkButton)sender; TblAssignSubject obj = new TblAssignSubject(AssignID.CommandArgument); TblSubject objsub = new TblSubject(obj.AssignID); ddlAcLevel.SelectedValue = obj.LevelID.ToString(); BindAssignemtClass(obj.LevelID.ToString()); ddlAsClass.SelectedValue = obj.ClassID.ToString(); ddlSubjects.SelectedValue = obj.SubjectID.ToString(); txtMarks.Text = obj.TotalMarks.ToString(); hfAssignID.Value = AssignID.CommandArgument; BindGrid(); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); } catch { } }
protected void btnSave_Click(object sender, EventArgs e) { try { if (helper.ExecutePlainQuery("select * from tbl_AssignSubject where ClassID=" + ddlAsClass.SelectedValue + " and SubjectID=" + ddlSubjects.SelectedValue).Rows.Count > 0 && String.IsNullOrEmpty(hfAssignID.Value)) { lblmsg.Text = helper.DisplayNotificationMessage(msgDiv, ddlSubjects.SelectedItem.Text + " already exists!", "alert alert-danger alert-icon alert-dismissible", icon, "icon mdi mdi-check"); } else { string msg = "Subject has been assigned!"; TblAssignSubject obj = new TblAssignSubject(); obj.IsNew = true; if (!String.IsNullOrEmpty(hfAssignID.Value)) { obj.IsNew = false; obj = new TblAssignSubject(hfAssignID.Value); msg = "Subject assignment has been updated!"; } if (obj.IsNew) { obj.AssignTo = -1; } obj.ClassID = Convert.ToInt32(ddlAsClass.SelectedValue); obj.SubjectID = Convert.ToInt32(ddlSubjects.SelectedValue); obj.LevelID = Convert.ToInt16(ddlAcLevel.SelectedValue); obj.TotalMarks = Convert.ToInt32(txtMarks.Text); obj.Save(); lblmsg.Text = helper.DisplayNotificationMessage(msgDiv, msg, "alert alert-success alert-icon alert-dismissible", icon, "icon mdi mdi-check"); hfAssignID.Value = null; } helper.ClearInputs(Page.Controls); BindGrid(); } catch (Exception ex) { lblmsg.Text = helper.DisplayNotificationMessage(msgDiv, ex.ToString(), "alert alert-danger alert-icon alert-dismissible", icon, "icon mdi mdi-close-circle-o"); } }