private void GetMarks() { site = new DBSite(); ExamMarksBll eBll = new ExamMarksBll(); try { int studentId = -1; if (txtSearch.Text.Length > 0) { studentId = int.Parse(txtSearch.Text); } List <ExamMarksBll.ExamMarksEntity> marksList = eBll.GetExamMarks(site, int.Parse(ddlClass.SelectedValue), int.Parse(ddlSection.SelectedValue), int.Parse(ddlExam.SelectedValue), ddlSubject.SelectedValue.ToString(), studentId, isNewExamMarksEntry); total_records = marksList.Count; gridView1.DataSource = marksList; gridView1.DataBind(); } catch (Exception exception) { util.HandleExpception(exception, Response); } finally { site.Close(); } }
protected void btnDelete_Click(object sender, EventArgs e) { site = new DBSite(); StudentBll stBll = new StudentBll(); List <string> student_id_list = new List <string>(); try { foreach (GridViewRow gr in gridView1.Rows) { CheckBox cb = (CheckBox)gr.Cells[0].FindControl("myCheckBox"); if (cb.Checked) { //if (stBll.IsStudentPresentInAttendance(site, util.CheckNullInt(gr.Cells[2].Text))) //{ // lblError.Text = "Can't Delete Record:'" + gr.Cells[4].Text + "' This Student is being entered in Attendance Entry."; // lblError.Visible = true; // ClearSuccessMessage(); // return; //} student_id_list.Add(gr.Cells[3].Text); } } if (student_id_list.Count < 1) { lblError.Text = "Can't Delete Records. Select at least one Record "; lblError.Visible = true; ClearSuccessMessage(); return; } string st_ids = util.ConvertListToCommaSeparatedString(student_id_list); site.BeginTrans(); stBll.DeleteStudent(site, st_ids); site.Commit(); lblMessage.Text = " [ " + student_id_list.Count + "] Record Deleted "; lblMessage.Visible = true; ClearErrorMessage(); } catch (Exception del_exception) { site.RollBack(); util.HandleExpception(del_exception, Response); } finally { site.Close(); } GetStudents(); }
private void GetExams() { exmBll = new ExamMasterBll(); site = new DBSite(); try { List <ExamMasterBll.ExamMasterEntity> examList = exmBll.GetExamList(site, Util_BLL.User.UserId); total_records = examList.Count; gridView1.DataSource = examList; gridView1.DataBind(); } catch (Exception exception) { util.HandleExpception(exception, Response); } finally { site.Close(); } }
protected void gridView1_SelectedIndexChanged(object sender, EventArgs e) { ClearAll(); edit_mode = true; GridViewRow row = gridView1.SelectedRow; lblStudentMasterId.Text = row.Cells[3].Text; StudentBll sBll = new StudentBll(); site = new DBSite(); try { //StudentBll.StudenEntity st = sBll.GetStudents(site, util.CheckNullInt(lblStudentMasterId.Text))[0]; StudentBll.StudenEntity st = sBll.GetStudents(site, lblStudentMasterId.Text)[0]; txtStudentName.Text = st.StudentName; txtAdmNo.Text = st.AdmNo; ddlPresentClass.SelectedValue = util.CheckNull(st.PresentClass); txtIdCardNo.Text = st.IdCardNo; txtMotherName.Text = st.MotherName; txtFatherName.Text = st.FatherName; txtMobileNoF.Text = st.MobileNoF; txtMobileNoM.Text = st.MobileNoM; txtDOB.Text = st.DOB; } catch (Exception exception) { util.HandleExpception(exception, Response); // throw; } finally { site.Close(); } }
private void GetAttendance(bool onlyAbsentees) { site = new DBSite(); AttendanceBll aBll = new AttendanceBll(); aBll.ProcessMachineAttendance(site, int.Parse(ddlYear.SelectedValue), int.Parse(ddlMonth.SelectedValue), int.Parse(ddlDay.SelectedValue), 0); try { List <AttendanceBll.AttendanceEntity> attdlist = aBll.GetAttendance(site, int.Parse(ddlYear.SelectedValue), int.Parse(ddlMonth.SelectedValue), int.Parse(ddlDay.SelectedValue), int.Parse(ddlClass.SelectedValue), onlyAbsentees); total_records = attdlist.Count; gridView1.DataSource = attdlist; gridView1.DataBind(); } catch (Exception exception) { util.HandleExpception(exception, Response); } finally { site.Close(); } }
protected void SaveStudent() { StudentBll st_bll = null; st_bll = new StudentBll(); StudentBll.StudenEntity student = new StudentBll.StudenEntity(); try { site = new DBSite(); site.BeginTrans(); student.StudentName = txtStudentName.Text; student.AdmNo = txtAdmNo.Text; student.PresentClass = util.CheckNullInt(ddlPresentClass.SelectedValue); student.SectionId = util.CheckNullInt(ddlSection.SelectedValue); student.IdCardNo = txtIdCardNo.Text; student.FatherName = txtFatherName.Text; student.MotherName = txtMotherName.Text; student.MobileNoF = txtMobileNoF.Text; student.MobileNoM = txtMobileNoM.Text; student.DOB = txtDOB.Text; if (txtMobileNoF.Text.Length != 10) { lblError.Text = "Mobile Number should be of 10 digits"; lblError.Visible = true; txtMobileNoF.Focus(); ClearSuccessMessage(); return; } student.Email = txtDOB.Text; string message = ""; if (this.lblStudentMasterId.Text == "New") { //if (IsDuplicateCardNo(site, student.IdCardNo, -1)) //{ // txtIdCardNo.Focus(); // isErr = true; // return; //} st_bll.SaveStudent(site, student); message = " Successfully Added !"; } else { student.StudentMasterId = util.CheckNullInt(lblStudentMasterId.Text); //if (IsDuplicateCardNo(site, student.IdCardNo, student.StudentMasterId)) //{ // txtIdCardNo.Focus(); // isErr = true; // return; //} st_bll.UpdateStudent(site, student); message = " Successfully Updated !"; } site.Commit(); lblMessage.Text = message; lblMessage.Visible = true; isErr = false; ClearErrorMessage(); } catch (Exception ex) { site.RollBack(); util.HandleExpception(ex, Response); } finally { site.Close(); } }
void SaveExam() { exmBll = new ExamMasterBll(); ExamMasterBll.ExamMasterEntity exam = new ExamMasterBll.ExamMasterEntity(); try { string message = ""; exam.ExamName = this.txtExamName.Text; exam.ExamCode = this.txtExamCode.Text; exam.ExamDate = util.CheckNullDate(DateTime.Today); exam.ClassMasterID = util.CheckNullInt(ddlClass.SelectedValue); exam.SectionMasterID = util.CheckNullInt(ddlSection.SelectedValue); exam.TermId = util.CheckNullInt(ddlTerm.SelectedValue); exam.MaxMarks = util.CheckNullInt(txtMaxMarks.Text); exam.PassMarks = util.CheckNullInt(txtPassMarks.Text); exam.ExamOrder = util.CheckNullInt(txtExamOrder.Text); site = new DBSite(); // save or updare site.BeginTrans(); if (lblExamMasterId.Text == "New") { exmBll.SaveExam(site, exam); message = "\t '" + exam.ExamName + "' Successfully Added !"; } else { exam.ExamMasterId = util.CheckNullInt(lblExamMasterId.Text); exmBll.UpdateExam(site, exam); message = "\t '" + exam.ExamName + "' Successfully Updated !"; } site.Commit(); lblMessage.Text = message; lblMessage.Visible = true; ClearErrorMessage(); } catch (Exception ex) { site.RollBack(); if (ex.Message.Contains("UNQ_ExamName")) { lblMessage.Text = "\t '" + exam.ExamName + "' is already present !"; lblMessage.Visible = true; } else { util.HandleExpception(ex, Response); } } finally { site.Close(); } }