Beispiel #1
0
        public int validate_user(RegistrationBO rbo)
        {
            try
            {
                cmd = new SqlCommand("validateuserdata", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@UserName", rbo.username);
                cmd.Parameters.AddWithValue("@Password", rbo.password);
                conn.Open();

                SqlDataReader read = cmd.ExecuteReader();
                read.Read();
                if(read.HasRows)
                {
                    return 1;
                }
                else
                {
                    return 0;
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                conn.Close();
            }
        }
Beispiel #2
0
 public int register_DAL(RegistrationBO rbo)
 {
     int result = 6;
     try
     {
         cmd = new SqlCommand("insertuserdata", conn);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@FirstName", rbo.firstname);
         cmd.Parameters.AddWithValue("@LastName", rbo.lastname);
         cmd.Parameters.AddWithValue("@UserName", rbo.username);
         cmd.Parameters.AddWithValue("@Password", rbo.password);
         cmd.Parameters.AddWithValue("@Cpassword", rbo.cpassword);
         cmd.Parameters.AddWithValue("@emailID", rbo.emailid);
         cmd.Parameters.AddWithValue("@result", SqlDbType.Int).Direction = ParameterDirection.Output;
         conn.Open();
         cmd.ExecuteNonQuery();
         result = Convert.ToInt32(cmd.Parameters["@result"].Value);
         return result;
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         conn.Close();
     }
 }
Beispiel #3
0
 public int register_BAL(RegistrationBO rbo)
 {
     try
     {
         return rdal.register_DAL(rbo);
     }
     catch (Exception ex)
     {
         ex.GetType();
     }
     return 0;
 }
Beispiel #4
0
 public int login_BAL(RegistrationBO rbo)
 {
     try
     {
         return rdal.validate_user(rbo);
     }
     catch (Exception ex)
     {
         ex.GetType();
     }
     return 0;
 }
        protected void Button_submitregistration_Click(object sender, EventArgs e)
        {
            RegistrationBO rbo = new RegistrationBO();
            RegistrationBAL rbal = new RegistrationBAL();
            rbo.firstname = TextBox_firstname.Text.Trim();
            rbo.lastname = TextBox_lastname.Text.Trim();
            rbo.username = TextBox_username.Text.Trim();
            rbo.password = TextBox_password.Text.Trim();
            rbo.cpassword = TextBox_cpassword.Text.Trim();
            rbo.emailid = TextBox_emailid.Text.Trim();
            int value = rbal.register_BAL(rbo);
            if (value == 0)
            {

                Response.Redirect("Loginpage.aspx");
            }

            else
            {
                Label_errormessage.Text = "Username already Exists!!!";
            }
        }