protected void grdStudent_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         if (Request.QueryString["classId"] != null)
         {
             //Update Marks Query
             classId = Convert.ToInt32(Request.QueryString["classId"]);
             examId  = Convert.ToInt32(Request.QueryString["examId"]);
             TextBox     txtRemarksUpdate    = e.Row.FindControl("txtRemarks") as TextBox;
             TextBox     txtAttendanceUpdate = e.Row.FindControl("txtAttendance") as TextBox;
             int         studentId           = ((StudentCL)e.Row.DataItem).id;
             MiscEntryCL miscUpdate          = reportBLL.viewMiscByStudentId(studentId, examId);
             if (miscUpdate.remarks == "NULL")
             {
                 txtRemarksUpdate.Text = string.Empty;
             }
             else
             {
                 txtRemarksUpdate.Text = miscUpdate.remarks;
             }
             if (miscUpdate.attendance == "NULL")
             {
                 txtAttendanceUpdate.Text = string.Empty;
             }
             else
             {
                 txtAttendanceUpdate.Text = miscUpdate.attendance;
             }
         }
     }
 }
        public MiscEntryCL viewMiscByStudentId(int studentId, int examId)
        {
            MiscEntryCL miscEntry   = new MiscEntryCL();
            MiscEntry   queryMiscDB = (from x in dbcontext.MiscEntries where x.ExaminationId == examId && x.StudentId == studentId && x.IsDeleted == false select x).FirstOrDefault();

            if (queryMiscDB == null)
            {
                miscEntry.attendance = string.Empty;
                miscEntry.remarks    = string.Empty;
            }
            else
            {
                miscEntry.attendance = queryMiscDB.Attendance;
                miscEntry.remarks    = queryMiscDB.Remarks;
            }
            return(miscEntry);
        }
