Exemplo n.º 1
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        using (SqlConnection fu = new SqlConnection(Util.GetConnection()))
        {
            Util    audlog = new Util();
            Cryptic DE     = new Cryptic();
            fu.Open();
            //string wai = "";
            //if (txtPassword.Text == "")
            //{
            //    wai = "@UPDATE TEACHER_MAIN SET Teacher_ID=@TID Teacher_FirstName=@TFN, Teacher_MiddleName=@TMN, Teacher_LastName=@TLN WHERE User_ID = @UID";
            //}
            //else
            //{
            string wai = @"UPDATE TEACHER_MAIN SET Teacher_PW=@TPW, Teacher_FirstName=@TFN, Teacher_MiddleName=@TMN, Teacher_LastName=@TLN, Department=@Department WHERE Teacher_ID = @Teacher_ID";
            //}
            using (SqlCommand best = new SqlCommand(wai, fu))
            {
                best.Parameters.AddWithValue("@Teacher_ID", Session["Teacher_ID"].ToString());
                best.Parameters.AddWithValue("@TPW", txtPassword.Text);
                best.Parameters.AddWithValue("@TFN", txtFN.Text);
                best.Parameters.AddWithValue("@TMN", txtMN.Text);
                best.Parameters.AddWithValue("@TLN", txtLN.Text);
                best.Parameters.AddWithValue("@Department", txtDept.Text);

                audlog.AuditLogAdmin(DE.Encrypt("Edit Faculty Profile"), int.Parse(Session["user_id"].ToString()), DE.Encrypt("Edited by Teacher "
                                                                                                                              + Session["teacher_firstname"].ToString() + " " + Session["teacher_middlename"].ToString() + Session["teacher_lastname"].ToString()));
                best.ExecuteNonQuery();
                Response.Redirect("Profile.aspx");
            }
            fu.Close();
        }
    }
Exemplo n.º 2
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        using (SqlConnection Rikka = new SqlConnection(Dekomori.GetConnection()))
        {
            Cryptic  DE     = new Cryptic();
            Dekomori audlog = new Dekomori();
            Rikka.Open();
            string Takanashi = @"UPDATE ADMIN_MAIN SET User_ID=@User_ID, UserType_ID=@UserType_ID, Admin_PW=@PW WHERE Admin_ID=@Admin_ID";

            using (SqlCommand WickedEye = new SqlCommand(Takanashi, Rikka))
            {
                WickedEye.Parameters.AddWithValue("@AID", Session["Admin_ID"].ToString());

                //Admin Access Level
                WickedEye.Parameters.AddWithValue("@User_ID", txtUID.Text);
                WickedEye.Parameters.AddWithValue("@UserType_ID", ddlUsers.Text);
                WickedEye.Parameters.AddWithValue("@PW", txtPass.Text);
                WickedEye.Parameters.AddWithValue("@Admin_ID", Request.QueryString["ID"].ToString());
                WickedEye.ExecuteNonQuery();
                //Nathaniel Collins S. Ortiz V
                audlog.AuditLogAdmin(DE.Encrypt("Editing an Admin"), int.Parse(Session["user_id"].ToString()), DE.Encrypt("Edited by IT Admin"
                                                                                                                          + Session["first_name"].ToString() + " " + Session["middle_name"].ToString() + " " + Session["last_name"].ToString()));
                Response.Redirect("ViewAdmin.aspx");
            }
        }
    }
