protected void btnSubmit_Click(object sender, EventArgs e)
        {
            int er = 0;

            lblMessage.Text = "";

            if (txtEmail.Text == "")
            {
                er++;
                lblMessage.Text = "Please Insert Email";
            }
            if (txtPassword.Text == "")
            {
                er++;
                lblMessage.Text = "Please Insert Password";
            }
            if (txtEmail.Text == "" && txtPassword.Text == "")
            {
                er++;
                lblMessage.Text = "Please Insert Email and Password!";
            }
            if (er > 0)
            {
                return;
            }

            DAL.userInfo user = new DAL.userInfo();
            user.Email    = txtEmail.Text;
            user.Password = txtPassword.Text;

            if (user.Login())
            {
                Session["id"]   = user.Id;
                Session["name"] = user.Name;
                Session["role"] = user.Role;
                if (Session["rdr1"].ToString() == "")
                {
                    Response.Redirect("Default.aspx");
                }
                Response.Redirect(Session["rdr1"].ToString());
            }
            else
            {
                lblMessage.Text      = "Invalid Login";
                lblMessage.ForeColor = System.Drawing.Color.Red;
            }
        }
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            int er = 0;

            lblMessage.Text = "";

            if (txtName.Text == "")
            {
                er++;
                RequiredFieldValidator2.Text = "Required";
            }
            if (txtPassword.Text == "")
            {
                er++;
                RequiredFieldValidator3.Text = "Required";
            }
            if (er > 0)
            {
                return;
            }

            DAL.userInfo info = new DAL.userInfo();
            info.Email    = txtName.Text;
            info.Password = txtPassword.Text;

            if (info.Login())
            {
                Session["id"]   = info.Id;
                Session["name"] = info.Name;
                Session["role"] = info.Role;
                if (Session["rdr"].ToString() == "")
                {
                    Response.Redirect("Default.aspx");
                }
                Response.Redirect(Session["rdr"].ToString());
            }
            else
            {
                lblMessage.Text      = "Invalid Login";
                lblMessage.ForeColor = System.Drawing.Color.Red;
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            int er = 0;

            if (txtName.Text == "")
            {
                er++;
                lblName.Text      = "Required!";
                lblName.ForeColor = System.Drawing.Color.Red;
            }
            if (txtEmail.Text == "")
            {
                er++;
                txtEmail.Text      = "Required!";
                txtEmail.ForeColor = System.Drawing.Color.Red;
            }
            if (txtPassword.Text == "")
            {
                er++;
                txtPassword.Text      = "Required!";
                txtPassword.ForeColor = System.Drawing.Color.Red;
            }
            if (txtConfirmPass.Text == "")
            {
                er++;
                txtConfirmPass.Text      = "Required!";
                txtConfirmPass.ForeColor = System.Drawing.Color.Red;
            }
            if (txtPassword.Text != txtConfirmPass.Text)
            {
                er++;
                txtConfirmPass.Text      = "Password Doesn't Match!";
                txtConfirmPass.ForeColor = System.Drawing.Color.Red;
            }

            if (er > 0)
            {
                return;
            }

            DAL.userInfo user = new DAL.userInfo();
            user.Name     = txtName.Text;
            user.Email    = txtEmail.Text;
            user.Password = txtPassword.Text;
            user.Role     = "admin";

            if (user.Insert())
            {
                lblMessage.Text      = "Registration Successfully!";
                lblMessage.ForeColor = System.Drawing.Color.Green;

                txtName.Text        = "";
                txtEmail.Text       = "";
                txtPassword.Text    = "";
                txtConfirmPass.Text = "";
            }
            else
            {
                lblMessage.Text      = user.Error;
                lblMessage.ForeColor = System.Drawing.Color.Red;
            }
        }