Beispiel #1
0
 public UserViewModel GetUserByUserNameAndPassword(string UserName, string Password)
 {
     UserModel objUserModel = new UserModel();
     UserViewModel objUserViewModel = new UserViewModel();
     try
     {
         objUserModel = objUserDB.GetUserByUserNameAndPassword(UserName, Password);
         Mapper.CreateMap<UserModel, UserViewModel>();
         objUserViewModel = Mapper.Map<UserModel, UserViewModel>(objUserModel);
     }
     catch (Exception ex)
     {
         throw;
     }
     return objUserViewModel;
 }
Beispiel #2
0
        public UserModel GetUserByUserNameAndPassword(string UserName, string Password)
        {
            UserModel objUserModel = new UserModel();
            try
            {
                using (SqlDataReader reader = SqlHelper.ExecuteReader(connectionString, CommandType.StoredProcedure, "stp_GetUserByUserNameAndPassword",
                    new SqlParameter("@UserName", UserName),
                    new SqlParameter("@Password", Password)))
                {
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            objUserModel.UserId = Convert.ToInt32(reader["UserId"].ToString());
                            objUserModel.UserRoleId = Convert.ToInt32(reader["UserRoleId"].ToString());
                            objUserModel.UserName = reader["UserName"].ToString();
                            objUserModel.FirstName = reader["FirstName"].ToString();
                            objUserModel.LastName = reader["LastName"].ToString();
                            objUserModel.EmailId = reader["EmailId"].ToString();
                            objUserModel.MobileNumber = reader["MobileNumber"].ToString();
                            objUserModel.Address = reader["Address"].ToString();
                            objUserModel.Password = reader["Password"].ToString();
                            objUserModel.IsActive = Convert.ToBoolean(reader["IsActive"].ToString());
                        }
                    }
                }

                return objUserModel;
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {

            }
        }