protected void btnSignUp_Click(object sender, EventArgs e)
        {
            Model.User u   = new Model.User();
            Random     rnd = new Random();

            u.Uid = rnd.Next(1, 999999);

            u.Uname     = TxtName.Text;
            u.Uusername = TxtUsername.Text;
            u.Upassword = EncryptionDecryption.EncodePasswordToBase64(TxtPassword.Text);
            u.Uemail    = TxtEmail.Text;
            u.UDOB      = DateTime.ParseExact(TxtDob.Text, "yyyy-MM-dd", null);
            u.Umobile   = TxtMobile.Text;
            u.Udate     = DateTime.Now;
            u.Urole     = "user";
            u.Uaddress  = TxtAddress.Text;
            u.Uimage    = u.Uid + ".jpeg";
            string gender = "Male";

            if (Male.Checked)
            {
                gender = Male.Text;
            }
            else if (Female.Checked)
            {
                gender = Female.Text;
            }
            else if (Other.Checked)
            {
                gender = Other.Text;
            }
            u.Ugender = gender;
            Controller.User uc = new Controller.User();
            if (uc.ValidateUser(u))
            {
                Response.Write("<script language=javascript>alert('Successfully Registered');</script>");
                Response.AppendHeader("Refresh", "5;url=Login.aspx");
                RedirectMessage.Text    = "You will now be redirected to Login Page in 5 seconds";
                RedirectMessage.Visible = true;
                //Response.Redirect("Login.aspx");
            }
            else
            {
                Response.Write("<script language=javascript>alert('User Already Exists');</script>");
                Response.AppendHeader("Refresh", "5;url=Login.aspx");
                RedirectMessage.Text    = "You will now be redirected to Login Page in 5 seconds";
                RedirectMessage.Visible = true;
            }
        }
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     if (TxtUsername.Text != null & TxtPassword.Text != null)
     {
         string          username = TxtUsername.Text;
         string          password = TxtPassword.Text;
         Controller.User c        = new Controller.User();
         DAO.Cart        dc       = new DAO.Cart();
         Model.User      u        = c.UserLoginValidation(username, password);
         if (u != null)
         {
             Session["UserId"]   = u.Uid;
             Session["Name"]     = u.Uname;
             Session["Username"] = u.Uusername;
             Session["Role"]     = u.Urole;
             int cart = dc.GetCart(u.Uid);
             if (cart != 0)
             {
                 Session["CartId"] = cart;
             }
             if (u.Urole != "admin")
             {
                 Response.Redirect("~/Home.aspx");
             }
             else
             {
                 Response.Redirect("~/Admin/Index.aspx");
             }
         }
         else
         {
             Response.Write("<script language=javascript>alert('Wrong Password');</script>");
         }
     }
     else
     {
         lblMessage.Text = "Username & Password Cannot be Empty";
     }
 }