Exemplo n.º 3
0
    //WickedEye.CommandText = "SELECT COUNT(*) from SUBJECT_MAIN ";
    //          Int32 count = (Int32)WickedEye.ExecuteScalar();

    //void Count()
    //{
    //    using (SqlConnection con = new SqlConnection(Util.GetConnection()))
    //    {
    //        con.Open();
    //        string pleasefortheloveofgodwok = "SELECT COUNT(*) from SUBJECT_MAIN where Teacher_ID=@TID";
    //        using (SqlCommand com = new SqlCommand(pleasefortheloveofgodwok, con))
    //        {
    //            com.Parameters.AddWithValue("@TID", ddlTeacher.Text);
    //            com.ExecuteNonQuery();

    //        }

    //    }

    //}

    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        using (SqlConnection Rikka = new SqlConnection(Dekomori.GetConnection()))
        {
            Util    audlog = new Util();
            Cryptic DE     = new Cryptic();
            Rikka.Open();
            string     Takanashi = @"UPDATE SUBJECT_MAIN SET Teacher_ID=@Teacher_ID WHERE
                                Subject_ID=@Subject_ID";
            string     gg        = "SELECT COUNT(Teacher_ID) from SUBJECT_MAIN where Teacher_ID= '" + ddlTeacher.Text + "'";
            SqlCommand com       = new SqlCommand(gg, Rikka);
            int        count     = Convert.ToInt32(com.ExecuteScalar().ToString());

            using (SqlCommand WickedEye = new SqlCommand(Takanashi, Rikka))
            {
                WickedEye.Parameters.AddWithValue("@Admin_ID", Session["Admin_ID"].ToString());
                //Subject
                WickedEye.Parameters.AddWithValue("@Teacher_ID", ddlTeacher.Text);
                WickedEye.Parameters.AddWithValue("@Subject_ID", Request.QueryString["ID"].ToString());


                if (count == 2)
                {
                    error.Visible = true;
                }
                else
                {
                    WickedEye.ExecuteNonQuery();
                    Rikka.Close();
                    audlog.AuditLogAdmin(DE.Encrypt("Assigning Faculty with Subject"), int.Parse(Session["user_id"].ToString()), DE.Encrypt("Faculty assigned by Principal "
                                                                                                                                            + Session["first_name"].ToString() + " " + Session["middle_name"].ToString() + " " + Session["last_name"].ToString()));

                    Session["add"] = add.Text;
                    Response.Redirect("ViewSubject.aspx");
                }
                //SqlDataReader dr = WickedEye.ExecuteReader();
                //int count=2;
                //if (dr.HasRows)
                //{
                //    while (dr.Read())
                //    {
                //    }
                //}
                //else
                //{
                //    error.Visible = true;
                //}



                //Nathaniel Collins S. Ortiz
            }
        }
    }
Exemplo n.º 4
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        using (SqlConnection Rikka = new SqlConnection(Dekomori.GetConnection()))
        {
            Util    audlog = new Util();
            Cryptic DE     = new Cryptic();
            Rikka.Open();
            string Takanashi = @"UPDATE SCHEDULE SET Subject_ID=@Subject_ID WHERE
                                ScheduleID=@ScheduleID";

            string time = @"UPDATE SCHEDULE SET Timeslot_ID=@Timeslot_ID WHERE
                                 ScheduleID=@ScheduleID";

            string     validate = @"SELECT COUNT (Section_ID) FROM SCHEDULE WHERE Timeslot_ID = '" + ddlTime.Text + "' ";
            SqlCommand con      = new SqlCommand(validate, Rikka);
            int        count    = Convert.ToInt32(con.ExecuteScalar().ToString());

            using (SqlCommand WickedEye = new SqlCommand(Takanashi, Rikka))
            {   //Nathaniel Collins S. Ortiz
                WickedEye.Parameters.AddWithValue("@Admin_ID", Session["Admin_ID"].ToString());

                //Subject
                WickedEye.Parameters.AddWithValue("@Subject_ID", ddlSubject.Text);
                WickedEye.Parameters.AddWithValue("@ScheduleID", Request.QueryString["ID"].ToString());
                WickedEye.ExecuteNonQuery();
            }
            using (SqlCommand cmd = new SqlCommand(time, Rikka))
            {
                //Time
                cmd.Parameters.AddWithValue("@Timeslot_ID", ddlTime.Text);
                cmd.Parameters.AddWithValue("@ScheduleID", Request.QueryString["ID"].ToString());

                if (count == 1)
                {
                    error.Visible = true;
                }
                else
                {
                    cmd.ExecuteNonQuery();
                    //Nathaniel Collins S. Ortiz V
                    audlog.AuditLogAdmin(DE.Encrypt("Edit Schedule"), int.Parse(Session["admin_id"].ToString()), DE.Encrypt("Schedule has been Edited by "
                                                                                                                            + Session["first_name"].ToString() + " " + Session["middle_name"].ToString() + " " + Session["last_name"].ToString()));

                    Session["addsub"] = error.Text;
                    Response.Redirect("Schedule.aspx");
                }
            }
        }
    }
