Exemplo n.º 1
0
        internal List <RegDetails> GetUser()
        {
            List <RegDetails> listUser = new List <RegDetails>();

            using (SqlConnection con = new SqlConnection(ConnectSql.GetConnectionString()))
            {
                con.Open();
                SqlCommand    cmd = new SqlCommand("select*from OwnerRegistration", con);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    while (rdr.Read())
                    {
                        RegDetails User = new RegDetails();
                        User.FirstName = rdr["FirstName"].ToString();
                        User.LastName  = rdr["LastName"].ToString();
                        User.Email     = rdr["Email"].ToString();
                        User.Mobile    = Convert.ToInt64(rdr["MobileNumber"]);
                        User.UserName  = rdr["UserName"].ToString();
                        listUser.Add(User);
                    }
                }
            }
            return(listUser);
        }
Exemplo n.º 2
0
        public bool SaveData(RegDetails user)
        {
            try
            {
                using (SqlConnection con = new SqlConnection(ConnectSql.GetConnectionString()))
                {
                    con.Open();
                    SqlCommand cmd = new SqlCommand("INSERT INTO OwnerRegistration (FirstName,LastName,Email,Mobile,UserName,Password) Values (@FirstName,@LastName,@Email,@Mobile,@UserName,@Password)", con);
                    cmd.Parameters.AddWithValue("@FirstName", user.FirstName);
                    cmd.Parameters.AddWithValue("@LastName", user.LastName);
                    cmd.Parameters.AddWithValue("@Email", user.Email);
                    cmd.Parameters.AddWithValue("@Mobile", user.Mobile);
                    cmd.Parameters.AddWithValue("@UserName", user.UserName);
                    cmd.Parameters.AddWithValue("@Password", user.Password);

                    cmd.ExecuteNonQuery();
                    con.Close();
                }
                return(true);
            }
            catch (Exception ex)
            {
                Log(ex.Message);
                return(false);
            }
        }
        public bool UpdateUSerDetails(RegDetails ObjRegObject)
        {
            using (SqlConnection con = new SqlConnection(ConnectSql.GetConnectionString()))
            {
                try
                {
                    con.Open();

                    SqlCommand cmd = new SqlCommand("UPDATE REGISTER SET FIRSTNAME=@FirstName,LASTNAME=@LastName,Email=@Email,Mobile=@Mobile,UserName=@UserName Where Email=@Email", con);
                    cmd.Parameters.AddWithValue("@FirstName", ObjRegObject.FirstName);
                    cmd.Parameters.AddWithValue("@LastName", ObjRegObject.LastName);
                    cmd.Parameters.AddWithValue("@Email", ObjRegObject.Email);
                    cmd.Parameters.AddWithValue("@Mobile", ObjRegObject.Mobile);
                    cmd.Parameters.AddWithValue("@UserName", ObjRegObject.UserName);
                    cmd.ExecuteNonQuery();
                    return(true);
                }
                catch
                {
                    return(false);
                }
                finally
                {
                    con.Close();
                }
            }
        }
 public bool UserVerifyUserDetails(RegDetails user)
 {
     if (user.FirstName.Length > 4 && user.LastName.Length > 4)
     {
         UserRegDomain domain   = new UserRegDomain();
         bool          response = domain.SavetoDatabase(user);
         return(response);
     }
     else
     {
         return(false);
     }
 }
        private void btnLoad_Click(object sender, EventArgs e)
        {
            RegDetails objRegObject = new RegDetails();

            objRegObject.FirstName = UserGridView.SelectedRows[0].Cells["ColFirstName"].Value.ToString();
            objRegObject.LastName  = UserGridView.SelectedRows[0].Cells["ColLastName"].Value.ToString();
            objRegObject.Email     = UserGridView.SelectedRows[0].Cells["ColEmail"].Value.ToString();
            objRegObject.Mobile    = Convert.ToInt64(UserGridView.SelectedRows[0].Cells["ColMobile"].Value);
            objRegObject.UserName  = UserGridView.SelectedRows[0].Cells["ColUserName"].Value.ToString();


            UpdateDetails upobj = new UpdateDetails(objRegObject);

            upobj.Show();
            this.Hide();
        }
Exemplo n.º 6
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            UpdateUserDetailsAppLayer objAppLayer = new UpdateUserDetailsAppLayer();

            RegDetails objRegUSer = new RegDetails
            {
                FirstName = string.IsNullOrWhiteSpace(txtFirstName.Text) ? "NULL" : txtFirstName.Text,
                LastName  = txtLastName.Text,
                Mobile    = string.IsNullOrWhiteSpace(Convert.ToInt64(txtMobile.Text).ToString()) ? 0 : Convert.ToInt64(txtMobile.Text),
                Email     = txtEmail.Text,
                UserName  = txtUserName.Text
            };
            string Result = objAppLayer.UpdateUser(objRegUSer);

            MessageBox.Show(Result);
        }