Example #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!Request.IsAuthenticated)
         {
             FormsAuthentication.RedirectToLoginPage();
         }
         else
         {
             if (Session["sessionId"] == null)
             {
                 Response.Redirect("../index.aspx");
             }
             else
             {
                 sessionId = Convert.ToInt32(Session["sessionId"]);
                 int       studentId = 0;
                 StudentCL studentCL = new StudentCL();
                 studentId = Convert.ToInt32(Request.QueryString["studentId"]);
                 if (studentId != 0)
                 {
                     studentId = Convert.ToInt32(Request.QueryString["studentId"]);
                     studentCL = studentBLL.viewStudentById(studentId, sessionId);
                 }
                 else
                 {
                     studentId = Convert.ToInt32(Request.QueryString["admNo"]);
                     studentCL = studentBLL.viewStudentByAdmissionNo(studentId, sessionId);
                     studentId = studentCL.id;
                 }
                 lblStudentName.Text = studentCL.studentName;
                 lblFatherName.Text  = studentCL.fatherName;
                 lblMotherName.Text  = studentCL.motherName;
                 lblAdmissionNo.Text = studentCL.admissionNo.ToString();
                 lblClassSec.Text    = studentCL.classSection;
                 int utExamId       = reportBLL.viewExamIdByClass(studentCL.classId, "UT(40)");
                 int utNewExamId    = reportBLL.viewExamIdByClass(studentCL.classId, "UT(5)");
                 int term1ExamId    = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 1(Original)");
                 int term1NewExamId = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 1(Reduced)");
                 int term2ExamId    = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 2(Original)");
                 int term2NewExamId = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 2(Reduced)");
                 int term2GenExamId = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 2 - GENERAL");
                 Collection <SubjectCL>    subjectCol        = subjectBLL.viewSubjectByClassId(studentCL.classId);
                 Collection <MarksEntryCL> marksColUT        = reportBLL.viewMarksByStudentId(studentId, utExamId);
                 Collection <MarksEntryCL> marksColTERM1     = reportBLL.viewMarksByStudentId(studentId, term1ExamId);
                 Collection <MarksEntryCL> marksColTERM2     = reportBLL.viewMarksByStudentId(studentId, term2ExamId);
                 Collection <MarksEntryCL> marksColUTNew     = reportBLL.viewMarksByStudentId(studentId, utNewExamId);
                 Collection <MarksEntryCL> marksColTERM1New  = reportBLL.viewMarksByStudentId(studentId, term1NewExamId);
                 Collection <MarksEntryCL> marksColTERM1Copy = marksColTERM1New;
                 Collection <MarksEntryCL> marksColTERM2New  = reportBLL.viewMarksByStudentId(studentId, term2NewExamId);
                 Collection <MarksEntryCL> marksColTERM2Copy = marksColTERM2New;
                 Collection <GradeEntryCL> gradesColTERM2    = reportBLL.viewGradesByStudentId(studentId, term2GenExamId);
                 MiscEntryCL remarksAttendance = reportBLL.viewMiscByStudentId(studentId, term2GenExamId);
                 for (int i = 55; i <= 66; i++)
                 {
                     DeletePractical(subjectCol, i);
                 }
                 DeletePractical(subjectCol, 121);
                 DeletePractical(subjectCol, 122);
                 for (int i = 145; i <= 149; i++)
                 {
                     DeletePractical(subjectCol, i);
                 }
                 DeletePractical(subjectCol, 122);
                 for (int i = 67; i <= 71; i++)
                 {
                     DeletePractical(subjectCol, i);
                 }
                 var       subjectColl = subjectCol.OrderBy(x => x.name);
                 DataTable dt          = new DataTable();
                 DataRow   dr          = null;
                 dt.Columns.Add(new DataColumn("Subjects", typeof(string)));
                 dt.Columns.Add(new DataColumn("UT(40)\nUT1+UT2", typeof(string)));
                 dt.Columns.Add(new DataColumn("Term 1\n[Theory]\n(60/70/80)", typeof(string)));
                 dt.Columns.Add(new DataColumn("Term 2\n[Theory]\n(60/70/80)", typeof(string)));
                 dt.Columns.Add(new DataColumn("UT(5)\n*", typeof(string)));
                 dt.Columns.Add(new DataColumn("Term 1\n[Theory]\n(10/15/20)\n*", typeof(string)));
                 dt.Columns.Add(new DataColumn("Term 2\n[Theory]\n(45/50/55)\n*", typeof(string)));
                 dt.Columns.Add(new DataColumn("Total Weightage\n(60/70/80)\n*", typeof(string)));
                 dt.Columns.Add(new DataColumn("Practical\n[Term 1]\n(5/10/15)\n*", typeof(string)));
                 dt.Columns.Add(new DataColumn("Practical\n[Term 2]\n(15/25/30)\n*", typeof(string)));
                 dt.Columns.Add(new DataColumn("Total\n(Th+Pr)\n*", typeof(string)));
                 IDictionary <int, string> marksSubjectDictUTOld             = new Dictionary <int, string>();
                 IDictionary <int, string> marksSubjectDictUTNew             = new Dictionary <int, string>();
                 IDictionary <int, string> marksSubjectDictTERM1Old          = new Dictionary <int, string>();
                 IDictionary <int, string> marksSubjectDictTERM2Old          = new Dictionary <int, string>();
                 IDictionary <int, string> marksSubjectDictNew               = new Dictionary <int, string>();
                 IDictionary <int, string> marksSubjectDictTERM1New          = new Dictionary <int, string>();
                 IDictionary <int, string> marksSubjectDictTERM2New          = new Dictionary <int, string>();
                 IDictionary <int, string> marksPracticalTERM1SubjectDictNew = new Dictionary <int, string>();
                 IDictionary <int, string> marksPracticalTERM2SubjectDictNew = new Dictionary <int, string>();
                 int count = 0;
                 foreach (MarksEntryCL item in marksColUT)
                 {
                     if (item.subjectName == "Physics(042)")
                     {
                         marksSubjectDictUTOld.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Chemistry(043)")
                     {
                         marksSubjectDictUTOld.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Biology(044)")
                     {
                         marksSubjectDictUTOld.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Engineering Graphics(046)")
                     {
                         marksSubjectDictUTOld.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Computer Science(083)" || item.subjectName == "Computer Science(283)")
                     {
                         marksSubjectDictUTOld.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Physical Education(048)")
                     {
                         marksSubjectDictUTOld.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Psychology(037)")
                     {
                         marksSubjectDictUTOld.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Marketing(783)")
                     {
                         marksSubjectDictUTOld.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Business Studies(054)")
                     {
                         marksSubjectDictUTOld.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Accountancy(055)")
                     {
                         marksSubjectDictUTOld.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Economics(030)")
                     {
                         marksSubjectDictUTOld.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "History(027)")
                     {
                         marksSubjectDictUTOld.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Hindi(302)")
                     {
                         marksSubjectDictUTOld.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "English(301)")
                     {
                         marksSubjectDictUTOld.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Political Science(028)")
                     {
                         marksSubjectDictUTOld.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Mathematics(041)")
                     {
                         marksSubjectDictUTOld.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Information Practices(065)" || item.subjectName == "Information Practices(265)")
                     {
                         marksSubjectDictUTOld.Add(item.subjectId, item.marks);
                     }
                     else
                     {
                         marksSubjectDictUTOld.Add(item.subjectId, item.marks);
                     }
                 }
                 foreach (MarksEntryCL item in marksColUTNew)
                 {
                     if (item.subjectName == "Physics(042)")
                     {
                         marksSubjectDictUTNew.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Chemistry(043)")
                     {
                         marksSubjectDictUTNew.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Biology(044)")
                     {
                         marksSubjectDictUTNew.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Engineering Graphics(046)")
                     {
                         marksSubjectDictUTNew.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Computer Science(083)" || item.subjectName == "Computer Science(283)")
                     {
                         marksSubjectDictUTNew.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Physical Education(048)")
                     {
                         marksSubjectDictUTNew.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Psychology(037)")
                     {
                         marksSubjectDictUTNew.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Marketing(783)")
                     {
                         marksSubjectDictUTNew.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Business Studies(054)")
                     {
                         marksSubjectDictUTNew.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Accountancy(055)")
                     {
                         marksSubjectDictUTNew.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Economics(030)")
                     {
                         marksSubjectDictUTNew.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "History(027)")
                     {
                         marksSubjectDictUTNew.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Hindi(302)")
                     {
                         marksSubjectDictUTNew.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "English(301)")
                     {
                         marksSubjectDictUTNew.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Political Science(028)")
                     {
                         marksSubjectDictUTNew.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Mathematics(041)")
                     {
                         marksSubjectDictUTNew.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Information Practices(065)" || item.subjectName == "Information Practices(265)")
                     {
                         marksSubjectDictUTNew.Add(item.subjectId, item.marks);
                     }
                 }
                 foreach (MarksEntryCL item in marksColTERM1)
                 {
                     if (item.subjectName == "Physics(042)")
                     {
                         marksSubjectDictTERM1Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Chemistry(043)")
                     {
                         marksSubjectDictTERM1Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Biology(044)")
                     {
                         marksSubjectDictTERM1Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Engineering Graphics(046)")
                     {
                         marksSubjectDictTERM1Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Computer Science(083)" || item.subjectName == "Computer Science(283)")
                     {
                         marksSubjectDictTERM1Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Physical Education(048)")
                     {
                         marksSubjectDictTERM1Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Psychology(037)")
                     {
                         marksSubjectDictTERM1Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Marketing(783)")
                     {
                         marksSubjectDictTERM1Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Business Studies(054)")
                     {
                         marksSubjectDictTERM1Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Accountancy(055)")
                     {
                         marksSubjectDictTERM1Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Economics(030)")
                     {
                         marksSubjectDictTERM1Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "History(027)")
                     {
                         marksSubjectDictTERM1Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Hindi(302)")
                     {
                         marksSubjectDictTERM1Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "English(301)")
                     {
                         marksSubjectDictTERM1Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Political Science(028)")
                     {
                         marksSubjectDictTERM1Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Mathematics(041)")
                     {
                         marksSubjectDictTERM1Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Information Practices(065)" || item.subjectName == "Information Practices(265)")
                     {
                         marksSubjectDictTERM1Old.Add(item.subjectId, item.marks);
                     }
                     else
                     {
                         marksSubjectDictTERM1Old.Add(item.subjectId, item.marks);
                     }
                 }
                 foreach (MarksEntryCL item in marksColTERM1New)
                 {
                     if (item.subjectName == "Physics(042)")
                     {
                         marksSubjectDictTERM1New.Add(item.subjectId, item.marks);
                         marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 55));
                     }
                     else if (item.subjectName == "Chemistry(043)")
                     {
                         marksSubjectDictTERM1New.Add(item.subjectId, item.marks);
                         marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 56));
                     }
                     else if (item.subjectName == "Biology(044)")
                     {
                         marksSubjectDictTERM1New.Add(item.subjectId, item.marks);
                         marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 57));
                     }
                     else if (item.subjectName == "Engineering Graphics(046)")
                     {
                         marksSubjectDictTERM1New.Add(item.subjectId, item.marks);
                         marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 58));
                     }
                     else if (item.subjectName == "Computer Science(083)" || item.subjectName == "Computer Science(283)")
                     {
                         marksSubjectDictTERM1New.Add(item.subjectId, item.marks);
                         marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 59));
                     }
                     else if (item.subjectName == "Physical Education(048)")
                     {
                         marksSubjectDictTERM1New.Add(item.subjectId, item.marks);
                         marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 60));
                     }
                     else if (item.subjectName == "Psychology(037)")
                     {
                         marksSubjectDictTERM1New.Add(item.subjectId, item.marks);
                         marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 61));
                     }
                     else if (item.subjectName == "Marketing(783)")
                     {
                         marksSubjectDictTERM1New.Add(item.subjectId, item.marks);
                         marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 62));
                     }
                     else if (item.subjectName == "Business Studies(054)")
                     {
                         marksSubjectDictTERM1New.Add(item.subjectId, item.marks);
                         marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 63));
                     }
                     else if (item.subjectName == "Accountancy(055)")
                     {
                         marksSubjectDictTERM1New.Add(item.subjectId, item.marks);
                         marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 64));
                     }
                     else if (item.subjectName == "Economics(030)")
                     {
                         marksSubjectDictTERM1New.Add(item.subjectId, item.marks);
                         marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 65));
                     }
                     else if (item.subjectName == "History(027)")
                     {
                         marksSubjectDictTERM1New.Add(item.subjectId, item.marks);
                         marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 66));
                     }
                     else if (item.subjectName == "Hindi(302)")
                     {
                         marksSubjectDictTERM1New.Add(item.subjectId, item.marks);
                         marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 121));
                     }
                     else if (item.subjectName == "English(301)")
                     {
                         marksSubjectDictTERM1New.Add(item.subjectId, item.marks);
                         marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 145));
                     }
                     else if (item.subjectName == "Political Science(028)")
                     {
                         marksSubjectDictTERM1New.Add(item.subjectId, item.marks);
                         marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 146));
                     }
                     else if (item.subjectName == "Mathematics(041)")
                     {
                         marksSubjectDictTERM1New.Add(item.subjectId, item.marks);
                         marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 147));
                     }
                     else if (item.subjectName == "Information Practices(065)" || item.subjectName == "Information Practices(265)")
                     {
                         marksSubjectDictTERM1New.Add(item.subjectId, item.marks);
                         marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 148));
                     }
                     else
                     {
                         marksSubjectDictTERM1New.Add(item.subjectId, item.marks);
                         marksPracticalTERM1SubjectDictNew.Add(item.subjectId, string.Empty);
                     }
                 }
                 foreach (MarksEntryCL item in marksColTERM2)
                 {
                     if (item.subjectName == "Physics(042)")
                     {
                         marksSubjectDictTERM2Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Chemistry(043)")
                     {
                         marksSubjectDictTERM2Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Biology(044)")
                     {
                         marksSubjectDictTERM2Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Engineering Graphics(046)")
                     {
                         marksSubjectDictTERM2Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Computer Science(083)" || item.subjectName == "Computer Science(283)")
                     {
                         marksSubjectDictTERM2Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Physical Education(048)")
                     {
                         marksSubjectDictTERM2Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Psychology(037)")
                     {
                         marksSubjectDictTERM2Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Marketing(783)")
                     {
                         marksSubjectDictTERM2Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Business Studies(054)")
                     {
                         marksSubjectDictTERM2Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Accountancy(055)")
                     {
                         marksSubjectDictTERM2Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Economics(030)")
                     {
                         marksSubjectDictTERM2Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "History(027)")
                     {
                         marksSubjectDictTERM2Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Hindi(302)")
                     {
                         marksSubjectDictTERM2Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "English(301)")
                     {
                         marksSubjectDictTERM2Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Political Science(028)")
                     {
                         marksSubjectDictTERM2Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Mathematics(041)")
                     {
                         marksSubjectDictTERM2Old.Add(item.subjectId, item.marks);
                     }
                     else if (item.subjectName == "Information Practices(065)" || item.subjectName == "Information Practices(265)")
                     {
                         marksSubjectDictTERM2Old.Add(item.subjectId, item.marks);
                     }
                     else
                     {
                         marksSubjectDictTERM2Old.Add(item.subjectId, item.marks);
                     }
                 }
                 foreach (MarksEntryCL item in marksColTERM2New)
                 {
                     if (item.subjectName == "Physics(042)")
                     {
                         marksSubjectDictTERM2New.Add(item.subjectId, item.marks);
                         marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 55));
                     }
                     else if (item.subjectName == "Chemistry(043)")
                     {
                         marksSubjectDictTERM2New.Add(item.subjectId, item.marks);
                         marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 56));
                     }
                     else if (item.subjectName == "Biology(044)")
                     {
                         marksSubjectDictTERM2New.Add(item.subjectId, item.marks);
                         marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 57));
                     }
                     else if (item.subjectName == "Engineering Graphics(046)")
                     {
                         marksSubjectDictTERM2New.Add(item.subjectId, item.marks);
                         marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 58));
                     }
                     else if (item.subjectName == "Computer Science(083)" || item.subjectName == "Computer Science(283)")
                     {
                         marksSubjectDictTERM2New.Add(item.subjectId, item.marks);
                         marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 59));
                     }
                     else if (item.subjectName == "Physical Education(048)")
                     {
                         marksSubjectDictTERM2New.Add(item.subjectId, item.marks);
                         marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 60));
                     }
                     else if (item.subjectName == "Psychology(037)")
                     {
                         marksSubjectDictTERM2New.Add(item.subjectId, item.marks);
                         marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 61));
                     }
                     else if (item.subjectName == "Marketing(783)")
                     {
                         marksSubjectDictTERM2New.Add(item.subjectId, item.marks);
                         marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 62));
                     }
                     else if (item.subjectName == "Business Studies(054)")
                     {
                         marksSubjectDictTERM2New.Add(item.subjectId, item.marks);
                         marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 63));
                     }
                     else if (item.subjectName == "Accountancy(055)")
                     {
                         marksSubjectDictTERM2New.Add(item.subjectId, item.marks);
                         marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 64));
                     }
                     else if (item.subjectName == "Economics(030)")
                     {
                         marksSubjectDictTERM2New.Add(item.subjectId, item.marks);
                         marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 65));
                     }
                     else if (item.subjectName == "History(027)")
                     {
                         marksSubjectDictTERM2New.Add(item.subjectId, item.marks);
                         marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 66));
                     }
                     else if (item.subjectName == "Hindi(302)")
                     {
                         marksSubjectDictTERM2New.Add(item.subjectId, item.marks);
                         marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 121));
                     }
                     else if (item.subjectName == "English(301)")
                     {
                         marksSubjectDictTERM2New.Add(item.subjectId, item.marks);
                         marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 145));
                     }
                     else if (item.subjectName == "Political Science(028)")
                     {
                         marksSubjectDictTERM2New.Add(item.subjectId, item.marks);
                         marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 146));
                     }
                     else if (item.subjectName == "Mathematics(041)")
                     {
                         marksSubjectDictTERM2New.Add(item.subjectId, item.marks);
                         marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 147));
                     }
                     else if (item.subjectName == "Information Practices(065)" || item.subjectName == "Information Practices(265)")
                     {
                         marksSubjectDictTERM2New.Add(item.subjectId, item.marks);
                         marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 148));
                     }
                     else
                     {
                         marksSubjectDictTERM2New.Add(item.subjectId, item.marks);
                         marksPracticalTERM2SubjectDictNew.Add(item.subjectId, string.Empty);
                     }
                 }
                 double grandTotal = 0;
                 foreach (SubjectCL item in subjectCol)
                 {
                     double theory = 0;
                     double total  = 0;
                     dr             = dt.NewRow();
                     dr["Subjects"] = item.name;
                     if (marksSubjectDictUTOld.ContainsKey(item.id) || marksSubjectDictUTNew.ContainsKey(item.id) || marksSubjectDictTERM1Old.ContainsKey(item.id) || marksSubjectDictTERM1New.ContainsKey(item.id) || marksSubjectDictTERM2Old.ContainsKey(item.id) || marksSubjectDictTERM2New.ContainsKey(item.id))
                     {
                         if (marksSubjectDictUTOld.ContainsKey(item.id))
                         {
                             count++;
                             dr["UT(40)\nUT1+UT2"] = Convert.ToDouble(marksSubjectDictUTOld[item.id]);
                         }
                         if (marksSubjectDictTERM1Old.ContainsKey(item.id))
                         {
                             count++;
                             dr["Term 1\n[Theory]\n(60/70/80)"] = marksSubjectDictTERM1Old[item.id];
                         }
                         if (marksSubjectDictUTNew.ContainsKey(item.id))
                         {
                             count++;
                             dr["UT(5)\n*"] = marksSubjectDictUTNew[item.id];
                             theory         = theory + Convert.ToDouble(marksSubjectDictUTNew[item.id]);
                         }
                         if (marksSubjectDictTERM1New.ContainsKey(item.id))
                         {
                             count++;
                             dr["Term 1\n[Theory]\n(10/15/20)\n*"] = marksSubjectDictTERM1New[item.id];
                             theory = theory + Convert.ToDouble(marksSubjectDictTERM1New[item.id]);
                             dr["Practical\n[Term 1]\n(5/10/15)\n*"] = marksPracticalTERM1SubjectDictNew[item.id];
                             total = total + Convert.ToDouble(marksPracticalTERM1SubjectDictNew[item.id]);
                         }
                         if (marksSubjectDictTERM2Old.ContainsKey(item.id))
                         {
                             count++;
                             dr["Term 2\n[Theory]\n(60/70/80)"] = marksSubjectDictTERM2Old[item.id];
                         }
                         if (marksSubjectDictTERM2New.ContainsKey(item.id))
                         {
                             count++;
                             dr["Term 2\n[Theory]\n(45/50/55)\n*"] = marksSubjectDictTERM2New[item.id];
                             theory = theory + Convert.ToDouble(marksSubjectDictTERM2New[item.id]);
                             dr["Practical\n[Term 2]\n(15/25/30)\n*"] = marksPracticalTERM2SubjectDictNew[item.id];
                             total = total + Convert.ToDouble(marksPracticalTERM2SubjectDictNew[item.id]);
                         }
                         dr["Total Weightage\n(60/70/80)\n*"] = theory;
                         total      = total + theory;
                         grandTotal = grandTotal + total;
                         dr["Total\n(Th+Pr)\n*"] = total;
                     }
                     else
                     {
                         dr["UT(40)\nUT1+UT2"] = string.Empty;
                         dr["Term 1\n[Theory]\n(60/70/80)"] = string.Empty;
                         dr["Term 2\n[Theory]\n(60/70/80)"] = string.Empty;
                         dr["UT(5)\n*"] = string.Empty;
                         dr["Term 1\n[Theory]\n(10/15/20)\n*"]    = string.Empty;
                         dr["Term 2\n[Theory]\n(45/50/55)\n*"]    = string.Empty;
                         dr["Total Weightage\n(60/70/80)\n*"]     = string.Empty;
                         dr["Practical\n[Term 1]\n(5/10/15)\n*"]  = string.Empty;
                         dr["Practical\n[Term 2]\n(15/25/30)\n*"] = string.Empty;
                         dr["Total\n(Th+Pr)\n*"] = string.Empty;
                     }
                     dt.Rows.Add(dr);
                 }
                 grdMarksReport.DataSource = dt;
                 grdMarksReport.DataBind();
                 lblGrandTotal.Text = grandTotal.ToString();
                 lblPercentage.Text = Math.Round(grandTotal / 5, 2) + "%";
                 try
                 {
                     lblPunctuality.Text = gradesColTERM2.Where(x => x.subjectId == 67).FirstOrDefault().grade;
                     lblValueSystem.Text = gradesColTERM2.Where(x => x.subjectId == 70).FirstOrDefault().grade;
                     lblDiscipline.Text  = gradesColTERM2.Where(x => x.subjectId == 71).FirstOrDefault().grade;
                 }
                 catch (Exception ex)
                 {
                     throw(ex);
                 }
                 lblAttendance.Text = remarksAttendance.attendance;
                 lblRemarks.Text    = remarksAttendance.remarks;
             }
         }
     }
 }