Exemplo n.º 5
0
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        int gradeStatus = GradeStatus();
        int sy          = SY();
        int quarter     = Quarter();

        if (gradeStatus == 1)
        {
            using (SqlConnection con = new SqlConnection(Util.GetConnection()))
            {
                Util    audlog = new Util();
                Cryptic DE     = new Cryptic();
                con.Open();
                string SQL = @"INSERT INTO GRADE_INFO(Student_ID, Teacher_ID, Grade_Value, SY, Quarter, Subject_ID) 
                            VALUES (@SID, @TID, @Grade_Value, @SY, @Quarter, @Subject_ID)";

                using (SqlCommand cmd = new SqlCommand(SQL, con))
                {
                    cmd.Parameters.AddWithValue("@SID", Request.QueryString["ID"].ToString());

                    cmd.Parameters.AddWithValue("@TID", Session["Teacher_ID"].ToString());

                    cmd.Parameters.AddWithValue("@Grade_Value", txtGrade.Text);


                    cmd.Parameters.AddWithValue("@SY", sy);

                    cmd.Parameters.AddWithValue("@Quarter", quarter);
                    cmd.Parameters.AddWithValue("@Subject_ID", ddlSubject.Text);


                    cmd.ExecuteNonQuery();
                    audlog.AuditLogAdmin(DE.Encrypt("Add Grade"), int.Parse(Session["user_id"].ToString()), DE.Encrypt("Added by Teacher "
                                                                                                                       + Session["teacher_firstname"].ToString() + " " + Session["teacher_middlename"].ToString() + Session["teacher_lastname"].ToString()));
                    Response.Redirect("StudentList.aspx");
                }
            }
        }

        else
        {
            error.Visible = true;
        }
    }
Exemplo n.º 6
0
    protected void lvAnnouncement_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        Util    audlog            = new Util();
        Cryptic DE                = new Cryptic();
        Literal ltAnnouncement_ID = (Literal)e.Item.FindControl("ltAnnouncement_ID");

        if (e.CommandName == "delfile")
        {
            using (SqlConnection con = new SqlConnection(Util.GetConnection()))
            {
                con.Open();
                string DELETE = @"DELETE FROM ANNOUNCEMENT WHERE Announcement_ID=@Announcement_ID";
                using (SqlCommand Nero = new SqlCommand(DELETE, con))
                {
                    Nero.Parameters.AddWithValue("@Announcement_ID", ltAnnouncement_ID.Text);
                    Nero.ExecuteNonQuery();
                    audlog.AuditLogAdmin(DE.Encrypt("Delete Announcements"), int.Parse(Session["user_id"].ToString()), DE.Encrypt("Delete by Student "
                                                                                                                                  + Session["teacher_firstname"].ToString() + " " + Session["teacher_middlename"].ToString() + Session["teacher_lastname"].ToString()));
                }
            }
        }
    }
Exemplo n.º 7
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        using (SqlConnection con = new SqlConnection(Util.GetConnection()))
        {
            Util    audlog = new Util();
            Cryptic DE     = new Cryptic();
            con.Open();

            string SQL = @"Select Student_ID,First_Name,Middle_Name,Last_Name, UserType_ID, Parent_UserID, Parent_Password FROM STUDENT_MAIN
                         WHERE Parent_UserID=@Parent_UserID AND Parent_Password=@Parent_Password";

            using (SqlCommand com = new SqlCommand(SQL, con))
            {
                com.Parameters.AddWithValue("@Parent_UserID", txtUID.Text);
                com.Parameters.AddWithValue("@Parent_Password", txtPWD.Text);
                using (SqlDataReader data = com.ExecuteReader())
                {
                    if (data.HasRows)
                    {
                        while (data.Read())
                        {
                            Session["student_id"]  = data["Student_ID"].ToString();
                            Session["first_name"]  = data["First_Name"].ToString();
                            Session["middle_name"] = data["Middle_Name"].ToString();
                            Session["last_name"]   = data["Last_Name"].ToString();
                            Session["usertype_id"] = data["UserType_ID"].ToString();
                        }
                        audlog.AuditLogAdmin(DE.Encrypt("Log-In(Parents)"), int.Parse(Session["student_id"].ToString()), DE.Encrypt("Logged-In by " + Session["first_name"].ToString()
                                                                                                                                    + " " + Session["middle_name"].ToString() + Session["last_name"].ToString()));
                        Response.Redirect("CompleteStudentList.aspx");
                    }
                    else
                    {
                        error.Visible = true;
                    }
                }
            }
        }
    }
