Пример #1
0
        public static UserInfo GetUserByName(string userName, bool isTest = false)
        {
            ISprocCalls sprocCalls = AppTools.InitSprocCalls(isTest);

            UserInfo user = sprocCalls.UserInfoGetByUser(userName);

            if (user != null)
            {
                user.GroupUsers = GetGroupsByUserName(userName, sprocCalls);
            }

            return(user);
        }
Пример #2
0
 public static bool DeleteUser(string userName, bool isTest = false)
 {
     try
     {
         IMembershipTools membershipTools = AppTools.InitMembershipTools(isTest);
         return(membershipTools.DeleteUser(userName));
     }
     catch (Exception ex)
     {
         DBCommands.RecordError(ex);
         return(false);
     }
 }
Пример #3
0
        public static void InsertUser(UserInfo user, out string errorMessage, bool isTest = false)
        {
            try
            {
                errorMessage = ValidateUser(user);

                if (string.IsNullOrEmpty(errorMessage))
                {
                    IMembershipTools membershipTools = AppTools.InitMembershipTools(isTest);
                    ISprocCalls      sprocCalls      = AppTools.InitSprocCalls(isTest);

                    if (membershipTools.CreateUser(user.UserName, user.Email) == false ||
                        sprocCalls.UserInfoUpdate(user) == false)
                    {
                        errorMessage = "Error saving user information.";
                    }
                }
            }
            catch (Exception ex)
            {
                DBCommands.RecordError(ex);
                errorMessage = ex.Message;
            }
        }