static void Main(string[] args) { List <Account> accounts = new List <Account>(); AccountOperations accountService = new AccountOperations(); accountService.CreateAccount(new Account(111, "Ivan", "Ivanov", 100m, 5, AccountType.Base)); accountService.CreateAccount(new Account(112, "Petr", "Petrov", 1250m, 40, AccountType.Gold)); accountService.CreateAccount(new Account(113, "Sidor", "Sidorov", 10245m, 120, AccountType.Premium)); PrintAll(accountService.GetAllAccounts()); accountService.AddAmount(111, 500m); PrintAll(accountService.GetAllAccounts()); Console.ReadKey(); }
} // функция загрузки private async void Registration(object sender, RoutedEventArgs e) { _login = Login.Text; string password = Password.Password; string confirmPassword = ConfirmPassword.Password; string badgeError = (string)Application.Current.Resources["NotifyErrorBadgeEN"]; string messagePM = (string)Application.Current.Resources["NotifyPasswordsMismatchEN"]; string messageUE = (string)Application.Current.Resources["NotifyUserExistsEN"]; string messageSE = (string)Application.Current.Resources["NotifyServerErrorEN"]; string messageEF = (string)Application.Current.Resources["NotifyEmptyFieldsEN"]; if (Properties.Settings.Default.DefaultLanguage.Equals(new CultureInfo("ru-RU"))) { badgeError = (string)Application.Current.Resources["NotifyErrorBadgeRU"]; messagePM = (string)Application.Current.Resources["NotifyPasswordsMismatchRU"]; messageUE = (string)Application.Current.Resources["NotifyUserExistsRU"]; messageSE = (string)Application.Current.Resources["NotifyServerErrorRU"]; messageEF = (string)Application.Current.Resources["NotifyEmptyFieldsRU"]; } if (password != confirmPassword) { Manager.CreateMessage() .Accent("#8b0000") .Animates(true) .AnimationInDuration(0.55) .AnimationOutDuration(0.55) .Background("#333") .HasBadge(badgeError) .HasMessage(messagePM) .Dismiss().WithDelay(2500) .Queue(); Password.Password = ConfirmPassword.Password = ""; Password.Focus(); return; } if (_login != "" && password != "") { Loading(true); string hashedPassword = BCrypt.Net.BCrypt.HashPassword(password, 10); OperationsResponse response = await UserOperations.CreateUser(_login, hashedPassword); Loading(false); switch (response) { case OperationsResponse.Ok: _userid = await UserOperations.GetUserId(_login); response = await AccountOperations.CreateAccount(_userid, "New user", "undefined"); response = await PermissionsOperations.AddPermission(_userid); RegistrationPanel.Visibility = Visibility.Collapsed; CreateAccountPanel.Visibility = Visibility.Visible; break; case OperationsResponse.UserExists: Manager.CreateMessage() .Accent("#8b0000") .Animates(true) .AnimationInDuration(0.55) .AnimationOutDuration(0.55) .Background("#333") .HasBadge(badgeError) .HasMessage(messageUE) .Dismiss().WithDelay(2500) .Queue(); break; case OperationsResponse.ServerError: Manager.CreateMessage() .Accent("#8b0000") .Animates(true) .AnimationInDuration(0.55) .AnimationOutDuration(0.55) .Background("#333") .HasBadge(badgeError) .HasMessage(messageSE) .Dismiss().WithDelay(2500) .Queue(); break; } } else { Manager.CreateMessage() .Accent("DeepSkyBlue") .Animates(true) .AnimationInDuration(0.55) .AnimationOutDuration(0.55) .Background("#333") .HasBadge(badgeError) .HasMessage(messageEF) .Dismiss().WithDelay(2500) .Queue(); } } // функция регистрации
public Account CreateAccount(Account account) { return(AccountOperations.CreateAccount(account)); }