Exemplo n.º 8
0
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        using (SqlConnection con = new SqlConnection(Util.GetConnection()))
        {
            Util    audlog = new Util();
            Cryptic DE     = new Cryptic();
            con.Open();
            string SQL = @"INSERT INTO UPLOAD_LECTURE(Title, Description, FileContent, DateAdded, Teacher_ID, Subject_ID) 
                            VALUES (@Title, @Description, @FileContent, @DateAdded, @TeacherID, @Subject)";

            using (SqlCommand cmd = new SqlCommand(SQL, con))
            {
                //audit
                cmd.Parameters.AddWithValue("@TeacherID", Session["Teacher_ID"].ToString());
                //

                cmd.Parameters.AddWithValue("@Subject", ddlSubject.Text);

                cmd.Parameters.AddWithValue("@Title", txtTitle.Text);
                cmd.Parameters.AddWithValue("@Description", txtDescription.Text);

                string fileExt = Path.GetExtension(FileContent.FileName);
                string id      = Guid.NewGuid().ToString();
                cmd.Parameters.AddWithValue("@FileContent", id + fileExt);
                FileContent.SaveAs(Server.MapPath("~/img/files/" + id + fileExt));

                cmd.Parameters.AddWithValue("@DateAdded", DateTime.Now);


                cmd.ExecuteNonQuery();

                audlog.AuditLogAdmin(DE.Encrypt("Added Lectures"), int.Parse(Session["user_id"].ToString()), DE.Encrypt("Added by Teacher "
                                                                                                                        + Session["teacher_firstname"].ToString() + " " + Session["teacher_middlename"].ToString() + Session["teacher_lastname"].ToString()));
                //audlog.AuditLogTeacher("Add Lectures", int.Parse(Session["teacher_id"].ToString()), "Added Lectures by "
                //            + Session["teacher_firstname"].ToString() + " " + Session["teacher_middlename"].ToString() + Session["teacher_lastname"].ToString());
                Response.Redirect("ViewLectures.aspx");
            }
        }
    }
Exemplo n.º 9
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        using (SqlConnection Rikka = new SqlConnection(Dekomori.GetConnection()))
        {
            Util    audlog = new Util();
            Cryptic DE     = new Cryptic();
            Rikka.Open();
            string Takanashi = @"INSERT INTO TEACHER_MAIN(Teacher_PW, Teacher_FirstName, Teacher_LastName, Teacher_MiddleName, User_ID, HomeroomStat_ID, Section_ID, Image)
                            VALUES(@Teacher_PW, @Teacher_FirstName, @Teacher_LastName, @Teacher_MiddleName, @User_ID, @HID, @SecID, @Image) ";



            using (SqlCommand WickedEye = new SqlCommand(Takanashi, Rikka))
            {
                //Audit Session
                WickedEye.Parameters.AddWithValue("@AID", Session["Admin_ID"].ToString());
                //
                WickedEye.Parameters.AddWithValue("@HID", 2);
                WickedEye.Parameters.AddWithValue("@SecID", 21);

                string fileExt = Path.GetExtension(fuImage.FileName);
                string id      = Guid.NewGuid().ToString();
                WickedEye.Parameters.AddWithValue("@Image", id + fileExt);
                fuImage.SaveAs(Server.MapPath("~/img/faculty/" + id + fileExt));

                WickedEye.Parameters.AddWithValue("@Teacher_FirstName", txtFN.Text);
                WickedEye.Parameters.AddWithValue("@Teacher_LastName", txtLN.Text);
                WickedEye.Parameters.AddWithValue("@Teacher_MiddleName", txtMN.Text);
                WickedEye.Parameters.AddWithValue("@User_ID", txtUID.Text);
                WickedEye.Parameters.AddWithValue("@Teacher_PW", txtPass.Text);

                WickedEye.ExecuteNonQuery();
                audlog.AuditLogAdmin(DE.Encrypt("Adding a Faculty"), int.Parse(Session["user_id"].ToString()), DE.Encrypt("Added by Principal "
                                                                                                                          + Session["first_name"].ToString() + " " + Session["middle_name"].ToString() + " " + Session["last_name"].ToString()));
                Response.Redirect("FacultyList.aspx");
            }
        }
    }
