public UserDTO ValidateUser(UserDTO user)
 {
     UserManager MU = new UserManager();
     //UserDTO uesrDetail = MU.ValidateUser(user);
     //return uesrDetail;
     return null;
 }
 public bool CreateUser(UserDTO user)
 {
     bool status = false;
     UserRepository AU = new UserRepository();
     status = AU.CreateUser(user);
     return status;
 }
 public bool CreateUser(UserDTO user)
 {
     bool status = false;
     UserManager MU = new UserManager();
     try
     {
         status = MU.CreateUser(user);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return status;
 }
 public static UserDTO ToModel(this UserModel user)
 {
     if (user != null)
     {
         UserDTO toReturn = new UserDTO();
         //toReturn.MLoginID = user.MLoginID;
         //toReturn.MLoginFirstName = user.MLoginFirstName.NullToEmpty();
         //toReturn.MLoginLastName = user.MLoginLastName.NullToEmpty();
         //toReturn.MLoginAddress = user.MLoginAddress.NullToEmpty();
         //toReturn.MLoginState = user.MLoginState.NullToEmpty();
         //toReturn.MLoginCountry = user.MLoginCountry.NullToEmpty();
         //toReturn.MLoginCity = user.MLoginCity.NullToEmpty();
         //toReturn.MLoginZip = user.MLoginZip.NullToEmpty();
         return toReturn;
     }
     return null;
 }
        public static bool CreateUser(UserModel user)
        {
            UserManager userMgr = new UserManager();
            bool status = false;

            UserDTO toReturn = new UserDTO();
            //toReturn.MLoginID = user.MLoginID;
            //toReturn.MLoginFirstName = user.MLoginFirstName;
            //toReturn.MLoginLastName = user.MLoginLastName;
            //toReturn.MLoginAddress = user.MLoginAddress;
            //toReturn.MLoginState = user.MLoginState;
            //toReturn.MLoginCountry = user.MLoginCountry;
            //toReturn.MLoginCity = user.MLoginCity;
            //toReturn.MLoginZip = user.MLoginZip;

            status = userMgr.CreateUser(toReturn);
            return status;
        }
 public bool CreateUser(UserDTO user)
 {
     int Success = 0;
     bool status = false;
     try
     {
         con.Open();
         cmd.CommandText = "SP_CreateNewUser";
         cmd.CommandType = CommandType.StoredProcedure;
         //cmd.Parameters.AddWithValue("@FirstName", user.MLoginFirstName);
         //cmd.Parameters.AddWithValue("@LastName", user.MLoginLastName);
         //cmd.Parameters.AddWithValue("@Address", user.MLoginAddress);
         //cmd.Parameters.AddWithValue("@Country", user.MLoginCountry);
         //cmd.Parameters.AddWithValue("@State", user.MLoginState);
         //cmd.Parameters.AddWithValue("@City", user.MLoginCity);
         //cmd.Parameters.AddWithValue("@UserID", user.MLoginRightsUserID);
         //cmd.Parameters.AddWithValue("@Password", user.MLoginRightsPassword);
         //cmd.Parameters.AddWithValue("@Zip", user.MLoginZip);
         //cmd.Parameters.AddWithValue("@PrimaryPhone", user.MLoginPrimaryPhone);
         //cmd.Parameters.AddWithValue("@MobilePhone", user.MLoginMobilePhone);
         //cmd.Parameters.AddWithValue("@CompanyName", user.MLoginCompanyName);
         SqlParameter param = new SqlParameter();
         param = cmd.Parameters.AddWithValue("@returnvalue", DbType.Int32);
         param.Direction = ParameterDirection.Output;
         cmd.Connection = con;
         cmd.ExecuteNonQuery();
         Success = (int)cmd.Parameters["@returnvalue"].Value;
         if (Success > 0)
         {
             status = true;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         con.Close();
     }
     return status;
 }
        public static UserModel GetUserDetails(int userId)
        {
            UserDTO user = new UserDTO();
            UserManager userMgr = new UserManager();

            //user = userMgr.GetUserDetails(userId);
            UserModel toReturn = new UserModel();

            if (user != null)
            {
                //toReturn.MLoginID = user.MLoginID;
                //toReturn.MLoginFirstName = user.MLoginFirstName;
                //toReturn.MLoginLastName = user.MLoginLastName;
                //toReturn.MLoginAddress = user.MLoginAddress;
                //toReturn.MLoginState = user.MLoginState;
                //toReturn.MLoginCountry = user.MLoginCountry;
                //toReturn.MLoginCity = user.MLoginCity;
                //toReturn.MLoginZip = user.MLoginZip;
            }

            return toReturn;
        }
 public static bool ValidateUser(UserModel user, out List<DataError> dataError)
 {
     bool IsValidate = false;
     dataError = null;
     UserDTO userDetail = new UserDTO();
     if (user.Validate(UseralidationType.LoginUser, out dataError))
     {
         UserManager userMgr = new UserManager();
         //userDetail = userMgr.ValidateUser(new UserDTO { MLoginRightsUserID = user.MLoginRightsUserID, MLoginRightsPassword = user.MLoginRightsPassword });
         userDetail = null;
         //if (userDetail != null)
         //{
         //    user.MLoginID = userDetail.MLoginID;
         //    IsValidate = true;
         //}
         //else
         //{
         //    IsValidate = false;
         //    dataError.Add(new DataError() { PropertyName = "Message", ErrorDescription = ErrorMessages.User.InValidCredential });
         //}
         return IsValidate;
     }
     return IsValidate;
 }
 private UserDTO PopulateUserName(IDataRecord dataRecord)
 {
     UserDTO userEntity = new UserDTO();
     userEntity.Id = Convert.ToInt32(dataRecord["UserId"]);
     userEntity.FirstName = Convert.ToString(dataRecord["FirstName"]);
     userEntity.LastName = Convert.ToString(dataRecord["LastName"]);
     return userEntity;
 }
        private UserDTO PopulateUserAddressDetails(IDataRecord dataRecord)
        {
            UserDTO userEntity = new UserDTO();
            IList<UserAddressDTO> userAddressEntityList = new List<UserAddressDTO>();

            userEntity.Id = Convert.ToInt32(dataRecord["UserId"]);
            userEntity.FirstName = Convert.ToString(dataRecord["FirstName"]);
            userEntity.LastName = Convert.ToString(dataRecord["LastName"]);

            UserAddressDTO userAddressEntity = new UserAddressDTO();
            userAddressEntity.Address = Convert.ToString(dataRecord["Address"]);
            userAddressEntity.City = Convert.ToString(dataRecord["City"]);
            userAddressEntity.StateName = Convert.ToString(dataRecord["StateName"]);
            userAddressEntity.CountryName = Convert.ToString(dataRecord["CountryName"]);
            userAddressEntity.ZipCode = Convert.ToString(dataRecord["ZipCode"]);
            userAddressEntityList.Add(userAddressEntity);
            userEntity.UserAddressList = userAddressEntityList;

            return userEntity;
        }