Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!Request.IsAuthenticated)
         {
             FormsAuthentication.RedirectToLoginPage();
         }
         else
         {
             FormsAuthenticationTicket ticket = (FormsAuthentication.Decrypt(Session["auth"].ToString()));
             string userId = ticket.UserData.Split(';')[0];
             string role   = ticket.UserData.Split(';')[1];
             if (Session["sessionId"] == null)
             {
                 SessionCL sessionCL = sessionBLL.addorCheckSession();
                 Session["sessionId"] = sessionCL.id;
             }
             else if (role.ToLower() == "teacher" || role.ToLower() == "attendanceo")
             {
                 Response.Redirect("../UnAuthorized.aspx");
             }
             grdSession.DataSource = sessionBLL.viewSession();
             grdSession.DataBind();
         }
     }
 }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!Request.IsAuthenticated)
         {
             FormsAuthentication.RedirectToLoginPage();
         }
         else
         {
             FormsAuthenticationTicket ticket = (FormsAuthentication.Decrypt(Session["auth"].ToString()));
             string userId = ticket.UserData.Split(';')[0];
             string role   = ticket.UserData.Split(';')[1];
             if (Session["sessionId"] == null)
             {
                 SessionCL sessionCL = sessionBLL.addorCheckSession();
                 Session["sessionId"] = sessionCL.id;
             }
             else
             {
                 sessionId             = Convert.ToInt32(Session["sessionId"]);
                 grdStudent.DataSource = studentBLL.viewStudents(sessionId);
                 ViewState["students"] = studentBLL.viewStudents(sessionId);
                 grdStudent.DataBind();
             }
         }
     }
 }
Ejemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!Request.IsAuthenticated)
         {
             FormsAuthentication.RedirectToLoginPage();
         }
         else
         {
             FormsAuthenticationTicket ticket = (FormsAuthentication.Decrypt(Session["auth"].ToString()));
             string userId = ticket.UserData.Split(';')[0];
             string role   = ticket.UserData.Split(';')[1];
             if (Session["sessionId"] == null)
             {
                 SessionCL sessionCL = sessionBLL.addorCheckSession();
                 Session["sessionId"] = sessionCL.id;
             }
             else if (role.ToLower() == "teacher" || role.ToLower() == "attendanceo")
             {
                 Response.Redirect("../UnAuthorized.aspx");
             }
             else
             {
                 sessionId = Convert.ToInt32(Session["sessionId"]);
                 if (Request.QueryString["examinationId"] != null)
                 {
                     int examId = Convert.ToInt32(Request.QueryString["examinationId"]);
                     lblHeading.Text         = "Update Examination";
                     ddlClass.DataSource     = classBLL.viewClasses(sessionId);
                     ddlClass.DataValueField = "id";
                     ddlClass.DataTextField  = "classSection";
                     ddlClass.DataBind();
                     ExaminationCL examCL = examinationBLL.viewExaminationById(examId);
                     ddlClass.SelectedValue = examCL.classId.ToString();
                     txtExamination.Text    = examCL.name;
                     txtDateCreated.Text    = examCL.dateCreated.ToString("dd MMMM yyyy");
                     txtDateUpdated.Text    = examCL.dateModified.ToString("dd MMMM yyyy");
                     btnSubmit.Text         = "Update";
                     btnDelete.Visible      = true;
                 }
                 else
                 {
                     lblHeading.Text         = "Add Examination";
                     ddlClass.DataSource     = classBLL.viewClasses(sessionId);
                     ddlClass.DataValueField = "id";
                     ddlClass.DataTextField  = "classSection";
                     ddlClass.DataBind();
                     btnSubmit.Text    = "Submit";
                     btnDelete.Visible = false;
                 }
             }
         }
     }
 }