Exemplo n.º 10
0
    protected void lvStudents_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        Util    audlog    = new Util();
        Cryptic DE        = new Cryptic();
        Literal ltGradeID = (Literal)e.Item.FindControl("ltGradeID");

        if (e.CommandName == "delfile")
        {
            using (SqlConnection con = new SqlConnection(Util.GetConnection()))
            {
                con.Open();
                string DELETE = @"DELETE FROM GRADE_INFO WHERE Grade_ID=@Grade_ID";
                using (SqlCommand Nero = new SqlCommand(DELETE, con))
                {
                    Nero.Parameters.AddWithValue("@Grade_ID", ltGradeID.Text);
                    Nero.ExecuteNonQuery();
                    audlog.AuditLogAdmin(DE.Encrypt("Deleted Grade"), int.Parse(Session["user_id"].ToString()), DE.Encrypt("Deleted by Teacher "
                                                                                                                           + Session["teacher_firstname"].ToString() + " " + Session["teacher_middlename"].ToString() + Session["teacher_lastname"].ToString()));
                    Response.Redirect("StudentList.aspx");
                }
            }
        }
    }
Exemplo n.º 11
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        using (SqlConnection Rikka = new SqlConnection(Dekomori.GetConnection()))
        {
            Util    audlog = new Util();
            Cryptic DE     = new Cryptic();
            Rikka.Open();
            string Takanashi = @"UPDATE ENCODING_STATUS SET Grade_StatusID=@GID WHERE
                                EncodingStat_ID=1";


            using (SqlCommand WickedEye = new SqlCommand(Takanashi, Rikka))
            {
                WickedEye.Parameters.AddWithValue("@Admin_ID", Session["Admin_ID"].ToString());

                //Subject
                WickedEye.Parameters.AddWithValue("@GID", ddlStatus.Text);



                WickedEye.ExecuteNonQuery();

                //Nathaniel Collins S. Ortiz
                audlog.AuditLogAdmin(DE.Encrypt("Updated Encoding Status"), int.Parse(Session["admin_id"].ToString()), DE.Encrypt("Encoding Status updated by "
                                                                                                                                  + Session["first_name"].ToString() + " " + Session["middle_name"].ToString() + " " + Session["last_name"].ToString()));

                if (ddlStatus.Text == "1")
                {
                    Response.Redirect("SetQuarterSY.aspx");
                }
                else
                {
                    error.Visible = true;
                }
            }
        }
    }
Exemplo n.º 12
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        using (SqlConnection con = new SqlConnection(Util.GetConnection()))
        {
            Util    audlog = new Util();
            Cryptic DE     = new Cryptic();
            string  sql    = @"UPDATE SECTION SET Section_Name=@SN,Year_Level=@YL WHERE Section_ID = @SID";
            con.Open();

            using (SqlCommand com = new SqlCommand(sql, con))
            {
                //Audit Session
                com.Parameters.AddWithValue("@Admin_ID", Session["Admin_ID"].ToString());
                //
                com.Parameters.AddWithValue("@SN", txtSName.Text);
                com.Parameters.AddWithValue("@YL", txtYL.Text);
                com.Parameters.AddWithValue("@SID", Request.QueryString["ID"].ToString());
                com.ExecuteNonQuery();
                audlog.AuditLogAdmin(DE.Encrypt("Editing Details for Section"), int.Parse(Session["user_id"].ToString()), DE.Encrypt("Edited Section by Registrar "
                                                                                                                                     + Session["first_name"].ToString() + " " + Session["middle_name"].ToString() + " " + Session["last_name"].ToString()));
                Response.Redirect("ViewSection.aspx");
            }
        }
    }