Example #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!Request.IsAuthenticated)
         {
             FormsAuthentication.RedirectToLoginPage();
         }
         else
         {
             if (Session["sessionId"] == null)
             {
                 Response.Redirect("../index.aspx");
             }
             else
             {
                 sessionId = Convert.ToInt32(Session["sessionId"]);
                 int       studentId = 0;
                 StudentCL studentCL = new StudentCL();
                 studentId = Convert.ToInt32(Request.QueryString["studentId"]);
                 if (studentId != 0)
                 {
                     studentId = Convert.ToInt32(Request.QueryString["studentId"]);
                     studentCL = studentBLL.viewStudentById(studentId, sessionId);
                 }
                 else
                 {
                     studentId = Convert.ToInt32(Request.QueryString["admNo"]);
                     studentCL = studentBLL.viewStudentByAdmissionNo(studentId, sessionId);
                     studentId = studentCL.id;
                 }
                 imgLogo.ImageUrl    = "logo.jpg";
                 lblStudentName.Text = studentCL.studentName;
                 lblAdmissionNo.Text = studentCL.admissionNo.ToString();
                 lblClassSec.Text    = studentCL.classSection;
                 lblFatherName.Text  = studentCL.fatherName;
                 lblMotherName.Text  = studentCL.motherName;
                 int         term1ExamId       = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 1");
                 int         term2ExamId       = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 2");
                 int         ptId              = reportBLL.viewExamIdByClass(studentCL.classId, "PT(30)");
                 int         pt2Id             = reportBLL.viewExamIdByClass(studentCL.classId, "PT2(30)");
                 int         nsId              = reportBLL.viewExamIdByClass(studentCL.classId, "NS(5)");
                 int         ns2Id             = reportBLL.viewExamIdByClass(studentCL.classId, "NS2(5)");
                 int         seaId             = reportBLL.viewExamIdByClass(studentCL.classId, "SEA(5)");
                 int         sea2Id            = reportBLL.viewExamIdByClass(studentCL.classId, "SEA2(5)");
                 int         term2GenExamId    = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 2 - GENERAL");
                 MiscEntryCL remarksAttendance = reportBLL.viewMiscByStudentId(studentId, term2GenExamId);
                 //int examinationId = Convert.ToInt32(Request.QueryString["examId"]);
                 //Collection<SubjectCL> subjectCol = subjectBLL.viewSubjectByClassId(studentCL.classId);
                 Collection <MarksEntryCL> marksTerm1Col = reportBLL.viewMarksByStudentId(studentId, term1ExamId);
                 Collection <MarksEntryCL> marksPTCol    = reportBLL.viewMarksByStudentId(studentId, ptId);
                 Collection <MarksEntryCL> markNSsCol    = reportBLL.viewMarksByStudentId(studentId, nsId);
                 Collection <MarksEntryCL> marksSEACol   = reportBLL.viewMarksByStudentId(studentId, seaId);
                 Collection <GradeEntryCL> gradeCol      = reportBLL.viewGradesByStudentId(studentId, term1ExamId);
                 Collection <MarksEntryCL> marksTerm2Col = reportBLL.viewMarksByStudentId(studentId, term2ExamId);
                 Collection <MarksEntryCL> marksPT2Col   = reportBLL.viewMarksByStudentId(studentId, pt2Id);
                 Collection <MarksEntryCL> marksNS2Col   = reportBLL.viewMarksByStudentId(studentId, ns2Id);
                 Collection <MarksEntryCL> marksSEA2Col  = reportBLL.viewMarksByStudentId(studentId, sea2Id);
                 Collection <GradeEntryCL> grade2Col     = reportBLL.viewGradesByStudentId(studentId, term2ExamId);
                 lblEnglishPT.Text             = marksPTCol.Where(x => x.subjectId == 0).FirstOrDefault().marks;
                 lblEnglishPT2.Text            = marksPT2Col.Where(x => x.subjectId == 0).FirstOrDefault().marks;
                 lblEnglishNS.Text             = markNSsCol.Where(x => x.subjectId == 0).FirstOrDefault().marks;
                 lblEnglishNS2.Text            = marksNS2Col.Where(x => x.subjectId == 0).FirstOrDefault().marks;
                 lblEnglishSEA.Text            = marksSEACol.Where(x => x.subjectId == 0).FirstOrDefault().marks;
                 lblEnglishSEA2.Text           = marksSEA2Col.Where(x => x.subjectId == 0).FirstOrDefault().marks;
                 lblEnglishTerm1.Text          = marksTerm1Col.Where(x => x.subjectId == 0).FirstOrDefault().marks;
                 lblEnglishTerm2.Text          = marksTerm2Col.Where(x => x.subjectId == 0).FirstOrDefault().marks;
                 lblEnglishTotalTerm1.Text     = (Convert.ToDouble(lblEnglishPT.Text) + Convert.ToDouble(lblEnglishNS.Text) + Convert.ToDouble(lblEnglishSEA.Text) + Convert.ToDouble(lblEnglishTerm1.Text)).ToString();
                 lblEnglishTotalTerm2.Text     = (Convert.ToDouble(lblEnglishPT2.Text) + Convert.ToDouble(lblEnglishNS2.Text) + Convert.ToDouble(lblEnglishSEA2.Text) + Convert.ToDouble(lblEnglishTerm2.Text)).ToString();
                 lblEnglishTotal.Text          = Math.Ceiling((Convert.ToDouble(lblEnglishTotalTerm1.Text) / 2) + (Convert.ToDouble(lblEnglishTotalTerm2.Text) / 2)).ToString();
                 lblEnglishGrade.Text          = ConvertToGrade(Convert.ToDouble(lblEnglishTotal.Text));
                 lblHindiPT.Text               = Convert.ToDouble(marksPTCol.Where(x => x.subjectId == 13).FirstOrDefault().marks).ToString();
                 lblHindiPT2.Text              = marksPT2Col.Where(x => x.subjectId == 13).FirstOrDefault().marks;
                 lblHindiNS.Text               = markNSsCol.Where(x => x.subjectId == 13).FirstOrDefault().marks;
                 lblHindiNS2.Text              = marksNS2Col.Where(x => x.subjectId == 13).FirstOrDefault().marks;
                 lblHindiSEA.Text              = marksSEACol.Where(x => x.subjectId == 13).FirstOrDefault().marks;
                 lblHindiSEA2.Text             = marksSEA2Col.Where(x => x.subjectId == 13).FirstOrDefault().marks;
                 lblHindiTerm1.Text            = marksTerm1Col.Where(x => x.subjectId == 13).FirstOrDefault().marks;
                 lblHindiTerm2.Text            = marksTerm2Col.Where(x => x.subjectId == 13).FirstOrDefault().marks;
                 lblHindiTotalTerm1.Text       = (Convert.ToDouble(lblHindiPT.Text) + Convert.ToDouble(lblHindiNS.Text) + Convert.ToDouble(lblHindiSEA.Text) + Convert.ToDouble(lblHindiTerm1.Text)).ToString();
                 lblHindiTotalTerm2.Text       = (Convert.ToDouble(lblHindiPT2.Text) + Convert.ToDouble(lblHindiNS2.Text) + Convert.ToDouble(lblHindiSEA2.Text) + Convert.ToDouble(lblHindiTerm2.Text)).ToString();
                 lblHindiTotal.Text            = Math.Ceiling((Convert.ToDouble(lblHindiTotalTerm1.Text) / 2) + (Convert.ToDouble(lblHindiTotalTerm2.Text) / 2)).ToString();
                 lblHindiGrade.Text            = ConvertToGrade(Convert.ToDouble(lblHindiTotal.Text));
                 lblEVSPT.Text                 = marksPTCol.Where(x => x.subjectId == 117).FirstOrDefault().marks;
                 lblEVSPT2.Text                = marksPT2Col.Where(x => x.subjectId == 117).FirstOrDefault().marks;
                 lblEVSNS.Text                 = markNSsCol.Where(x => x.subjectId == 117).FirstOrDefault().marks;
                 lblEVSNS2.Text                = marksNS2Col.Where(x => x.subjectId == 117).FirstOrDefault().marks;
                 lblEVSSEA.Text                = marksSEACol.Where(x => x.subjectId == 117).FirstOrDefault().marks;
                 lblEVSSEA2.Text               = marksSEA2Col.Where(x => x.subjectId == 117).FirstOrDefault().marks;
                 lblEVSTerm1.Text              = marksTerm1Col.Where(x => x.subjectId == 117).FirstOrDefault().marks;
                 lblEVSTerm2.Text              = marksTerm2Col.Where(x => x.subjectId == 117).FirstOrDefault().marks;
                 lblEVSTotalTerm1.Text         = (Convert.ToDouble(lblEVSPT.Text) + Convert.ToDouble(lblEVSNS.Text) + Convert.ToDouble(lblEVSSEA.Text) + Convert.ToDouble(lblEVSTerm1.Text)).ToString();
                 lblEVSTotalTerm2.Text         = (Convert.ToDouble(lblEVSPT2.Text) + Convert.ToDouble(lblEVSNS2.Text) + Convert.ToDouble(lblEVSSEA2.Text) + Convert.ToDouble(lblEVSTerm2.Text)).ToString();
                 lblEVSTotal.Text              = Math.Ceiling((Convert.ToDouble(lblEVSTotalTerm1.Text) / 2) + (Convert.ToDouble(lblEVSTotalTerm2.Text) / 2)).ToString();
                 lblEVSGrade.Text              = ConvertToGrade(Convert.ToDouble(lblEVSTotal.Text));
                 lblMathematicsPT.Text         = marksPTCol.Where(x => x.subjectId == 1).FirstOrDefault().marks;
                 lblMathematicsPT2.Text        = marksPT2Col.Where(x => x.subjectId == 1).FirstOrDefault().marks;
                 lblMathematicsNS.Text         = markNSsCol.Where(x => x.subjectId == 1).FirstOrDefault().marks;
                 lblMathematicsNS2.Text        = marksNS2Col.Where(x => x.subjectId == 1).FirstOrDefault().marks;
                 lblMathematicsSEA.Text        = marksSEACol.Where(x => x.subjectId == 1).FirstOrDefault().marks;
                 lblMathematicsSEA2.Text       = marksSEA2Col.Where(x => x.subjectId == 1).FirstOrDefault().marks;
                 lblMathematicsTerm1.Text      = marksTerm1Col.Where(x => x.subjectId == 1).FirstOrDefault().marks;
                 lblMathematicsTerm2.Text      = marksTerm2Col.Where(x => x.subjectId == 1).FirstOrDefault().marks;
                 lblMathematicsTotalTerm1.Text = (Convert.ToDouble(lblMathematicsPT.Text) + Convert.ToDouble(lblMathematicsNS.Text) + Convert.ToDouble(lblMathematicsSEA.Text) + Convert.ToDouble(lblMathematicsTerm1.Text)).ToString();
                 lblMathematicsTotalTerm2.Text = (Convert.ToDouble(lblMathematicsPT2.Text) + Convert.ToDouble(lblMathematicsNS2.Text) + Convert.ToDouble(lblMathematicsSEA2.Text) + Convert.ToDouble(lblMathematicsTerm2.Text)).ToString();
                 lblMathematicsTotal.Text      = Math.Ceiling((Convert.ToDouble(lblMathematicsTotalTerm1.Text) / 2) + (Convert.ToDouble(lblMathematicsTotalTerm2.Text) / 2)).ToString();
                 lblMathematicsGrade.Text      = ConvertToGrade(Convert.ToDouble(lblMathematicsTotal.Text));
                 lblGKPT.Text                  = marksPTCol.Where(x => x.subjectId == 104).FirstOrDefault().marks;
                 lblGKPT2.Text                 = marksPT2Col.Where(x => x.subjectId == 104).FirstOrDefault().marks;
                 lblGKNS.Text                  = markNSsCol.Where(x => x.subjectId == 104).FirstOrDefault().marks;
                 lblGKNS2.Text                 = marksNS2Col.Where(x => x.subjectId == 104).FirstOrDefault().marks;
                 lblGKSEA.Text                 = marksSEACol.Where(x => x.subjectId == 104).FirstOrDefault().marks;
                 lblGKSEA2.Text                = marksSEA2Col.Where(x => x.subjectId == 104).FirstOrDefault().marks;
                 lblGKTerm1.Text               = marksTerm1Col.Where(x => x.subjectId == 104).FirstOrDefault().marks;
                 lblGKTerm2.Text               = marksTerm2Col.Where(x => x.subjectId == 104).FirstOrDefault().marks;
                 lblGKTotalTerm1.Text          = (Convert.ToDouble(lblGKPT.Text) + Convert.ToDouble(lblGKNS.Text) + Convert.ToDouble(lblGKSEA.Text) + Convert.ToDouble(lblGKTerm1.Text)).ToString();
                 lblGKTotalTerm2.Text          = (Convert.ToDouble(lblGKPT2.Text) + Convert.ToDouble(lblGKNS2.Text) + Convert.ToDouble(lblGKSEA2.Text) + Convert.ToDouble(lblGKTerm2.Text)).ToString();
                 lblGKTotal.Text               = Math.Ceiling((Convert.ToDouble(lblGKTotalTerm1.Text) / 2) + (Convert.ToDouble(lblGKTotalTerm2.Text) / 2)).ToString();
                 lblGKGrade.Text               = ConvertToGrade(Convert.ToDouble(lblGKTotal.Text));
                 lblArtEduTerm1.Text           = gradeCol.Where(x => x.subjectId == 52).FirstOrDefault().grade;
                 lblArtEduTerm2.Text           = grade2Col.Where(x => x.subjectId == 52).FirstOrDefault().grade;
                 lblWorkEduTerm1.Text          = gradeCol.Where(x => x.subjectId == 51).FirstOrDefault().grade;
                 lblWorkEduTerm2.Text          = grade2Col.Where(x => x.subjectId == 51).FirstOrDefault().grade;
                 lblPhysicalEduTerm1.Text      = gradeCol.Where(x => x.subjectId == 53).FirstOrDefault().grade;
                 lblPhysicalEduTerm2.Text      = grade2Col.Where(x => x.subjectId == 53).FirstOrDefault().grade;
                 lblRegularityTerm1.Text       = gradeCol.Where(x => x.subjectId == 67).FirstOrDefault().grade;
                 lblRegularityTerm2.Text       = grade2Col.Where(x => x.subjectId == 67).FirstOrDefault().grade;
                 lblSincerityTerm1.Text        = gradeCol.Where(x => x.subjectId == 119).FirstOrDefault().grade;
                 lblSincerityTerm2.Text        = grade2Col.Where(x => x.subjectId == 119).FirstOrDefault().grade;
                 lblBehaviourTerm1.Text        = gradeCol.Where(x => x.subjectId == 120).FirstOrDefault().grade;
                 lblBehaviourTerm2.Text        = grade2Col.Where(x => x.subjectId == 120).FirstOrDefault().grade;
                 lblAttitudeTeachersTerm1.Text = gradeCol.Where(x => x.subjectId == 70).FirstOrDefault().grade;
                 lblAttitudeTeachersTerm2.Text = grade2Col.Where(x => x.subjectId == 70).FirstOrDefault().grade;
                 lblAttitudeStudentsTerm1.Text = gradeCol.Where(x => x.subjectId == 69).FirstOrDefault().grade;
                 lblAttitudeStudentsTerm2.Text = grade2Col.Where(x => x.subjectId == 69).FirstOrDefault().grade;
                 lblGrade.Text                 = ConvertToGrade((Convert.ToDouble(lblEnglishTotal.Text) + Convert.ToDouble(lblHindiTotal.Text) + Convert.ToDouble(lblEVSTotal.Text) + Convert.ToDouble(lblMathematicsTotal.Text) + Convert.ToDouble(lblGKTotal.Text)) / 5);
                 lblAttendance.Text            = remarksAttendance.attendance;
                 lblRemarks.Text               = remarksAttendance.remarks;
             }
         }
     }
 }
