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
        /// <summary>
        /// This method Checks If Session for current Year is there or Adds it if it is not there.
        /// </summary>
        /// <returns>SessionCL Class for Checked or Current Session.</returns>
        public SessionCL addorCheckSession()
        {
            SessionCL sessionCL        = new SessionCL();
            bool      sessionAvailable = false;

            foreach (SessionCL item in viewSession())
            {
                DateTime dateToday = new DateTime(item.endingYear, 03, 31);
                if (dateToday <= DateTime.Now)
                {
                    sessionAvailable       = true;
                    sessionCL.id           = item.id;
                    sessionCL.startingYear = item.startingYear;
                    sessionCL.endingYear   = item.endingYear;
                }
            }
            if (sessionAvailable == false)
            {
                Session sessionQuery = dbcontext.Sessions.Add(new Session
                {
                    Id           = 0,
                    StartingYear = (DateTime.Now.Year) - 1,
                    EndingYear   = DateTime.Now.Year,
                });
                dbcontext.SaveChanges();
                sessionCL.id           = sessionQuery.Id;
                sessionCL.startingYear = sessionQuery.StartingYear;
                sessionCL.endingYear   = sessionQuery.EndingYear;
            }
            ;
            return(sessionCL);
        }
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
             {
                 sessionId             = Convert.ToInt32(Session["sessionId"]);
                 grdStudent.DataSource = studentBLL.viewStudents(sessionId);
                 ViewState["students"] = studentBLL.viewStudents(sessionId);
                 grdStudent.DataBind();
             }
         }
     }
 }
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
             {
                 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.º 5
0
        public SessionCL viewSessionById(int sessionId)
        {
            Session   querySessionDB = (from x in dbcontext.Sessions where x.Id == sessionId select x).FirstOrDefault();
            SessionCL SessionCL      = new SessionCL()
            {
                id           = querySessionDB.Id,
                endingYear   = querySessionDB.EndingYear,
                startingYear = querySessionDB.StartingYear,
            };

            return(SessionCL);
        }
Ejemplo n.º 6
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.º 7
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.º 8
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.º 9
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();
             }
         }
     }
 }
Ejemplo n.º 10
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
             {
                 sessionId         = Convert.ToInt32(Session["sessionId"]);
                 ViewState["misc"] = grdMisc.DataSource = reportBLL.viewMiscellaneous(sessionId);
                 grdMisc.DataBind();
             }
         }
     }
 }
Ejemplo n.º 11
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 + "%";
                 }
             }
         }
     }
 }