Exemplo n.º 1
0
        protected void btnProfessorRegister_Click(object sender, EventArgs e)
        {
            if (!Page.IsValid)
            {
                lblMessage.Visible = true;
                lblMessage.Text    = "Password Does Not Match";
            }
            else
            {
                int    profID     = int.Parse(txtProfID.Text);
                string password   = txtPasswordProf.Text;
                string firstName  = txtEnterFNameProf.Text;
                string lastName   = txtEnterLNameProf.Text;
                string email      = txtEnterEmailProf.Text;
                string department = ddlDepartment.SelectedValue;
                string type       = "Professor";

                newUser               = new BlackboardSvc.User();
                newUser.userID        = profID;
                newUser.UserFirstName = firstName;
                newUser.userLastName  = lastName;
                newUser.Userpassword  = password;
                newUser.userEmail     = email;
                newUser.userType      = type;

                newProf = new BlackboardSvc.Professor();
                newProf.ProfDepartment = department;
                newProf.ProfId         = profID;

                if (pxy.AddNewUser(newUser) && pxy.AddNewProfessor(newProf))
                {
                    Session["check"] = 3;
                    lblMessage.Text  = "Professor Account Created";
                    Response.Redirect("ProfessorPage.aspx");
                }
                else
                {
                    lblMessage.Text = "Professor Account Not Created";
                }
            }
        }
Exemplo n.º 2
0
        protected void btnStudentRegister_Click(object sender, EventArgs e)
        {
            if (!Page.IsValid)
            {
                lblMessage.Visible = true;
                lblMessage.Text    = "Password Does Not Match";
            }
            else
            {
                int    studentId = int.Parse(txtStudentID.Text);
                string password  = txtPassword.Text;
                string firstName = txtEnterFName.Text;
                string lastName  = txtEnterLName.Text;
                int    gradYear  = int.Parse(ddlGradYear.SelectedValue);
                string email     = txtEnterEmail.Text;
                string type      = "Student";

                newUser               = new BlackboardSvc.User();
                newUser.userID        = studentId;
                newUser.UserFirstName = firstName;
                newUser.userLastName  = lastName;
                newUser.Userpassword  = password;
                newUser.userEmail     = email;
                newUser.userType      = type;

                newStudent                 = new BlackboardSvc.Students();
                newStudent.StudentID       = studentId;
                newStudent.StudentGradYear = gradYear;

                if (pxy.AddNewUser(newUser) && pxy.AddNewStudent(newStudent))
                {
                    Session["check"] = 2;
                    lblMessage.Text  = "Student Account Created";
                    Response.Redirect("StudentPage.aspx");
                }
                else
                {
                    lblMessage.Text = "Account Not Created";
                }
            }
        }
Exemplo n.º 3
0
        protected void btnAdminRegister_Click(object sender, EventArgs e)
        {
            if (!Page.IsValid)
            {
                lblMessage.Visible = true;
                lblMessage.Text    = "Password Does Not Match";
            }
            else
            {
                int    adminID   = int.Parse(txtAdminNumber.Text);
                string firstName = txtEnterFNameAdmin.Text;
                string lastName  = txtEnterLNameAdmin.Text;
                string password  = txtPasswordAdmin.Text;
                string email     = txtEnterEmailAdmin.Text;
                string type      = "Admin";

                newUser               = new BlackboardSvc.User();
                newUser.userID        = adminID;
                newUser.UserFirstName = firstName;
                newUser.userLastName  = lastName;
                newUser.Userpassword  = password;
                newUser.userEmail     = email;
                newUser.userType      = type;

                if (pxy.AddNewUser(newUser))
                {
                    Session["check"] = 2;
                    lblMessage.Text  = "Admin Account Created";
                    Response.Redirect("AdminPage.aspx");
                }
                else
                {
                    lblMessage.Text = "Account Not Created";
                }
            }
        }