Exemplo n.º 13
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        using (SqlConnection Rikka = new SqlConnection(Dekomori.GetConnection()))
        {
            Util    audlog = new Util();
            Cryptic DE     = new Cryptic();
            Rikka.Open();
            string Takanashi = @"UPDATE STUDENT_MAIN SET Section_ID=@Section_ID WHERE
                                Student_ID=@Student_ID";


            using (SqlCommand WickedEye = new SqlCommand(Takanashi, Rikka))
            {
                //Subject
                WickedEye.Parameters.AddWithValue("@Section_ID", ddlSection.Text);
                WickedEye.Parameters.AddWithValue("@Student_ID", Request.QueryString["ID"].ToString());

                audlog.AuditLogAdmin(DE.Encrypt("Assigned Student Section"), int.Parse(Session["user_id"].ToString()), DE.Encrypt("Input assigned by Registrar "
                                                                                                                                  + Session["first_name"].ToString() + " " + Session["middle_name"].ToString() + " " + Session["last_name"].ToString()));
                WickedEye.ExecuteNonQuery();
                Response.Redirect("StudentList.aspx");
            }
        }
    }
Exemplo n.º 14
0
    void LogInFaculty()
    {
        using (SqlConnection Rikka = new SqlConnection(Dekomori.GetConnection()))
        {
            Util    audlog = new Util();
            Cryptic DE     = new Cryptic();
            Rikka.Open();

            string Takanashi = @"SELECT Teacher_ID, Teacher_FirstName, Teacher_MiddleName, Teacher_LastName, UserType_ID, User_ID FROM TEACHER_MAIN
                                 WHERE User_ID=@User_ID AND Teacher_PW=@Teacher_PW";
            using (SqlCommand WickedEye = new SqlCommand(Takanashi, Rikka))
            {
                WickedEye.Parameters.AddWithValue("@User_ID", txtUserID.Text);
                WickedEye.Parameters.AddWithValue("@Teacher_PW", txtPassword.Text);

                using (SqlDataReader Chuu2 = WickedEye.ExecuteReader())
                {
                    if (Chuu2.HasRows)
                    {
                        while (Chuu2.Read())
                        {
                            Session["teacher_id"]         = Chuu2["Teacher_ID"].ToString();
                            Session["teacher_FirstName"]  = Chuu2["Teacher_FirstName"].ToString();
                            Session["teacher_MiddleName"] = Chuu2["Teacher_MiddleName"].ToString();
                            Session["teacher_LastName"]   = Chuu2["Teacher_LastName"].ToString();
                            Session["user_id"]            = Chuu2["User_ID"].ToString();
                            Session["UserType_ID"]        = Chuu2["UserType_ID"].ToString();
                        }

                        //Audit Log of Session ID
                        //Nathaniel Collins S. Ortiz V
                        audlog.AuditLogAdmin(DE.Encrypt("Teacher Log-In"), int.Parse(Session["user_id"].ToString()), DE.Encrypt("Logged-In by Teacher "
                                                                                                                                + Session["teacher_FirstName"].ToString() + " " + Session["teacher_MiddleName"].ToString() + " " + Session["teacher_LastName"].ToString()));

                        //dmg
                        if (Session["UserType_ID"].ToString() == "1")
                        {
                            Response.Redirect("~/Admin/IT Admin/ITAdmin_index.aspx");
                        }
                        else if (Session["UserType_ID"].ToString() == "2")
                        {
                            Response.Redirect("~/Admin/Registrar/Registrar_index.aspx");
                        }
                        else if (Session["UserType_ID"].ToString() == "3")
                        {
                            Response.Redirect("~/Admin/Accounting/AccountingIndex.aspx");
                        }
                        else if (Session["UserType_ID"].ToString() == "4")
                        {
                            Response.Redirect("~/Admin/Principal/Principal_index.aspx");
                        }
                        else if (Session["UserType_ID"].ToString() == "5")
                        {
                            Response.Redirect("~/TeacherPortal/Homepage.aspx");
                        }
                        else if (Session["UserType_ID"].ToString() == "6")
                        {
                            Response.Redirect("~/Student Portal/StudentProfile.aspx");
                        }
                    }

                    else
                    {
                        error.Visible = true;
                    }
                }
            }
        }
    }
