protected void ButtonLogin_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    OnlineAttendanceEntities db = new OnlineAttendanceEntities();
                    var userName = Txtname.Text;
                    var userPass = TxtPassword.Text;
                    var usr      = from u in db.SignupTables
                                   where u.Name == userName && u.Password == userPass
                                   select u;

                    if (usr.Count() > 0)
                    {
                        Response.Redirect("Main.aspx");
                    }
                    else
                    {
                        lblMessage.Text = "Username or Password is invalid";
                    }
                }
                catch (Exception ex)
                {
                    lblMessage.Text = ex.Message;
                }
            }
        }
Example #2
0
 protected void ButtonSignup_Click(object sender, EventArgs e)
 {
     try
     {
         OnlineAttendanceEntities db = new OnlineAttendanceEntities();
         SignupTable usr             = new SignupTable()
         {
             Name            = Txtname.Text,
             Email           = TxtEmail.Text,
             Age             = TxtAge.Text,
             Contact         = TxtContact.Text,
             Password        = TxtPassword.Text,
             ConfirmPassword = TxtConfirmPassword.Text
         };
         db.SignupTables.Add(usr);
         db.SaveChanges();
         lblMessage.Text = "User has been added Successfully";
     }
     catch (Exception ex)
     {
         lblMessage.Text = ex.Message;
     }
 }