Exemple #1
0
        protected void InsertUser(object sender, EventArgs e)
        {
            AdminLogin al       = new AdminLogin();
            string     name     = txtSignFirstName.Text;
            string     email    = txtSignEmail.Text;
            string     username = txtSignLastName.Text;
            string     password = txtSignPassword.Text;

            al.Admin_id       = name;
            al.Admin_password = password;
            Console.WriteLine("Selected Value: " + r_admin.Value);
            string role = null;

            if (r_admin.Checked)
            {
                role = r_admin.Value;
            }
            else if (r_faculty.Checked)
            {
                role = r_faculty.Value;
            }
            else if (r_student.Checked)
            {
                role = r_student.Value;
            }
            Console.WriteLine("Role: " + role);

            if (role == "admin")
            {
                if (al.NewUser())
                {
                    Response.Redirect("AdminDashboard.aspx?msg=You are Logged in!!");
                }
                else
                {
                    Response.Redirect("Default.aspx?msg=Invalid username and password!");
                }
            }
            else
            {
                Console.WriteLine("Please Select Role");
                Response.Redirect("Default.aspx?msg=Invalid username and password!");
            }



            //string login_type = "User";

            //al.Username = username;
            //al.Password = password;
            //al.LoginType = login_type;



            //string value = "";
            //bool isChecked = rdoRoleRange.Checked;
            //if (isChecked)
            //    value = radioButton1.Text;
            //else
            //    value = radioButton2.Text;
        }