Example #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!Request.IsAuthenticated)
         {
             FormsAuthentication.RedirectToLoginPage();
         }
         else
         {
             if (Session["sessionId"] == null)
             {
                 Response.Redirect("../index.aspx");
             }
             else
             {
                 sessionId = Convert.ToInt32(Session["sessionId"]);
                 int       studentId = 0;
                 StudentCL studentCL = new StudentCL();
                 studentId = Convert.ToInt32(Request.QueryString["studentId"]);
                 if (studentId != 0)
                 {
                     studentId = Convert.ToInt32(Request.QueryString["studentId"]);
                     studentCL = studentBLL.viewStudentById(studentId, sessionId);
                 }
                 else
                 {
                     studentId = Convert.ToInt32(Request.QueryString["admNo"]);
                     studentCL = studentBLL.viewStudentByAdmissionNo(studentId, sessionId);
                     studentId = studentCL.id;
                 }
                 imgLogo.ImageUrl    = "logo.jpg";
                 lblStudentName.Text = studentCL.studentName;
                 lblFatherName.Text  = studentCL.fatherName;
                 lblMotherName.Text  = studentCL.motherName;
                 lblAdmissionNo.Text = studentCL.admissionNo.ToString();
                 lblClassSec.Text    = studentCL.classSection;
                 lblExamination.Text = "PRE-BOARD 1";
                 int examinationId = reportBLL.viewExamIdByClass(studentCL.classId, "PRE-BOARD 1");
                 Collection <SubjectCL>    subjectCol   = subjectBLL.viewSubjectByClassId(studentCL.classId);
                 Collection <MarksEntryCL> marksCol     = reportBLL.viewMarksByStudentId(studentId, examinationId);
                 Collection <GradeEntryCL> gradeCol     = reportBLL.viewGradesByStudentId(studentId, examinationId);
                 Collection <MarksEntryCL> marksColCopy = marksCol;
                 MiscEntryCL remarksAttendance          = reportBLL.viewMiscByStudentId(studentId, examinationId);
                 for (int i = 54; i <= 71; i++)
                 {
                     DeletePractical(subjectCol, i);
                 }
                 DeletePractical(subjectCol, 116);
                 DeletePractical(subjectCol, 121);
                 DeletePractical(subjectCol, 122);
                 for (int i = 144; i <= 150; i++)
                 {
                     DeletePractical(subjectCol, i);
                 }
                 var       subjectColl = subjectCol.OrderBy(x => x.name);
                 DataTable dt          = new DataTable();
                 DataRow   dr          = null;
                 dt.Columns.Add(new DataColumn("Subjects", typeof(string)));
                 dt.Columns.Add(new DataColumn("Max. Marks", typeof(int)));
                 dt.Columns.Add(new DataColumn("Min. Marks", typeof(int)));
                 dt.Columns.Add(new DataColumn("Theory", typeof(string)));
                 dt.Columns.Add(new DataColumn("Practical", typeof(string)));
                 dt.Columns.Add(new DataColumn("Total", typeof(string)));
                 IDictionary <int, string> marksSubjectDict          = new Dictionary <int, string>();
                 IDictionary <int, string> marksPracticalSubjectDict = new Dictionary <int, string>();
                 foreach (MarksEntryCL item in marksCol)
                 {
                     if (item.subjectName == "Physics(042)")
                     {
                         marksSubjectDict.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 55));
                     }
                     else if (item.subjectName == "Chemistry(043)")
                     {
                         marksSubjectDict.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 56));
                     }
                     else if (item.subjectName == "Biology(044)")
                     {
                         marksSubjectDict.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 57));
                     }
                     else if (item.subjectName == "Engineering Graphics(046)")
                     {
                         marksSubjectDict.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 58));
                     }
                     else if (item.subjectName == "Computer Science(083)" || item.subjectName == "Computer Science(283)")
                     {
                         marksSubjectDict.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 59));
                     }
                     else if (item.subjectName == "Physical Education(048)")
                     {
                         marksSubjectDict.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 60));
                     }
                     else if (item.subjectName == "Psychology(037)")
                     {
                         marksSubjectDict.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 61));
                     }
                     else if (item.subjectName == "Marketing(783)")
                     {
                         marksSubjectDict.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 62));
                     }
                     else if (item.subjectName == "Business Studies(054)")
                     {
                         marksSubjectDict.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 63));
                     }
                     else if (item.subjectName == "Accountancy(055)")
                     {
                         marksSubjectDict.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 64));
                     }
                     else if (item.subjectName == "Economics(030)")
                     {
                         marksSubjectDict.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 65));
                     }
                     else if (item.subjectName == "History(027)")
                     {
                         marksSubjectDict.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 66));
                     }
                     else if (item.subjectName == "Hindi(302)")
                     {
                         marksSubjectDict.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 121));
                     }
                     else if (item.subjectName == "English(301)")
                     {
                         marksSubjectDict.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 145));
                     }
                     else if (item.subjectName == "Political Science(028)")
                     {
                         marksSubjectDict.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 146));
                     }
                     else if (item.subjectName == "Mathematics(041)")
                     {
                         marksSubjectDict.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 147));
                     }
                     else if (item.subjectName == "Information Practices(065)" || item.subjectName == "Information Practices(265)")
                     {
                         marksSubjectDict.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 116));
                     }
                     else
                     {
                         marksSubjectDict.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDict.Add(item.subjectId, string.Empty);
                     }
                 }
                 double grandTotal = 0;
                 foreach (SubjectCL item in subjectCol)
                 {
                     dr               = dt.NewRow();
                     dr["Subjects"]   = item.name;
                     dr["Max. Marks"] = 100;
                     dr["Min. Marks"] = 40;
                     if (marksSubjectDict.ContainsKey(item.id))
                     {
                         dr["Theory"] = marksSubjectDict[item.id];
                         if (marksPracticalSubjectDict[item.id] == string.Empty)
                         {
                             dr["Total"] = marksSubjectDict[item.id];
                             grandTotal  = grandTotal + Convert.ToDouble(marksSubjectDict[item.id]);
                         }
                         else
                         {
                             dr["Practical"] = marksPracticalSubjectDict[item.id];
                             dr["Total"]     = Convert.ToDouble(marksSubjectDict[item.id]) + Convert.ToDouble(marksPracticalSubjectDict[item.id]);
                             grandTotal      = grandTotal + Convert.ToDouble(Convert.ToDouble(marksSubjectDict[item.id]) + Convert.ToDouble(marksPracticalSubjectDict[item.id]));
                         }
                     }
                     else
                     {
                         dr["Theory"]    = string.Empty;
                         dr["Practical"] = string.Empty;
                         dr["Total"]     = string.Empty;
                     }
                     dt.Rows.Add(dr);
                 }
                 grdMarksReport.DataSource = dt;
                 grdMarksReport.DataBind();
                 lblGrandTotal.Text  = grandTotal.ToString();
                 lblPercentage.Text  = (grandTotal / 5) + "%";
                 lblPunctuality.Text = gradeCol.Where(x => x.subjectId == 67).FirstOrDefault().grade;
                 lblOppGender.Text   = gradeCol.Where(x => x.subjectId == 68).FirstOrDefault().grade;
                 lblClassMates.Text  = gradeCol.Where(x => x.subjectId == 69).FirstOrDefault().grade;
                 lblTeachers.Text    = gradeCol.Where(x => x.subjectId == 70).FirstOrDefault().grade;
                 lblDiscipline.Text  = gradeCol.Where(x => x.subjectId == 71).FirstOrDefault().grade;
                 lblAttendance.Text  = remarksAttendance.attendance;
                 lblRemarks.Text     = remarksAttendance.remarks;
             }
         }
     }
 }
