Example #1
0
        public int ChangePasswordOnFirstLogin(string userName, string currentPassword, string newPassword)
        {
            using (SqlConnection con = Connection.SqlConnectionObject)
            {
                SqlDataReader reader = ExecuteScoopenDB.ExecuteReader(con, ScoopenDB.spChangePasswordOnFirstLogin,
                                                                      new SqlParameter()
                {
                    ParameterName = "@Username", Value = userName
                },
                                                                      new SqlParameter()
                {
                    ParameterName = "@CurrentPassword", Value = currentPassword
                },
                                                                      new SqlParameter()
                {
                    ParameterName = "@NewPassword", Value = newPassword
                });

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        return((int)reader[0]);
                    }
                }
            }

            return(-1);
        }
Example #2
0
        public User1 Authenticate(string username, string password)
        {
            User1 user = new User1();

            using (SqlConnection con = Connection.SqlConnectionObject)
            {
                SqlDataReader reader = ExecuteScoopenDB.ExecuteReader(con, ScoopenDB.spAuthenticateUser,
                                                                      new SqlParameter()
                {
                    ParameterName = "@UserName", Value = username
                },
                                                                      new SqlParameter()
                {
                    ParameterName = "@Password", Value = password
                });


                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        user.AccountLocked   = (int)reader["AccountLocked"];
                        user.IsAuthenticated = (int)reader["Authenticated"];
                        user.RetryAttempts   = (int)reader["RetryAttempts"];
                    }
                }
            }

            return(user);
        }
Example #3
0
        public int ActivateRegisteredUser(string mobile, string password, string email, string otp)
        {
            using (SqlConnection con = Connection.SqlConnectionObject)
            {
                SqlDataReader reader = ExecuteScoopenDB.ExecuteReader(con, ScoopenDB.spActivateRegisteredUser,
                                                                      new SqlParameter()
                {
                    ParameterName = "@Mobile", Value = mobile
                },
                                                                      new SqlParameter()
                {
                    ParameterName = "@Password", Value = password
                },
                                                                      new SqlParameter()
                {
                    ParameterName = "@Email", Value = email
                },
                                                                      new SqlParameter()
                {
                    ParameterName = "@Otp", Value = otp
                });

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        return((int)reader[0]);
                    }
                }
            }
            return(-1);
        }
Example #4
0
        public int RegisterAdmin(string FirstName, string LastName, string Email, string Password, string PhoneNumber, string Address, int ZipCode)

        {
            using (SqlConnection con = Connection.SqlConnectionObject)
            {
                SqlDataReader reader = ExecuteScoopenDB.ExecuteReader(con, ScoopenDB.spRegisterUser,
                                                                      new SqlParameter()
                {
                    ParameterName = "@FirstName", Value = FirstName
                },
                                                                      new SqlParameter()
                {
                    ParameterName = "@LastName", Value = LastName
                },
                                                                      new SqlParameter()
                {
                    ParameterName = "@Email", Value = Email
                },
                                                                      new SqlParameter()
                {
                    ParameterName = "@Password", Value = Password
                },

                                                                      new SqlParameter()
                {
                    ParameterName = "@PhoneNumber", Value = PhoneNumber
                },
                                                                      new SqlParameter()
                {
                    ParameterName = "@Address", Value = Address
                });
                new SqlParameter()
                {
                    ParameterName = "@ZipCode", Value = zipCode
                };



                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        return((int)reader[0]);
                    }
                }
            }

            return(-1);
        }
Example #5
0
 public void SaveOtpInDatabase(string mobile, string email, string otp)
 {
     using (SqlConnection con = Connection.SqlConnectionObject)
     {
         SqlDataReader reader = ExecuteScoopenDB.ExecuteReader(con, ScoopenDB.spSaveOtpInDatabase,
                                                               new SqlParameter()
         {
             ParameterName = "@Mobile", Value = mobile
         },
                                                               new SqlParameter()
         {
             ParameterName = "@Email", Value = email
         },
                                                               new SqlParameter()
         {
             ParameterName = "@Otp", Value = otp
         });
     }
 }
Example #6
0
        public string GetOtpFromDatabase(string mobile, string email)
        {
            using (SqlConnection con = Connection.SqlConnectionObject)
            {
                SqlParameter otp = new SqlParameter()
                {
                    ParameterName = "@Otp", DbType = DbType.String, Size = 6, Direction = ParameterDirection.Output
                };
                SqlDataReader reader = ExecuteScoopenDB.ExecuteReader(con, ScoopenDB.spGetOtpFromDatabase,
                                                                      new SqlParameter()
                {
                    ParameterName = "@Mobile", Value = mobile
                },
                                                                      new SqlParameter()
                {
                    ParameterName = "@Email", Value = email
                }, otp);
                return(otp.Value.ToString());
            }

            return(string.Empty);
        }
Example #7
0
        public int RegisterUser(string firstName, string lastName, string mobile, string email, string otp)
        {
            using (SqlConnection con = Connection.SqlConnectionObject)
            {
                SqlDataReader reader = ExecuteScoopenDB.ExecuteReader(con, ScoopenDB.spRegisterUser,
                                                                      new SqlParameter()
                {
                    ParameterName = "@FirstName", Value = firstName
                },
                                                                      new SqlParameter()
                {
                    ParameterName = "@LastName", Value = lastName
                },
                                                                      new SqlParameter()
                {
                    ParameterName = "@Mobile", Value = mobile
                },
                                                                      new SqlParameter()
                {
                    ParameterName = "@Email", Value = email
                },
                                                                      new SqlParameter()
                {
                    ParameterName = "@Otp", Value = otp
                });


                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        return((int)reader[0]);
                    }
                }
            }

            return(-1);
        }