Ejemplo n.º 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!Request.IsAuthenticated)
         {
             FormsAuthentication.RedirectToLoginPage();
         }
         else
         {
             FormsAuthenticationTicket ticket = (FormsAuthentication.Decrypt(Session["auth"].ToString()));
             string userId = ticket.UserData.Split(';')[0];
             string role   = ticket.UserData.Split(';')[1];
             if (Session["sessionId"] == null)
             {
                 SessionCL sessionCL = sessionBLL.addorCheckSession();
                 Session["sessionId"] = sessionCL.id;
             }
             else if (role.ToLower() == "teacher" || role.ToLower() == "attendanceo")
             {
                 Response.Redirect("../UnAuthorized.aspx");
             }
             else
             {
                 if (Request.QueryString["classId"] != null)
                 {
                     int classId = Convert.ToInt32(Request.QueryString["classId"]);
                     lblHeading.Text = "Update Class";
                     ClassCL classCL = classBLL.viewClassById(classId);
                     txtClass.Text         = classCL.class1;
                     txtSection.Text       = classCL.section;
                     txtTotalStrength.Text = classCL.totalStrength.ToString();
                     txtDateCreated.Text   = classCL.dateCreated.ToString("dd MMMM yyyy");
                     txtDateUpdated.Text   = classCL.dateModified.ToString("dd MMMM yyyy");
                 }
                 else
                 {
                     lblHeading.Text = "Add Class";
                 }
             }
         }
     }
 }
Ejemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!Request.IsAuthenticated)
         {
             FormsAuthentication.RedirectToLoginPage();
         }
         else
         {
             FormsAuthenticationTicket ticket = (FormsAuthentication.Decrypt(Session["auth"].ToString()));
             string userId = ticket.UserData.Split(';')[0];
             string role   = ticket.UserData.Split(';')[1];
             if (Session["sessionId"] == null)
             {
                 Response.Redirect("index.aspx");
             }
             else if (role.ToLower() == "teacher" || role.ToLower() == "attendanceo")
             {
                 Response.Redirect("../UnAuthorized.aspx");
             }
             else
             {
                 if (Session["sessionId"] == null)
                 {
                     SessionCL sessionCL = sessionBLL.addorCheckSession();
                     Session["sessionId"] = sessionCL.id;
                 }
                 else
                 {
                     sessionId = Convert.ToInt32(Session["sessionId"]);
                     Collection <ClassCL> classCol = classBLL.viewClasses(sessionId);
                     ddlClass.DataSource     = classCol;
                     ddlClass.DataValueField = "id";
                     ddlClass.DataTextField  = "classSection";
                     ddlClass.DataBind();
                 }
             }
         }
     }
 }
Ejemplo n.º 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!Request.IsAuthenticated || Session["auth"] == null)
         {
             FormsAuthentication.RedirectToLoginPage();
         }
         else
         {
             if (Session["sessionId"] == null)
             {
                 SessionCL sessionCL = sessionBLL.addorCheckSession();
                 Session["sessionId"] = sessionCL.id;
             }
             FormsAuthenticationTicket ticket = (FormsAuthentication.Decrypt(Session["auth"].ToString()));
             //string userId = ticket.UserData.Split(';')[0];
             //string role = ticket.UserData.Split(';')[1];
             lblName.Text = ticket.Name;
         }
     }
 }
Ejemplo n.º 7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!Request.IsAuthenticated)
         {
             FormsAuthentication.RedirectToLoginPage();
         }
         else
         {
             if (Session["sessionId"] == null)
             {
                 SessionCL sessionCL = sessionBLL.addorCheckSession();
                 Session["sessionId"] = sessionCL.id;
             }
             else
             {
                 grdStudent.DataSource = FetchControls();
                 grdStudent.DataBind();
             }
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!Request.IsAuthenticated)
         {
             FormsAuthentication.RedirectToLoginPage();
         }
         else
         {
             if (Session["sessionId"] == null)
             {
                 SessionCL sessionCL = sessionBLL.addorCheckSession();
                 Session["sessionId"] = sessionCL.id;
             }
             else
             {
                 sessionId         = Convert.ToInt32(Session["sessionId"]);
                 ViewState["misc"] = grdMisc.DataSource = reportBLL.viewMiscellaneous(sessionId);
                 grdMisc.DataBind();
             }
         }
     }
 }
Ejemplo n.º 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 + "%";
                 }
             }
         }
     }
 }