Example #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!Request.IsAuthenticated)
                {
                    FormsAuthentication.RedirectToLoginPage();
                }
                else
                {
                    if (Session["sessionId"] == null)
                    {
                        Response.Redirect("../index.aspx");
                    }
                    else
                    {
                        sessionId = Convert.ToInt32(Session["sessionId"]);
                        int       studentId = 0;
                        StudentCL studentCL = new StudentCL();
                        studentId = Convert.ToInt32(Request.QueryString["studentId"]);
                        if (studentId != 0)
                        {
                            studentId = Convert.ToInt32(Request.QueryString["studentId"]);
                            studentCL = studentBLL.viewStudentById(studentId, sessionId);
                        }
                        else
                        {
                            studentId = Convert.ToInt32(Request.QueryString["admNo"]);
                            studentCL = studentBLL.viewStudentByAdmissionNo(studentId, sessionId);
                            studentId = studentCL.id;
                        }
                        imgLogo.ImageUrl    = "logo.jpg";
                        lblStudentName.Text = studentCL.studentName;
                        lblFatherName.Text  = studentCL.fatherName;
                        lblMotherName.Text  = studentCL.motherName;
                        lblAdmissionNo.Text = studentCL.admissionNo.ToString();
                        lblClassSec.Text    = studentCL.classSection;
                        lblExamination.Text = "TERM 2";
                        int term1ExamId = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 2");
                        Collection <SubjectCL>    subjectCol     = subjectBLL.viewSubjectByClassId(studentCL.classId);
                        Collection <MarksEntryCL> marksCol       = reportBLL.viewMarksByStudentId(studentId, term1ExamId);
                        Collection <MarksEntryCL> marksColCopy   = marksCol;
                        Collection <GradeEntryCL> gradesColTERM1 = reportBLL.viewGradesByStudentId(studentId, term1ExamId);
                        MiscEntryCL remarksAttendance            = reportBLL.viewMiscByStudentId(studentId, term1ExamId);
                        for (int i = 54; i <= 71; i++)
                        {
                            DeletePractical(subjectCol, i);
                        }
                        DeletePractical(subjectCol, 116);
                        DeletePractical(subjectCol, 54);
                        DeletePractical(subjectCol, 121);
                        var       subjectColl = subjectCol.OrderBy(x => x.name);
                        DataTable dt          = new DataTable();
                        DataRow   dr          = null;
                        dt.Columns.Add(new DataColumn("Subjects", typeof(string)));
                        dt.Columns.Add(new DataColumn("Max. Marks", typeof(int)));
                        dt.Columns.Add(new DataColumn("Min. Marks", typeof(int)));
                        dt.Columns.Add(new DataColumn("Theory", typeof(string)));
                        dt.Columns.Add(new DataColumn("Practical", typeof(string)));
                        dt.Columns.Add(new DataColumn("Total", typeof(string)));
                        IDictionary <int, string> marksSubjectDict          = new Dictionary <int, string>();
                        IDictionary <int, string> marksPracticalSubjectDict = new Dictionary <int, string>();
                        int count = 0;
                        foreach (MarksEntryCL item in marksCol)
                        {
                            if (item.subjectId != 2 && item.subjectId != 3 && item.subjectId != 4 && item.subjectId != 5 && item.subjectId != 6 && item.subjectId != 15 && item.subjectId != 7 && item.subjectId != 11 && item.subjectId != 9 && item.subjectId != 8 && item.subjectId != 10 && item.subjectId != 14 && item.subjectId != 115 && item.subjectId != 13)
                            {
                                marksSubjectDict.Add(item.subjectId, item.marks);
                                marksPracticalSubjectDict.Add(item.subjectId, string.Empty);
                            }
                            if (item.subjectId == 14)
                            {
                                marksSubjectDict.Add(item.subjectId, item.marks);
                                marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 66));
                            }
                            if (item.subjectId == 2)
                            {
                                marksSubjectDict.Add(item.subjectId, item.marks);
                                marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 55));
                            }
                            if (item.subjectId == 3)
                            {
                                marksSubjectDict.Add(item.subjectId, item.marks);
                                marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 56));
                            }
                            if (item.subjectId == 4)
                            {
                                marksSubjectDict.Add(item.subjectId, item.marks);
                                marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 57));
                            }
                            if (item.subjectId == 5)
                            {
                                marksSubjectDict.Add(item.subjectId, item.marks);
                                marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 58));
                            }
                            if (item.subjectId == 6)
                            {
                                marksSubjectDict.Add(item.subjectId, item.marks);
                                marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 59));
                            }
                            if (item.subjectId == 15)
                            {
                                marksSubjectDict.Add(item.subjectId, item.marks);
                                marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 60));
                            }
                            if (item.subjectId == 7)
                            {
                                marksSubjectDict.Add(item.subjectId, item.marks);
                                marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 61));
                            }
                            if (item.subjectId == 11)
                            {
                                marksSubjectDict.Add(item.subjectId, item.marks);
                                marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 62));
                            }
                            if (item.subjectId == 9)
                            {
                                marksSubjectDict.Add(item.subjectId, item.marks);
                                marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 63));
                            }
                            if (item.subjectId == 8)
                            {
                                marksSubjectDict.Add(item.subjectId, item.marks);
                                marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 64));
                            }
                            if (item.subjectId == 10)
                            {
                                marksSubjectDict.Add(item.subjectId, item.marks);
                                marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 65));
                            }
                            if (item.subjectId == 115)
                            {
                                marksSubjectDict.Add(item.subjectId, item.marks);
                                marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 116));
                            }
                            if (item.subjectId == 13)
                            {
                                marksSubjectDict.Add(item.subjectId, item.marks);
                                marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 121));
                            }
                        }
                        double grandTotal = 0;
                        foreach (SubjectCL item in subjectCol)
                        {
                            dr               = dt.NewRow();
                            dr["Subjects"]   = item.name;
                            dr["Max. Marks"] = 100;
                            dr["Min. Marks"] = 40;

                            if (marksSubjectDict.ContainsKey(item.id))
                            {
                                //    count++;
                                //    dr["Theory"] = marksSubjectDict[item.id];
                                //    if (marksPracticalSubjectDict[item.id] == string.Empty)
                                //    {
                                //        dr["Total"] = marksSubjectDict[item.id];
                                //        grandTotal = grandTotal + Convert.ToDouble(marksSubjectDict[item.id]);
                                //    }
                                //    else
                                //    {
                                //        dr["Practical"] = marksPracticalSubjectDict[item.id];
                                //        dr["Total"] = Convert.ToDouble(marksSubjectDict[item.id]) + Convert.ToDouble(marksPracticalSubjectDict[item.id]);
                                //        grandTotal = grandTotal + Convert.ToDouble(Convert.ToDouble(marksSubjectDict[item.id]) + Convert.ToDouble(marksPracticalSubjectDict[item.id]));
                                //    }
                            }
                            else
                            {
                                dr["Theory"]    = string.Empty;
                                dr["Practical"] = string.Empty;
                                dr["Total"]     = string.Empty;
                            }
                            dt.Rows.Add(dr);
                        }
                        grdMarksReport.DataSource = dt;
                        grdMarksReport.DataBind();
                        //lblGrandTotal.Text = grandTotal.ToString();
                        //lblPercentage.Text = Math.Round(grandTotal / 5, 2) + "%";
                        //lblDiscipline.Text = gradesColTERM1.Where(x => x.subjectId == 71).FirstOrDefault().grade;
                        //lblPunctuality.Text = gradesColTERM1.Where(x => x.subjectId == 67).FirstOrDefault().grade;
                        //lblRespectToGender.Text = gradesColTERM1.Where(x => x.subjectId == 68).FirstOrDefault().grade;
                        //lblAttitudeClassmates.Text = gradesColTERM1.Where(x => x.subjectId == 69).FirstOrDefault().grade;
                        //lblAttitudeTeachers.Text = gradesColTERM1.Where(x => x.subjectId == 70).FirstOrDefault().grade;
                        //lblAttendance.Text = remarksAttendance.attendance;
                        //lblRemarks.Text = remarksAttendance.remarks;
                    }
                }
            }
        }
