/// <summary> /// Удаление счёта /// </summary> /// <param name="id">Уникальный идентификатор счёта</param> /// <returns>Результат выполнения операции</returns> public static string Delete(int id) { Logger.Info(String.Format("Начинаем удалять счёт {0}", id)); try { List <PlatformUser> userWithoutAccountList; if (CleenupManager.DeleteAccount(id, out userWithoutAccountList)) { var retMessage = string.Format("{1} ({0}). {2}.", id, Resource.MessageAccountDeleted, Resource.MessageDoesNotUserNotHaveAccount); if (!userWithoutAccountList.Any()) { Logger.Info(retMessage); } else { foreach (var platformUser in userWithoutAccountList) { Logger.InfoFormat("пользователь {0} (id {1}) теперь не имеет ни одного счёта", platformUser.Login, platformUser.ID); } retMessage = string.Format("{1} ({0}). {2}.", id, Resource.MessageAccountDeleted, Resource.MessageUsersWithoutAccountsInLog); } return(retMessage); } } catch (Exception ex) { Logger.Error("Delete()", ex); } return(string.Format("{1} {0}.", id, Resource.ErrorMessageCanNotDellAccount)); }
public bool DeletePlatformUser(int id, out List <Account> accountsWoOwners) { try { return(CleenupManager.DeleteUser(id, out accountsWoOwners)); } catch (Exception ex) { Logger.Error("DeletePlatformUser", ex); accountsWoOwners = null; return(false); } }