Exemplo n.º 7
0
        public string UserUpdateBusinessLayer(RegDetails ObjRegUSer)
        {
            UserUpdateDomain objUpdate       = new UserUpdateDomain();
            bool             IsValidationOK  = true;
            string           ResponseMessage = "";

            if (ObjRegUSer.Email.Length < 4)
            {
                IsValidationOK  = false;
                ResponseMessage = "Email Id is less than requirent";
            }
            else if (ObjRegUSer.FirstName == null || ObjRegUSer.FirstName == "NULL")
            {
                IsValidationOK  = false;
                ResponseMessage = "invalid name";
            }
            else if (ObjRegUSer.Mobile == 0 || ObjRegUSer.Mobile.ToString().Length < 10)
            {
                IsValidationOK  = false;
                ResponseMessage = "MObile no is less than 10 digit";
            }
            else
            {
                IsValidationOK  = true;
                ResponseMessage = "Data updated successfully";
            }



            if (IsValidationOK == true)
            {
                bool Response = objUpdate.UpdateUserDetails(ObjRegUSer);
                if (Response == true)
                {
                    return(ResponseMessage);
                }
                else
                {
                    return("Some thing wrong");
                }
            }
            else
            {
                return(ResponseMessage);
            }
        }
Exemplo n.º 8
0
        public string UserVerifyUserDetails(RegDetails user)
        {
            string ResponseMessage = "";
            bool   IsValidationOK  = false;

            if (!user.Email.Contains("@"))
            {
                IsValidationOK  = false;
                ResponseMessage = "Email Id is not valid";
            }
            else if (user.FirstName == null || user.FirstName == "NULL")
            {
                IsValidationOK  = false;
                ResponseMessage = "invalid name";
            }
            else if (user.Mobile == 0 || user.Mobile.ToString().Length < 10)
            {
                IsValidationOK  = false;
                ResponseMessage = "MObile no is less than 10 digit";
            }
            else if (UserAlreadyExists(user.Email))
            {
                IsValidationOK  = false;
                ResponseMessage = "User already exists";
            }
            else
            {
                IsValidationOK  = true;
                ResponseMessage = "Congrats!!! Your account is sucessfully registered";
            }



            if (IsValidationOK == true)
            {
                UserRegDomain domain   = new UserRegDomain();
                bool          response = domain.SavetoDatabase(user);
            }

            return(ResponseMessage);
        }
        public bool SaveData(RegDetails user)
        {
            string EncryptedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(user.Password, "SHA1");

            try
            {
                using (SqlConnection con = new SqlConnection(ConnectSql.GetConnectionString()))
                {
                    try
                    {
                        con.Open();
                        SqlCommand cmd = new SqlCommand("SpAddUser", con);
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@FirstName", user.FirstName);
                        cmd.Parameters.AddWithValue("@LastName", user.LastName);
                        cmd.Parameters.AddWithValue("@Email", user.Email);
                        cmd.Parameters.AddWithValue("@Mobile", user.Mobile);
                        cmd.Parameters.AddWithValue("@UserName", user.UserName);
                        cmd.Parameters.AddWithValue("@Password", EncryptedPassword);
                        cmd.ExecuteNonQuery();
                        return(true);
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                    finally
                    {
                        con.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                Log(ex.Message);
                return(false);
            }
        }
        private void btnRegister_Click(object sender, EventArgs e)
        {
            if (txtFirstName.Text == "")
            {
                WarningFN.Visible = true;
                WarningFN.Text    = "First name is mandatory";
            }
            else
            {
                RegDetails user = new RegDetails
                {
                    FirstName = txtFirstName.Text,
                    LastName  = txtLastName.Text,
                    Email     = txtEmail.Text,
                    Mobile    = Convert.ToInt64(txtMobile.Text),
                    UserName  = txtUserName.Text,
                    Password  = txtPassword.Text,
                    Confirm   = txtConfirm.Text
                };

                string Response = user.ImplementBusinessLogics(user);
                if (Response != "Congrats!!! Your account is sucessfully registered")
                {
                    if (Response == "invalid name")
                    {
                        WarningFN.Visible = true;
                        WarningFN.Text    = "First name is mandatory";
                    }
                }
                MessageBox.Show(Response);
                if (Response == "Congrats!!! Your account is sucessfully registered")
                {
                    this.Hide();
                    Login objLogin = new Login();
                    objLogin.Show();
                }
            }
        }
Exemplo n.º 11
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            
            RegDetails user = new RegDetails
            {
                FirstName = txtFirstName.Text,
                LastName = txtLastName.Text,
                Email = txtEmail.Text,
                Mobile = Convert.ToInt64(txtMobile.Text),
                UserName = txtUserName.Text,
                Password = txtPassword.Text,
                Confirm = txtConfirm.Text
            };
            bool Response = user.ImplementBusinessLogics(user);
            if (Response)
            {
                MessageBox.Show("Data saved sucessfully");

            }
            else
            {
                MessageBox.Show("Failed to save data");
            }
        }
        public bool UpdateUserDetails(RegDetails ObjRegObject)
        {
            UserUpdateService objService = new UserUpdateService();

            return(objService.UpdateUSerDetails(ObjRegObject));
        }
Exemplo n.º 13
0
 public UpdateDetails(RegDetails ObjRegObject)
 {
     _ObjRegObject = ObjRegObject;
     InitializeComponent();
 }
        public bool SavetoDatabase(RegDetails user)
        {
            UserDataDetails data2 = new UserDataDetails();

            return(data2.SaveData(user));
        }