Example #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!Request.IsAuthenticated)
         {
             FormsAuthentication.RedirectToLoginPage();
         }
         else
         {
             if (Session["sessionId"] == null)
             {
                 Response.Redirect("../index.aspx");
             }
             else
             {
                 sessionId = Convert.ToInt32(Session["sessionId"]);
                 int       studentId = 0;
                 StudentCL studentCL = new StudentCL();
                 studentId = Convert.ToInt32(Request.QueryString["studentId"]);
                 if (studentId != 0)
                 {
                     studentId = Convert.ToInt32(Request.QueryString["studentId"]);
                     studentCL = studentBLL.viewStudentById(studentId, sessionId);
                 }
                 else
                 {
                     studentId = Convert.ToInt32(Request.QueryString["admNo"]);
                     studentCL = studentBLL.viewStudentByAdmissionNo(studentId, sessionId);
                     studentId = studentCL.id;
                 }
                 imgLogo.ImageUrl    = "logo.jpg";
                 lblStudentName.Text = studentCL.studentName;
                 lblAdmissionNo.Text = studentCL.admissionNo.ToString();
                 lblClassSec.Text    = studentCL.classSection;
                 int term1ExamId = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 1");
                 int ptId        = reportBLL.viewExamIdByClass(studentCL.classId, "PT(10)");
                 int nsId        = reportBLL.viewExamIdByClass(studentCL.classId, "NS(5)");
                 int seaId       = reportBLL.viewExamIdByClass(studentCL.classId, "SEA(5)");
                 //int examinationId = Convert.ToInt32(Request.QueryString["examId"]);
                 //Collection<SubjectCL> subjectCol = subjectBLL.viewSubjectByClassId(studentCL.classId);
                 Collection <MarksEntryCL> marksTerm1Col = reportBLL.viewMarksByStudentId(studentId, term1ExamId);
                 Collection <MarksEntryCL> marksPTCol    = reportBLL.viewMarksByStudentId(studentId, ptId);
                 Collection <MarksEntryCL> markNSsCol    = reportBLL.viewMarksByStudentId(studentId, nsId);
                 Collection <MarksEntryCL> marksSEACol   = reportBLL.viewMarksByStudentId(studentId, seaId);
                 Collection <GradeEntryCL> gradeCol      = reportBLL.viewGradesByStudentId(studentId, term1ExamId);
                 MiscEntryCL remarksAttendance           = reportBLL.viewMiscByStudentId(studentId, term1ExamId);
                 try
                 {
                     lblEnglishPT.Text          = marksPTCol.Where(x => x.subjectId == 0).FirstOrDefault().marks;
                     lblEnglishNS.Text          = markNSsCol.Where(x => x.subjectId == 0).FirstOrDefault().marks;
                     lblEnglishSEA.Text         = marksSEACol.Where(x => x.subjectId == 0).FirstOrDefault().marks;
                     lblEnglishTerm1.Text       = marksTerm1Col.Where(x => x.subjectId == 0).FirstOrDefault().marks;
                     lblEnglishTotal.Text       = (Convert.ToDouble(lblEnglishPT.Text) + Convert.ToDouble(lblEnglishNS.Text) + Convert.ToDouble(lblEnglishSEA.Text) + Convert.ToDouble(lblEnglishTerm1.Text)).ToString();
                     lblEnglishGrade.Text       = ConvertToGrade(Convert.ToDouble(lblEnglishTotal.Text));
                     lblHindiPT.Text            = marksPTCol.Where(x => x.subjectId == 13).FirstOrDefault().marks;
                     lblHindiNS.Text            = markNSsCol.Where(x => x.subjectId == 13).FirstOrDefault().marks;
                     lblHindiSEA.Text           = marksSEACol.Where(x => x.subjectId == 13).FirstOrDefault().marks;
                     lblHindiTerm1.Text         = marksTerm1Col.Where(x => x.subjectId == 13).FirstOrDefault().marks;
                     lblHindiTotal.Text         = (Convert.ToDouble(lblHindiPT.Text) + Convert.ToDouble(lblHindiNS.Text) + Convert.ToDouble(lblHindiSEA.Text) + Convert.ToDouble(lblHindiTerm1.Text)).ToString();
                     lblHindiGrade.Text         = ConvertToGrade(Convert.ToDouble(lblHindiTotal.Text));
                     lblSanskritPT.Text         = marksPTCol.Where(x => x.subjectId == 46).FirstOrDefault().marks;
                     lblSanskritNS.Text         = markNSsCol.Where(x => x.subjectId == 46).FirstOrDefault().marks;
                     lblSanskritSEA.Text        = marksSEACol.Where(x => x.subjectId == 46).FirstOrDefault().marks;
                     lblSanskritTerm1.Text      = marksTerm1Col.Where(x => x.subjectId == 46).FirstOrDefault().marks;
                     lblSanskritTotal.Text      = (Convert.ToDouble(lblSanskritPT.Text) + Convert.ToDouble(lblSanskritNS.Text) + Convert.ToDouble(lblSanskritSEA.Text) + Convert.ToDouble(lblSanskritTerm1.Text)).ToString();
                     lblSanskritGrade.Text      = ConvertToGrade(Convert.ToDouble(lblSanskritTotal.Text));
                     lblSciencePT.Text          = marksPTCol.Where(x => x.subjectId == 29).FirstOrDefault().marks;
                     lblScienceNS.Text          = markNSsCol.Where(x => x.subjectId == 29).FirstOrDefault().marks;
                     lblScienceSEA.Text         = marksSEACol.Where(x => x.subjectId == 29).FirstOrDefault().marks;
                     lblScienceTerm1.Text       = marksTerm1Col.Where(x => x.subjectId == 29).FirstOrDefault().marks;
                     lblScienceTotal.Text       = (Convert.ToDouble(lblSciencePT.Text) + Convert.ToDouble(lblScienceNS.Text) + Convert.ToDouble(lblScienceSEA.Text) + Convert.ToDouble(lblScienceTerm1.Text)).ToString();
                     lblScienceGrade.Text       = ConvertToGrade(Convert.ToDouble(lblScienceTotal.Text));
                     lblSocialSciencePT.Text    = marksPTCol.Where(x => x.subjectId == 35).FirstOrDefault().marks;
                     lblSocialScienceNS.Text    = markNSsCol.Where(x => x.subjectId == 35).FirstOrDefault().marks;
                     lblSocialScienceSEA.Text   = marksSEACol.Where(x => x.subjectId == 35).FirstOrDefault().marks;
                     lblSocialScienceTerm1.Text = marksTerm1Col.Where(x => x.subjectId == 35).FirstOrDefault().marks;
                     lblSocialScienceTotal.Text = (Convert.ToDouble(lblSocialSciencePT.Text) + Convert.ToDouble(lblSocialScienceNS.Text) + Convert.ToDouble(lblSocialScienceSEA.Text) + Convert.ToDouble(lblSocialScienceTerm1.Text)).ToString();
                     lblSocialScienceGrade.Text = ConvertToGrade(Convert.ToDouble(lblSocialScienceTotal.Text));
                     lblMathematicsPT.Text      = marksPTCol.Where(x => x.subjectId == 1).FirstOrDefault().marks;
                     lblMathematicsNS.Text      = markNSsCol.Where(x => x.subjectId == 1).FirstOrDefault().marks;
                     lblMathematicsSEA.Text     = marksSEACol.Where(x => x.subjectId == 1).FirstOrDefault().marks;
                     lblMathematicsTerm1.Text   = marksTerm1Col.Where(x => x.subjectId == 1).FirstOrDefault().marks;
                     lblMathematicsTotal.Text   = (Convert.ToDouble(lblMathematicsPT.Text) + Convert.ToDouble(lblMathematicsNS.Text) + Convert.ToDouble(lblMathematicsSEA.Text) + Convert.ToDouble(lblMathematicsTerm1.Text)).ToString();
                     lblMathematicsGrade.Text   = ConvertToGrade(Convert.ToDouble(lblMathematicsTotal.Text));
                     lblCSPT.Text             = marksPTCol.Where(x => x.subjectId == 6).FirstOrDefault().marks;
                     lblCSNS.Text             = markNSsCol.Where(x => x.subjectId == 6).FirstOrDefault().marks;
                     lblCSSEA.Text            = marksSEACol.Where(x => x.subjectId == 6).FirstOrDefault().marks;
                     lblCSTerm1.Text          = marksTerm1Col.Where(x => x.subjectId == 6).FirstOrDefault().marks;
                     lblCSTotal.Text          = (Convert.ToDouble(lblCSPT.Text) + Convert.ToDouble(lblCSNS.Text) + Convert.ToDouble(lblCSSEA.Text) + Convert.ToDouble(lblCSTerm1.Text)).ToString();
                     lblCSGrade.Text          = ConvertToGrade(Convert.ToDouble(lblCSTotal.Text));
                     lblArtEdu.Text           = gradeCol.Where(x => x.subjectId == 52).FirstOrDefault().grade;
                     lblWorkEdu.Text          = gradeCol.Where(x => x.subjectId == 51).FirstOrDefault().grade;
                     lblPhysicalEdu.Text      = gradeCol.Where(x => x.subjectId == 53).FirstOrDefault().grade;
                     lblRegularity.Text       = gradeCol.Where(x => x.subjectId == 67).FirstOrDefault().grade;
                     lblSincerity.Text        = gradeCol.Where(x => x.subjectId == 119).FirstOrDefault().grade;
                     lblBehaviour.Text        = gradeCol.Where(x => x.subjectId == 120).FirstOrDefault().grade;
                     lblAttitudeTeachers.Text = gradeCol.Where(x => x.subjectId == 70).FirstOrDefault().grade;
                     lblAttitudeStudents.Text = gradeCol.Where(x => x.subjectId == 69).FirstOrDefault().grade;
                     lblGrade.Text            = ConvertToGrade((Convert.ToDouble(lblScienceTotal.Text) + Convert.ToDouble(lblSocialScienceTotal.Text) + Convert.ToDouble(lblEnglishTotal.Text) + Convert.ToDouble(lblHindiTotal.Text) + Convert.ToDouble(lblSanskritTotal.Text) + Convert.ToDouble(lblMathematicsTotal.Text) + Convert.ToDouble(lblCSTotal.Text)) / 7);
                     lblAttendance.Text       = remarksAttendance.attendance;
                     lblRemarks.Text          = remarksAttendance.remarks;
                 }
                 catch (Exception)
                 {
                     throw;
                 }
             }
         }
     }
 }