Exemplo n.º 15
0
    void LogInAdmin()
    {
        using (SqlConnection Rikka = new SqlConnection(Dekomori.GetConnection()))
        {
            Util    audlog = new Util();
            Cryptic DE     = new Cryptic();
            Rikka.Open();

            string Takanashi = @"SELECT Admin_ID,First_Name,Middle_Name,Last_Name, UserType_ID, User_ID FROM ADMIN_MAIN 
                           WHERE User_ID=@User_ID AND Admin_PW=@Admin_PW";

            using (SqlCommand WickedEye = new SqlCommand(Takanashi, Rikka))
            {
                WickedEye.Parameters.AddWithValue("@User_ID", txtUserID.Text);
                WickedEye.Parameters.AddWithValue("@Admin_PW", txtPassword.Text);

                using (SqlDataReader Chuu2 = WickedEye.ExecuteReader())
                {
                    if (Chuu2.HasRows)
                    {
                        while (Chuu2.Read())
                        {
                            Session["admin_id"]    = Chuu2["Admin_ID"].ToString();
                            Session["user_id"]     = Chuu2["User_ID"].ToString();
                            Session["first_name"]  = Chuu2["First_Name"].ToString();
                            Session["middle_name"] = Chuu2["Middle_Name"].ToString();
                            Session["last_name"]   = Chuu2["Last_Name"].ToString();
                            Session["UserType_ID"] = Chuu2["UserType_ID"].ToString();
                        }


                        //Audit Log of Session ID
                        //Nathaniel Collins S. Ortiz V
                        //audlog.AuditLogAdmin(DE.Encrypt("Admin Log-In"), int.Parse(Session["user_id"].ToString()), DE.Encrypt("Logged-In Admin by "
                        //  + Session["first_name"].ToString() + " " + Session["middle_name"].ToString() + " " + Session["last_name"].ToString()));
                        //audlog.AuditLogAdmin("Log-In", int.Parse(Session["admin_id"].ToString()), "Logged-In by "
                        //    + Session["first_name"].ToString() + " " + Session["middle_name"].ToString() + " " + Session["last_name"].ToString());

                        //dmg
                        if (Session["UserType_ID"].ToString() == "1")
                        {
                            audlog.AuditLogAdmin(DE.Encrypt("Admin Log-In"), int.Parse(Session["user_id"].ToString()), DE.Encrypt("Logged-In IT Admin by "
                                                                                                                                  + Session["first_name"].ToString() + " " + Session["middle_name"].ToString() + " " + Session["last_name"].ToString()));
                            Response.Redirect("~/Admin/IT Admin/ITAdmin_index.aspx");
                        }
                        else if (Session["UserType_ID"].ToString() == "2")
                        {
                            audlog.AuditLogAdmin(DE.Encrypt("Admin Log-In"), int.Parse(Session["user_id"].ToString()), DE.Encrypt("Logged-In Registrar by "
                                                                                                                                  + Session["first_name"].ToString() + " " + Session["middle_name"].ToString() + " " + Session["last_name"].ToString()));
                            Response.Redirect("~/Admin/Registrar/Registrar_index.aspx");
                        }
                        else if (Session["UserType_ID"].ToString() == "3")
                        {
                            audlog.AuditLogAdmin(DE.Encrypt("Admin Log-In"), int.Parse(Session["user_id"].ToString()), DE.Encrypt("Logged-In Accounting by "
                                                                                                                                  + Session["first_name"].ToString() + " " + Session["middle_name"].ToString() + " " + Session["last_name"].ToString()));
                            Response.Redirect("~/Admin/Accounting/Accounting_index.aspx");
                        }
                        else if (Session["UserType_ID"].ToString() == "4")
                        {
                            audlog.AuditLogAdmin(DE.Encrypt("Admin Log-In"), int.Parse(Session["user_id"].ToString()), DE.Encrypt("Logged-In Principal by "
                                                                                                                                  + Session["first_name"].ToString() + " " + Session["middle_name"].ToString() + " " + Session["last_name"].ToString()));
                            Response.Redirect("~/Admin/Principal/Principal_index.aspx");
                        }
                        else if (Session["UserType_ID"].ToString() == "5")
                        {
                            Response.Redirect("~/TeacherPortal/Welcome.aspx");
                        }
                        else if (Session["UserType_ID"].ToString() == "6")
                        {
                            Response.Redirect("~/Student Portal/StudentProfile.aspx");
                        }
                    }

                    else
                    {
                        error.Visible = true;
                    }
                }
            }
        }
    }