Example #1
0
 private int CheckLoginCredentials(string userid, string password)
 {
     try
     {
         ProcessQuery process = new ProcessQuery();
         UserDetails = process.ExecuteDataSet(QueryBank.CheckLoginCreds(userid, password));
         if (UserDetails == null)
             return -1;
         else if (UserDetails.Rows.Count == 0)
             return 0;
         else return 1;
     }
     catch (Exception) { return -1; }
 }
 protected void Submit_Click(object sender, EventArgs e)
 {
     string Name = TxtName.Text;
     string EmpNo = Session["USERID"].ToString();
     string Email = TxtEmail.Text;
     string MobileNo = TxtMobile.Text;
     string Password = TxtPass1.Text;
     if (Password.Equals("a") || String.IsNullOrEmpty(Password))
     {
         Password = Session["PASSWORD"].ToString();
     }
     ProcessQuery process = new ProcessQuery();
     try
     {
         int result = process.ExecuteUpdate(QueryBank.EditUserDetails(Name, EmpNo, Password, MobileNo, Email));
         if (result <= 0)
             LblStatus.Text = "Updation Failed. Contact The Administrator";
         else
             LblStatus.Text = "Updation Successful";
     }
     catch (Exception) { LblStatus.Text = "Validation Failed"; }
 }
 protected void Register_Click(object sender, ImageClickEventArgs e)
 {
     string Name = TxtName.Text;
     string EmpNo = TxtEmpNo.Text;
     string Email = TxtEmail.Text;
     string MobileNo = TxtMobile.Text;
     string Password = TxtPass1.Text;
     ProcessQuery process = new ProcessQuery();
     try
     {
         int result = process.ExecuteUpdate(QueryBank.RegisterNewUser(Name, EmpNo, Password, MobileNo, Email));
         if (result <= 0)
             LblStatus.Text = "Registration Failed. Contact The Administrator";
         else
             LblStatus.Text = "Registration Successful. Goto Login Page to Log in";
     }
     catch (OleDbException error)
     {
         if (error.Message.Contains("ORA-00001"))
             LblStatus.Text = "You are already registered.";
         else
             LblStatus.Text = "Registration Failed. Contact The Administrator";
     }
 }