Example #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!Request.IsAuthenticated)
         {
             FormsAuthentication.RedirectToLoginPage();
         }
         else
         {
             if (Session["sessionId"] == null)
             {
                 Response.Redirect("../index.aspx");
             }
             else
             {
                 sessionId = Convert.ToInt32(Session["sessionId"]);
                 int       studentId = 0;
                 StudentCL studentCL = new StudentCL();
                 studentId = Convert.ToInt32(Request.QueryString["studentId"]);
                 if (studentId != 0)
                 {
                     studentId = Convert.ToInt32(Request.QueryString["studentId"]);
                     studentCL = studentBLL.viewStudentById(studentId, sessionId);
                 }
                 else
                 {
                     studentId = Convert.ToInt32(Request.QueryString["admNo"]);
                     studentCL = studentBLL.viewStudentByAdmissionNo(studentId, sessionId);
                     studentId = studentCL.id;
                 }
                 //imgLogo.ImageUrl = "logo.jpg";
                 //lblStudentName.Text = studentCL.studentName;
                 //lblFatherName.Text = studentCL.fatherName;
                 //lblMotherName.Text = studentCL.motherName;
                 //lblAdmissionNo.Text = studentCL.admissionNo.ToString();
                 //lblClassSec.Text = studentCL.classSection;
                 int ut1ExamId   = reportBLL.viewExamIdByClass(studentCL.classId, "UNIT 1");
                 int ut2ExamId   = reportBLL.viewExamIdByClass(studentCL.classId, "UNIT 2");
                 int term1ExamId = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 1");
                 int term2ExamId = reportBLL.viewExamIdByClass(studentCL.classId, "ANNUAL(100)");
                 Collection <SubjectCL>    subjectCol     = subjectBLL.viewSubjectByClassId(studentCL.classId);
                 Collection <MarksEntryCL> marksColUT1    = reportBLL.viewMarksByStudentId(studentId, ut1ExamId);
                 Collection <MarksEntryCL> marksColUT2    = reportBLL.viewMarksByStudentId(studentId, ut2ExamId);
                 Collection <MarksEntryCL> marksColTERM1  = reportBLL.viewMarksByStudentId(studentId, term1ExamId);
                 Collection <MarksEntryCL> marksColTERM2  = reportBLL.viewMarksByStudentId(studentId, term2ExamId);
                 Collection <GradeEntryCL> gradesColTERM2 = reportBLL.viewGradesByStudentId(studentId, term2ExamId);
                 int         term2GenExamId    = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 2 - GENERAL");
                 MiscEntryCL remarksAttendance = reportBLL.viewMiscByStudentId(studentId, term2GenExamId);
                 for (int i = 54; i <= 71; i++)
                 {
                     DeletePractical(subjectCol, i);
                 }
                 DeletePractical(subjectCol, 116);
                 var       subjectColl = subjectCol.OrderBy(x => x.name);
                 DataTable dt          = new DataTable();
                 DataRow   dr          = null;
                 dt.Columns.Add(new DataColumn("Subjects", typeof(string)));
                 dt.Columns.Add(new DataColumn("Max. Marks", typeof(int)));
                 dt.Columns.Add(new DataColumn("Min. Marks", typeof(int)));
                 dt.Columns.Add(new DataColumn("UT-1", typeof(string)));
                 dt.Columns.Add(new DataColumn("Term-1 Practical", typeof(string)));
                 dt.Columns.Add(new DataColumn("Term-1 Theory", typeof(string)));
                 dt.Columns.Add(new DataColumn("UT-2", typeof(string)));
                 dt.Columns.Add(new DataColumn("Annual Practical", typeof(string)));
                 dt.Columns.Add(new DataColumn("Annual Theory", typeof(string)));
                 dt.Columns.Add(new DataColumn("Obtained Marks Practical", typeof(string)));
                 dt.Columns.Add(new DataColumn("Obtained Marks Theory", typeof(string)));
                 IDictionary <int, string> marksSubjectDictUT1            = new Dictionary <int, string>();
                 IDictionary <int, string> marksSubjectDictUT2            = new Dictionary <int, string>();
                 IDictionary <int, string> marksSubjectDictTERM1          = new Dictionary <int, string>();
                 IDictionary <int, string> marksPracticalSubjectDictTERM1 = new Dictionary <int, string>();
                 IDictionary <int, string> marksSubjectDictTERM2          = new Dictionary <int, string>();
                 IDictionary <int, string> marksPracticalSubjectDictTERM2 = new Dictionary <int, string>();
                 foreach (MarksEntryCL item in marksColUT1)
                 {
                     if (item.subjectId != 2 && item.subjectId != 3 && item.subjectId != 4 && item.subjectId != 5 && item.subjectId != 6 && item.subjectId != 15 && item.subjectId != 7 && item.subjectId != 11 && item.subjectId != 9 && item.subjectId != 8 && item.subjectId != 10 && item.subjectId != 14)
                     {
                         marksSubjectDictUT1.Add(item.subjectId, item.marks);
                     }
                     else
                     {
                         marksSubjectDictUT1.Add(item.subjectId, item.marks);
                     }
                 }
                 foreach (MarksEntryCL item in marksColUT2)
                 {
                     if (item.subjectId != 2 && item.subjectId != 3 && item.subjectId != 4 && item.subjectId != 5 && item.subjectId != 6 && item.subjectId != 15 && item.subjectId != 7 && item.subjectId != 11 && item.subjectId != 9 && item.subjectId != 8 && item.subjectId != 10 && item.subjectId != 14)
                     {
                         marksSubjectDictUT2.Add(item.subjectId, item.marks);
                     }
                     else
                     {
                         marksSubjectDictUT2.Add(item.subjectId, item.marks);
                     }
                 }
                 foreach (MarksEntryCL item in marksColTERM1)
                 {
                     if (item.subjectId != 2 && item.subjectId != 3 && item.subjectId != 4 && item.subjectId != 5 && item.subjectId != 6 && item.subjectId != 15 && item.subjectId != 7 && item.subjectId != 11 && item.subjectId != 9 && item.subjectId != 8 && item.subjectId != 10 && item.subjectId != 14 && item.subjectId != 115)
                     {
                         marksSubjectDictTERM1.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM1.Add(item.subjectId, string.Empty);
                     }
                     if (item.subjectId == 14)
                     {
                         marksSubjectDictTERM1.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 66));
                     }
                     if (item.subjectId == 2)
                     {
                         marksSubjectDictTERM1.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 55));
                     }
                     if (item.subjectId == 3)
                     {
                         marksSubjectDictTERM1.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 56));
                     }
                     if (item.subjectId == 4)
                     {
                         marksSubjectDictTERM1.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 57));
                     }
                     if (item.subjectId == 5)
                     {
                         marksSubjectDictTERM1.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 58));
                     }
                     if (item.subjectId == 6)
                     {
                         marksSubjectDictTERM1.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 59));
                     }
                     if (item.subjectId == 15)
                     {
                         marksSubjectDictTERM1.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 60));
                     }
                     if (item.subjectId == 7)
                     {
                         marksSubjectDictTERM1.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 61));
                     }
                     if (item.subjectId == 11)
                     {
                         marksSubjectDictTERM1.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 62));
                     }
                     if (item.subjectId == 9)
                     {
                         marksSubjectDictTERM1.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 63));
                     }
                     if (item.subjectId == 8)
                     {
                         marksSubjectDictTERM1.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 64));
                     }
                     if (item.subjectId == 10)
                     {
                         marksSubjectDictTERM1.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 65));
                     }
                     if (item.subjectId == 115)
                     {
                         marksSubjectDictTERM1.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 116));
                     }
                 }
                 foreach (MarksEntryCL item in marksColTERM2)
                 {
                     if (item.subjectId != 2 && item.subjectId != 3 && item.subjectId != 4 && item.subjectId != 5 && item.subjectId != 6 && item.subjectId != 15 && item.subjectId != 7 && item.subjectId != 11 && item.subjectId != 9 && item.subjectId != 8 && item.subjectId != 10 && item.subjectId != 14 && item.subjectId != 115)
                     {
                         marksSubjectDictTERM2.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM2.Add(item.subjectId, string.Empty);
                     }
                     if (item.subjectId == 14)
                     {
                         marksSubjectDictTERM2.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 66));
                     }
                     if (item.subjectId == 2)
                     {
                         marksSubjectDictTERM2.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 55));
                     }
                     if (item.subjectId == 3)
                     {
                         marksSubjectDictTERM2.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 56));
                     }
                     if (item.subjectId == 4)
                     {
                         marksSubjectDictTERM2.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 57));
                     }
                     if (item.subjectId == 5)
                     {
                         marksSubjectDictTERM2.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 58));
                     }
                     if (item.subjectId == 6)
                     {
                         marksSubjectDictTERM2.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 59));
                     }
                     if (item.subjectId == 15)
                     {
                         marksSubjectDictTERM2.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 60));
                     }
                     if (item.subjectId == 7)
                     {
                         marksSubjectDictTERM2.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 61));
                     }
                     if (item.subjectId == 11)
                     {
                         marksSubjectDictTERM2.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 62));
                     }
                     if (item.subjectId == 9)
                     {
                         marksSubjectDictTERM2.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 63));
                     }
                     if (item.subjectId == 8)
                     {
                         marksSubjectDictTERM2.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 64));
                     }
                     if (item.subjectId == 10)
                     {
                         marksSubjectDictTERM2.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 65));
                     }
                     if (item.subjectId == 115)
                     {
                         marksSubjectDictTERM2.Add(item.subjectId, item.marks);
                         marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 116));
                     }
                 }
                 double grandTotal = 0;
                 foreach (SubjectCL item in subjectCol)
                 {
                     dr               = dt.NewRow();
                     dr["Subjects"]   = item.name;
                     dr["Max. Marks"] = 240;
                     dr["Min. Marks"] = 96;
                     if ((marksSubjectDictUT1.ContainsKey(item.id) && marksSubjectDictTERM1.ContainsKey(item.id) && marksSubjectDictUT2.ContainsKey(item.id) && marksSubjectDictTERM2.ContainsKey(item.id)))
                     {
                         double grandTotalTheory    = 0;
                         double grandTotalPractical = 0;
                         if (marksSubjectDictUT1.ContainsKey(item.id))
                         {
                             //dr["UT-1"] = marksSubjectDictUT1[item.id];
                             //grandTotalTheory = grandTotalTheory + Convert.ToDouble(marksSubjectDictUT1[item.id]);
                         }
                         else
                         {
                             dr["UT-1"] = string.Empty;
                         }
                         if (marksSubjectDictTERM1.ContainsKey(item.id))
                         {
                             if (marksPracticalSubjectDictTERM1[item.id] == string.Empty)
                             {
                                 //grandTotalTheory = grandTotalTheory + Convert.ToDouble(marksSubjectDictTERM1[item.id]);
                             }
                             else
                             {
                                 //dr["Term-1 Practical"] = marksPracticalSubjectDictTERM1[item.id];
                                 //grandTotalTheory = grandTotalTheory + Convert.ToDouble(marksSubjectDictTERM1[item.id]);
                                 //grandTotalPractical = grandTotalPractical + Convert.ToDouble(marksPracticalSubjectDictTERM1[item.id]);
                             }
                             dr["Term-1 Theory"] = marksSubjectDictTERM1[item.id];
                         }
                         else
                         {
                             dr["Term-1 Practical"] = string.Empty;
                             dr["Term-1 Theory"]    = string.Empty;
                         }
                         if (marksSubjectDictUT2.ContainsKey(item.id))
                         {
                             //dr["UT-2"] = marksSubjectDictUT2[item.id];
                             //grandTotalTheory = grandTotalTheory + Convert.ToDouble(marksSubjectDictUT2[item.id]);
                         }
                         else
                         {
                             dr["UT-2"] = string.Empty;
                         }
                         if (marksSubjectDictTERM2.ContainsKey(item.id))
                         {
                             if (marksPracticalSubjectDictTERM2[item.id] == string.Empty)
                             {
                                 //grandTotalTheory = grandTotalTheory + (Convert.ToDouble(marksSubjectDictTERM2[item.id]));
                             }
                             else
                             {
                                 //dr["Annual Practical"] = marksPracticalSubjectDictTERM2[item.id];
                                 //grandTotalTheory = grandTotalTheory + (Convert.ToDouble(marksSubjectDictTERM2[item.id]));
                                 //grandTotalPractical = grandTotalPractical + (Convert.ToDouble(marksPracticalSubjectDictTERM2[item.id]));
                             }
                             //dr["Annual Theory"] = marksSubjectDictTERM2[item.id];
                         }
                         else
                         {
                             dr["Annual Practical"] = string.Empty;
                             dr["Annual Theory"]    = string.Empty;
                         }
                         //if (grandTotalPractical != 0)
                         //    dr["Obtained Marks Practical"] = grandTotalPractical;
                         //dr["Obtained Marks Theory"] = grandTotalTheory;
                         //grandTotal = grandTotal + grandTotalTheory + grandTotalPractical;
                     }
                     else
                     {
                         dr["UT-1"]                     = string.Empty;
                         dr["Term-1 Practical"]         = string.Empty;
                         dr["Term-1 Theory"]            = string.Empty;
                         dr["UT-2"]                     = string.Empty;
                         dr["Annual Practical"]         = string.Empty;
                         dr["Annual Theory"]            = string.Empty;
                         dr["Obtained Marks Practical"] = string.Empty;
                         dr["Obtained Marks Theory"]    = string.Empty;
                     }
                     dt.Rows.Add(dr);
                 }
                 grdMarksReport.DataSource = dt;
                 grdMarksReport.DataBind();
                 //lblGrandTotal.Text = grandTotal.ToString();
                 //lblPercentage.Text = (grandTotal / 12).ToString() + "%";
                 //lblDiscipline.Text = gradesColTERM2.Where(x => x.subjectId == 71).FirstOrDefault().grade;
                 //lblPunctuality.Text = gradesColTERM2.Where(x => x.subjectId == 67).FirstOrDefault().grade;
                 //lblRespectToGender.Text = gradesColTERM2.Where(x => x.subjectId == 68).FirstOrDefault().grade;
                 //lblAttitudeClassmates.Text = gradesColTERM2.Where(x => x.subjectId == 69).FirstOrDefault().grade;
                 //lblAttitudeTeachers.Text = gradesColTERM2.Where(x => x.subjectId == 70).FirstOrDefault().grade;
                 //lblAttendance.Text = remarksAttendance.attendance;
                 //lblRemarks.Text = remarksAttendance.remarks;
             }
         }
     }
 }
Example #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!Request.IsAuthenticated)
         {
             FormsAuthentication.RedirectToLoginPage();
         }
         else
         {
             if (Session["sessionId"] == null)
             {
                 Response.Redirect("index.aspx");
             }
             else
             {
                 if (Session["sessionId"] == null)
                 {
                     SessionCL sessionCL = sessionBLL.addorCheckSession();
                     Session["sessionId"] = sessionCL.id;
                 }
                 else
                 {
                     sessionId = Convert.ToInt32(Session["sessionId"]);
                     int       studentId = 0;
                     StudentCL studentCL = new StudentCL();
                     studentId = Convert.ToInt32(Request.QueryString["studentId"]);
                     if (studentId != 0)
                     {
                         studentId = Convert.ToInt32(Request.QueryString["studentId"]);
                         studentCL = studentBLL.viewStudentById(studentId, sessionId);
                     }
                     else
                     {
                         studentId = Convert.ToInt32(Request.QueryString["admNo"]);
                         studentCL = studentBLL.viewStudentByAdmissionNo(studentId, sessionId);
                         studentId = studentCL.id;
                     }
                     lblStudentName.Text = studentCL.studentName;
                     lblFatherName.Text  = studentCL.fatherName;
                     lblMotherName.Text  = studentCL.motherName;
                     lblAdmissionNo.Text = studentCL.admissionNo.ToString();
                     lblClassSec.Text    = studentCL.classSection;
                     int examinationId = reportBLL.viewExamIdByClass(studentCL.classId, "UNIT 2");
                     Collection <SubjectCL>    subjectCol = subjectBLL.viewSubjectByClassId(studentCL.classId);
                     Collection <MarksEntryCL> marksCol   = reportBLL.viewMarksByStudentId(studentId, examinationId);
                     MiscEntryCL remarksAttendance        = reportBLL.viewMiscByStudentId(studentId, examinationId);
                     lblAttendance.Text = remarksAttendance.attendance;
                     lblRemarks.Text    = remarksAttendance.remarks;
                     var       subjectColl = subjectCol.OrderBy(x => x.name);
                     DataTable dt          = new DataTable();
                     DataRow   dr          = null;
                     dt.Columns.Add(new DataColumn("Subjects", typeof(string)));
                     dt.Columns.Add(new DataColumn("Max. Marks", typeof(int)));
                     dt.Columns.Add(new DataColumn("Min. Marks", typeof(int)));
                     dt.Columns.Add(new DataColumn("Obtained Marks", typeof(string)));
                     IDictionary <int, string> marksSubjectDict = new Dictionary <int, string>();
                     foreach (MarksEntryCL item in marksCol)
                     {
                         marksSubjectDict.Add(item.subjectId, item.marks);
                     }
                     double grandTotal = 0;
                     for (int i = 54; i <= 71; i++)
                     {
                         DeletePractical(subjectCol, i);
                     }
                     DeletePractical(subjectCol, 116);
                     DeletePractical(subjectCol, 121);
                     DeletePractical(subjectCol, 122);
                     for (int i = 143; i <= 150; i++)
                     {
                         DeletePractical(subjectCol, i);
                     }
                     foreach (SubjectCL item in subjectCol)
                     {
                         dr               = dt.NewRow();
                         dr["Subjects"]   = item.name;
                         dr["Max. Marks"] = 20;
                         dr["Min. Marks"] = 8;
                         if (marksSubjectDict.ContainsKey(item.id))
                         {
                             dr["Obtained Marks"] = marksSubjectDict[item.id];
                             grandTotal           = grandTotal + Convert.ToDouble(marksSubjectDict[item.id]);
                         }
                         else
                         {
                             dr["Obtained Marks"] = string.Empty;
                         }
                         dt.Rows.Add(dr);
                     }
                     grdMarksReport.DataSource = dt;
                     grdMarksReport.DataBind();
                     lblGrandTotal.Text = grandTotal.ToString();
                     lblPercentage.Text = grandTotal + "%";
                 }
             }
         }
     }
 }
