Пример #1
0
        /// <summary>
        /// Delete a user
        /// </summary>
        /// <param name="UserId"></param>
        /// <returns></returns>
        public bool DeleteUserById(int UserId)
        {
            bool result = false;

            try
            {
                var UserToDelete = _userRepo.Get(UserId);
                if (UserToDelete != null)
                {
                    _scheduledTaskService.CancelTaskByUserId(UserToDelete.Id);
                    List <Tuple <string, object> > Parameters = new List <Tuple <string, object> >();
                    Parameters.Add(new Tuple <string, object>("@UserId", UserId));
                    result = _userRepo.ExecuteStoredProcedure("DeleteUserById", Parameters);
                }
            }
            catch (Exception e)
            {
                result = false;
                Commons.Logger.GenerateError(e, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "UserId = " + UserId);
            }
            return(result);
        }