Example #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!Request.IsAuthenticated)
         {
             FormsAuthentication.RedirectToLoginPage();
         }
         else
         {
             if (Session["sessionId"] == null)
             {
                 Response.Redirect("../index.aspx");
             }
             else
             {
                 sessionId = Convert.ToInt32(Session["sessionId"]);
                 int       studentId = 0;
                 StudentCL studentCL = new StudentCL();
                 studentId = Convert.ToInt32(Request.QueryString["studentId"]);
                 if (studentId != 0)
                 {
                     studentId = Convert.ToInt32(Request.QueryString["studentId"]);
                     studentCL = studentBLL.viewStudentById(studentId, sessionId);
                 }
                 else
                 {
                     studentId = Convert.ToInt32(Request.QueryString["admNo"]);
                     studentCL = studentBLL.viewStudentByAdmissionNo(studentId, sessionId);
                     studentId = studentCL.id;
                 }
                 imgLogo.ImageUrl    = "logo.jpg";
                 lblStudentName.Text = studentCL.studentName;
                 lblFatherName.Text  = studentCL.fatherName;
                 lblMotherName.Text  = studentCL.motherName;
                 lblAdmissionNo.Text = studentCL.admissionNo.ToString();
                 lblClassSec.Text    = studentCL.classSection;
                 int ptId           = reportBLL.viewExamIdByClass(studentCL.classId, "Avg of Best 2 PT(5)");
                 int maId           = reportBLL.viewExamIdByClass(studentCL.classId, "MA2(5)");
                 int seaId          = reportBLL.viewExamIdByClass(studentCL.classId, "SEA2(5)");
                 int portfolioId    = reportBLL.viewExamIdByClass(studentCL.classId, "Portfolio2(5)");
                 int term1Id        = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 1(20)");
                 int term2Id        = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 2(60)");
                 int itTheoryId     = reportBLL.viewExamIdByClass(studentCL.classId, "IT Theory(50)");
                 int itPracticalId  = reportBLL.viewExamIdByClass(studentCL.classId, "IT Practical(50)");
                 int term2GenExamId = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 2 - GENERAL");
                 //int examinationId = Convert.ToInt32(Request.QueryString["examId"]);
                 //Collection<SubjectCL> subjectCol = subjectBLL.viewSubjectByClassId(studentCL.classId);
                 MiscEntryCL remarksAttendance               = reportBLL.viewMiscByStudentId(studentId, term2GenExamId);
                 Collection <MarksEntryCL> marksPTCol        = reportBLL.viewMarksByStudentId(studentId, ptId);
                 Collection <MarksEntryCL> marksMACol        = reportBLL.viewMarksByStudentId(studentId, maId);
                 Collection <MarksEntryCL> marksSEACol       = reportBLL.viewMarksByStudentId(studentId, seaId);
                 Collection <MarksEntryCL> marksPortfolioCol = reportBLL.viewMarksByStudentId(studentId, portfolioId);
                 Collection <MarksEntryCL> marksTERM1Col     = reportBLL.viewMarksByStudentId(studentId, term1Id);
                 Collection <MarksEntryCL> marksTERM2Col     = reportBLL.viewMarksByStudentId(studentId, term2Id);
                 Collection <MarksEntryCL> marksTheoryCol    = reportBLL.viewMarksByStudentId(studentId, itTheoryId);
                 Collection <MarksEntryCL> marksPracticalCol = reportBLL.viewMarksByStudentId(studentId, itPracticalId);
                 Collection <GradeEntryCL> gradeCol          = reportBLL.viewGradesByStudentId(studentId, term2GenExamId);
                 lblAttendance.Text             = remarksAttendance.attendance;
                 lblRemarks.Text                = remarksAttendance.remarks;
                 lblEnglishPT.Text              = marksPTCol.Where(x => x.subjectId == 0).FirstOrDefault().marks;
                 lblEnglishMA.Text              = marksMACol.Where(x => x.subjectId == 0).FirstOrDefault().marks;
                 lblEnglishSEA.Text             = marksSEACol.Where(x => x.subjectId == 0).FirstOrDefault().marks;
                 lblEnglishPortfolio.Text       = marksPortfolioCol.Where(x => x.subjectId == 0).FirstOrDefault().marks;
                 lblEnglishTerm1.Text           = marksTERM1Col.Where(x => x.subjectId == 0).FirstOrDefault().marks;
                 lblEnglishTerm2.Text           = marksTERM2Col.Where(x => x.subjectId == 0).FirstOrDefault().marks;
                 lblEnglishTotal.Text           = (Convert.ToDouble(lblEnglishPT.Text) + Convert.ToDouble(lblEnglishMA.Text) + Convert.ToDouble(lblEnglishSEA.Text) + Convert.ToDouble(lblEnglishPortfolio.Text) + Convert.ToDouble(lblEnglishTerm1.Text) + Convert.ToDouble(lblEnglishTerm2.Text)).ToString();
                 lblEnglishGrade.Text           = ConvertToGrade(Convert.ToDouble(lblEnglishTotal.Text));
                 lblHindiPT.Text                = marksPTCol.Where(x => x.subjectId == 13).FirstOrDefault().marks;
                 lblHindiMA.Text                = marksMACol.Where(x => x.subjectId == 13).FirstOrDefault().marks;
                 lblHindiSEA.Text               = marksSEACol.Where(x => x.subjectId == 13).FirstOrDefault().marks;
                 lblHindiPortfolio.Text         = marksPortfolioCol.Where(x => x.subjectId == 13).FirstOrDefault().marks;
                 lblHindiTerm1.Text             = marksTERM1Col.Where(x => x.subjectId == 13).FirstOrDefault().marks;
                 lblHindiTerm2.Text             = marksTERM2Col.Where(x => x.subjectId == 13).FirstOrDefault().marks;
                 lblHindiTotal.Text             = (Convert.ToDouble(lblHindiPT.Text) + Convert.ToDouble(lblHindiMA.Text) + Convert.ToDouble(lblHindiSEA.Text) + Convert.ToDouble(lblHindiPortfolio.Text) + Convert.ToDouble(lblHindiTerm1.Text) + Convert.ToDouble(lblHindiTerm2.Text)).ToString();
                 lblHindiGrade.Text             = ConvertToGrade(Convert.ToDouble(lblHindiTotal.Text));
                 lblMathematicsPT.Text          = marksPTCol.Where(x => x.subjectId == 1).FirstOrDefault().marks;
                 lblMathematicsMA.Text          = marksMACol.Where(x => x.subjectId == 1).FirstOrDefault().marks;
                 lblMathematicsSEA.Text         = marksSEACol.Where(x => x.subjectId == 1).FirstOrDefault().marks;
                 lblMathematicsPortfolio.Text   = marksPortfolioCol.Where(x => x.subjectId == 1).FirstOrDefault().marks;
                 lblMathematicsTerm1.Text       = marksTERM1Col.Where(x => x.subjectId == 1).FirstOrDefault().marks;
                 lblMathematicsTerm2.Text       = marksTERM2Col.Where(x => x.subjectId == 1).FirstOrDefault().marks;
                 lblMathematicsTotal.Text       = (Convert.ToDouble(lblMathematicsPT.Text) + Convert.ToDouble(lblMathematicsMA.Text) + Convert.ToDouble(lblMathematicsSEA.Text) + Convert.ToDouble(lblMathematicsPortfolio.Text) + Convert.ToDouble(lblMathematicsTerm1.Text) + Convert.ToDouble(lblMathematicsTerm2.Text)).ToString();
                 lblMathematicsGrade.Text       = ConvertToGrade(Convert.ToDouble(lblMathematicsTotal.Text));
                 lblSciencePT.Text              = marksPTCol.Where(x => x.subjectId == 29).FirstOrDefault().marks;
                 lblScienceMA.Text              = marksMACol.Where(x => x.subjectId == 29).FirstOrDefault().marks;
                 lblScienceSEA.Text             = marksSEACol.Where(x => x.subjectId == 29).FirstOrDefault().marks;
                 lblSciencePortfolio.Text       = marksPortfolioCol.Where(x => x.subjectId == 29).FirstOrDefault().marks;
                 lblScienceTerm1.Text           = marksTERM1Col.Where(x => x.subjectId == 29).FirstOrDefault().marks;
                 lblScienceTerm2.Text           = marksTERM2Col.Where(x => x.subjectId == 29).FirstOrDefault().marks;
                 lblScienceTotal.Text           = (Convert.ToDouble(lblSciencePT.Text) + Convert.ToDouble(lblScienceMA.Text) + Convert.ToDouble(lblScienceSEA.Text) + Convert.ToDouble(lblSciencePortfolio.Text) + Convert.ToDouble(lblScienceTerm1.Text) + Convert.ToDouble(lblScienceTerm2.Text)).ToString();
                 lblScienceGrade.Text           = ConvertToGrade(Convert.ToDouble(lblScienceTotal.Text));
                 lblSocialSciencePT.Text        = marksPTCol.Where(x => x.subjectId == 35).FirstOrDefault().marks;
                 lblSocialScienceMA.Text        = marksMACol.Where(x => x.subjectId == 35).FirstOrDefault().marks;
                 lblSocialScienceSEA.Text       = marksSEACol.Where(x => x.subjectId == 35).FirstOrDefault().marks;
                 lblSocialSciencePortfolio.Text = marksPortfolioCol.Where(x => x.subjectId == 35).FirstOrDefault().marks;
                 lblSocialScienceTerm1.Text     = marksTERM1Col.Where(x => x.subjectId == 35).FirstOrDefault().marks;
                 lblSocialScienceTerm2.Text     = marksTERM2Col.Where(x => x.subjectId == 35).FirstOrDefault().marks;
                 lblSocialScienceTotal.Text     = (Convert.ToDouble(lblSocialSciencePT.Text) + Convert.ToDouble(lblSocialScienceMA.Text) + Convert.ToDouble(lblSocialScienceSEA.Text) + Convert.ToDouble(lblSocialSciencePortfolio.Text) + Convert.ToDouble(lblSocialScienceTerm1.Text) + Convert.ToDouble(lblSocialScienceTerm2.Text)).ToString();
                 lblSocialScienceGrade.Text     = ConvertToGrade(Convert.ToDouble(lblSocialScienceTotal.Text));
                 lblITTheory.Text               = marksTheoryCol.FirstOrDefault().marks;
                 lblITPractical.Text            = marksPracticalCol.FirstOrDefault().marks;
                 lblITTotal.Text                = (Convert.ToDouble(lblITTheory.Text) + Convert.ToDouble(lblITPractical.Text)).ToString();
                 lblITGrade.Text                = ConvertToGrade(Convert.ToDouble(lblITTotal.Text));
                 lblGrandTotal.Text             = Math.Ceiling(Convert.ToDouble(lblEnglishTotal.Text) + Convert.ToDouble(lblHindiTotal.Text) + Convert.ToDouble(lblMathematicsTotal.Text) + Convert.ToDouble(lblScienceTotal.Text) + Convert.ToDouble(lblSocialScienceTotal.Text)).ToString();
                 lblPercentage.Text             = Math.Ceiling(Convert.ToDouble(lblGrandTotal.Text) / 5).ToString();
                 lblGrade.Text       = ConvertToGrade(Convert.ToDouble(lblPercentage.Text)).ToString();
                 lblArtEdu.Text      = gradeCol.Where(x => x.subjectId == 52).FirstOrDefault().grade;
                 lblWorkEdu.Text     = gradeCol.Where(x => x.subjectId == 51).FirstOrDefault().grade;
                 lblPhysicalEdu.Text = gradeCol.Where(x => x.subjectId == 53).FirstOrDefault().grade;
             }
         }
     }
 }