private void NextButton(AccountView p) { int len = AccountViewLists.Count; if (p == null) { AccountViewObj = AccountViewLists[0]; } else { for (int i = 0; i < len; i++) { if (p.id == AccountViewLists[i].id && i < len - 1) { AccountViewObj = AccountViewLists[i + 1]; } } Console.WriteLine(AccountViewObj.id); } SelectedItem(AccountViewObj); }
public IActionResult Transact(AccountView thisTransaction) { if (ModelState.IsValid) { if ((thisAccountTransactions.Sum(t => t.Amount) + thisTransaction.Transaction.Amount) >= 0) { HttpContext.Session.SetInt32("IsInvalidAmount", 0); thisTransaction.Transaction.AccountHolderID = (int)UserSession; dbContext.Add(thisTransaction.Transaction); dbContext.SaveChanges(); } else { HttpContext.Session.SetInt32("OverdrawAttempt", 1); return(RedirectToAction("Index")); } } HttpContext.Session.SetInt32("IsInvalidAmount", 1); return(RedirectToAction("Index")); }
/// <summary> /// 編輯帳號 /// </summary> /// <param name="id">The identifier.</param> /// <returns>ActionResult.</returns> public ActionResult Edit(Guid id) { var data = accountService.GetById(id); if (data == null) { return(HttpNotFound()); } var viewModel = new AccountViewModel(); var account = new AccountView { Id = data.Id, Account = data.Account }; viewModel.AccountView = account; viewModel.RoleCheckList = accountService.GetRoleByAdminId(id); return(View(viewModel)); }
public void init(Dictionary <string, AccountView> Accounts, ref AccountView current, string currName, Blockchain chain, string currency, UpdateMainBalance u, UpdateCurrent u2) { _chain = chain; if (active) { return; } up = u; up2 = u2; _Accounts = Accounts; _currency = currency; _chain = chain; active = true; _curName = currName; _current = current; new Thread(() => { Dispatcher.Invoke(() => { foreach (var x in Accounts) { var card = new AccountCard(); if (x.Value == _current) { card.HoverStroke.Stroke = Brushes.Red; } card.Margin = new Thickness(3); card.init(x.Key, MainWindow.ByteArrToString(x.Value.publicKey), chain.count_funds(x.Value.publicKey), x.Value, currency, _current == x.Value, onUpdate); AccountList.Children.Add(card); } Button b = new Button(); b.FontSize = 30; b.Click += B_Click; b.Margin = new Thickness(20); b.Content = "Add account"; AccountList.Children.Add(b); }); }).Start(); }
public IActionResult Modify(AccountView accountView, IFormFile inputphoto) { accountView.DayCreate = DateTime.Now; accountView.DayEdited = DateTime.Now; accountView.Status = true; string FileNameSave = "dui.jpg"; if (inputphoto != null) { FileNameSave = FileACE.SaveFile(webHostEnvironment, inputphoto, "admin/image"); FileACE.RemoveFile(webHostEnvironment, $"admin\\image\\{accountRepository.GetByIdACE(accountView.Id).Images}"); } accountView.Images = FileNameSave; int id = (int)CheckError.ErrorOrther; if (ModelState.IsValid) { id = accountRepository.ModifyACE(accountView, Convert.ToInt32(User.FindFirst("id").Value)); } switch (id) { case (int)CheckError.AlreadyEmail: ViewBag.Result = CheckError.AlreadyEmail; break; case (int)CheckError.AlreadyPhone: ViewBag.Result = CheckError.AlreadyPhone; break; case (int)CheckError.ErrorOrther: ViewBag.Result = CheckError.ErrorOrther; break; default: TempData["ModifySuccess"] = CheckError.Success; return(RedirectToAction("index")); } ViewBag.StationList = stationRepository.GetDataACE(); return(View(accountView)); }
/// <summary> /// Handles new transactions /// </summary> private void MakeTransaction() { const int WITHDRAW = 1; const int DEPOSIT = 2; Transaction newTransaction = new Transaction(); int selection; decimal transferAmount; bool bValidDecimal = true; List <int> rules = new List <int> { WITHDRAW, DEPOSIT }; Console.Clear(); AccountView.AccountAmount(mcAccount.mcAccountBalance.mBalance.ToString()); selection = ConsoleHelper.ValidateSelection(AccountView.TransactionTypeMenu, rules); if (selection == WITHDRAW) { newTransaction.TransactionType = Transaction.Type.WITHDRAW; } else { newTransaction.TransactionType = Transaction.Type.DEPOSIT; } do { Console.Clear(); if (!bValidDecimal) { ConsoleHelper.ConsoleWriteColor(ConsoleColor.Red, "Invalid Amount, must be a decimal number", true); } AccountView.TransactionAmount(); } while (!(bValidDecimal = decimal.TryParse(Console.ReadLine(), out transferAmount))); newTransaction.Amount = new Money(transferAmount); Task.Run(() => TransactionEventRaised.Invoke(newTransaction)).Wait(); }
void FindGameObjects() { // find var canvas = GameObject.Find("Canvas").transform; bmiView = canvas.Find("BMIView").GetComponent <BMIView>(); historyView = canvas.Find("HistoryView").GetComponent <HistoryView>(); accountView = canvas.Find("AccountView").GetComponent <AccountView>(); // prefab var prefab = AssetDatabase.LoadAssetAtPath <GameObject>("Assets/BMIApp/Prefabs/HistoryElm.prefab"); var historyElm = prefab.GetComponent <HistoryElmView>(); // data sharedData = ScriptableObject.CreateInstance <SharedScriptableObject>(); historyData = new TemporaryHistoryDataStore(); // set bmiPresenter.InnerPresenter = new BMIPresenter(bmiView); historyPresenter.InnerPresenter = new HistoryListPresenter(historyView, historyElm); accountPresenter.InnerPresenter = new AccountPresenter(accountView); accountRepository.InnerRepository = new UserAccountRepository(sharedData); historyRepository.InnerRepository = new BMIHistoryRepository(historyData); }
private int CheckCreate(AccountView accountView) { try { Account accountEmail = GetDataACE().SingleOrDefault(s => s.Email.Trim().ToLower() == accountView.Email.Trim().ToLower()); if (accountEmail != null) { return((int)CheckError.AlreadyEmail); } Account accountPhone = GetDataACE().SingleOrDefault(s => s.Phone.Trim() == accountView.Phone.Trim()); if (accountPhone != null) { return((int)CheckError.AlreadyPhone); } return((int)CheckError.Success); } catch (Exception e) { Debug.WriteLine(e.Message); return((int)CheckError.ErrorOrther); } }
public IActionResult Register(string id) { List <SelectListItem> roles = new List <SelectListItem> { new SelectListItem { Value = "Пользователь", Text = "Пользователь" } }; if (User.IsInRole("Администратор")) { roles = _roleManager.Roles.Select(n => new SelectListItem { Value = n.Name, Text = n.Name }).ToList(); } var account = new AccountView { RoleList = roles, PersonId = id }; return(PartialView(account)); }
public ActionResult <AccountView> ReceiveTokenAndLogon(string token, string returnUrl) { User user = _externalAuthenticationService.GetUserDetailsFrom(token); if (user.IsAuthenticated) { _formsAuthentication.SetAuthenticationToken(user.AuthenticationToken); GetCustomerRequest getCustomerRequest = new GetCustomerRequest(); getCustomerRequest.CustomerIdentityToken = user.AuthenticationToken; GetCustomerResponse getCustomerResponse = _customerService.GetCustomer(getCustomerRequest); if (getCustomerResponse.CustomerFound) { return(RedirectBasedOn(returnUrl)); } else { AccountView accountView = InitializeAccountViewWithIssue(true, "Sorry we could not find your customer account. " + "If you don't have an account with use " + "please register."); accountView.CallBackSettings.ReturnUrl = returnUrl; return(accountView); } } else { AccountView accountView = InitializeAccountViewWithIssue(true, "Sorry we could not log you in." + " Please try again."); accountView.CallBackSettings.ReturnUrl = returnUrl; return(accountView); } }
public IActionResult Create(AccountView accountView, IFormFile inputphoto) { accountView.DayCreate = DateTime.Now; accountView.DayEdited = DateTime.Now; accountView.Status = true; string FileNameSave = "dui.jpg"; if (inputphoto != null) { FileNameSave = FileACE.SaveFile(webHostEnvironment, inputphoto, "admin/image"); } accountView.Images = FileNameSave; int id = (int)CheckError.ErrorOrther; if (ModelState.IsValid) { id = accountRepository.CreateACE(accountView); } switch (id) { case (int)CheckError.AlreadyEmail: ViewBag.Result = CheckError.AlreadyEmail; break; case (int)CheckError.AlreadyPhone: ViewBag.Result = CheckError.AlreadyPhone; break; case (int)CheckError.ErrorOrther: ViewBag.Result = CheckError.ErrorOrther; break; default: return(RedirectToAction("index")); } ViewBag.StationList = stationRepository.GetDataACE(); return(View(accountView)); }
public void LogIn() { AccountView.printAccountDetails("Login: "******"Password: "******"\nTry again because Login or Password is wrong!"); Console.WriteLine("Create new acconunt if you don't have."); LogIn(); } else { string CustomerName = customer.FirstName; Console.Write("\n"); Console.WriteLine($"\nHello {CustomerName} in our shop. Now You may buy want You need :)\n"); } }
public int CreateACE(AccountView accountView) { int check = CheckCreate(accountView); if (check == (int)CheckError.Success) { Account account = new Account { Address = accountView.Address, Code = GetCode(), DayCreate = DateTime.Now, DayEdited = DateTime.Now, Description = accountView.Description, Dob = accountView.Dob, Email = accountView.Email, Gender = (byte)accountView.Gender, Images = accountView.Images, Name = accountView.Name, Password = MD5ACE.Encrypt(accountView.Password), Phone = accountView.Phone, RoleId = (byte)accountView.RoleId, StationId = accountView.StationId, Status = true, Active = true, }; Account account_1 = Add(account).Result; if (account_1 == null) { return((int)CheckError.ErrorOrther); } return((int)CheckError.Success); } else { return(check); } }
/// <summary> /// Metoda, ktora vracia ucty s udajmi pre datagrid /// </summary> /// <returns></returns> public List <AccountView> GetAccountsForView() { List <AccountView> accounts = new List <AccountView>(); using (SqlConnection connection = new SqlConnection(Constants.CONNECTION_STRING)) { connection.Open(); using (SqlCommand command = new SqlCommand()) { command.CommandText = "Select * from Account as a inner join Client as c on a.ClientId = c.ClientId"; command.Connection = connection; using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { AccountView account = new AccountView(); account.AccountId = reader.GetInt32(0); account.AccountName = reader.GetString(2); account.Iban = reader.GetString(3); account.EstablishDate = reader.GetDateTime(4); account.CancelDate = reader.IsDBNull(5) ? DateTime.MinValue : reader.GetDateTime(5); account.AccountBalance = reader.GetDecimal(6); account.OverdraftLimit = reader.GetDecimal(7); account.AmmountOfOverdraft = reader.GetDecimal(8); account.CardsCount = reader.GetInt32(9); account.ClientName = reader.GetString(11); account.ClientSurname = reader.GetString(12); account.OpNumber = reader.GetString(13); account.ClientContact = reader.GetString(17); accounts.Add(account); } } } } return(accounts); }
public async Task <IActionResult> Edit([FromBody] AccountView accountModel) { // if (!ModelState.IsValid) // { // return BadRequest(new // { // code = 400, // message = ModelState.Values.First().Errors.First().ErrorMessage // }); // } var account = _userManager.FindByIdAsync(accountModel.Id).Result; account.UserName = accountModel.Name; var result = await _userManager.UpdateAsync(account); if (result.Succeeded) { var newAccount = await _userManager.Users.Include(r => r.Role).FirstOrDefaultAsync(x => x.Id == accountModel.Id); return(Json(newAccount.ToAccountView())); } return(BadRequest()); }
public bool UpdateAccount(AccountView accountView) { if (!CheckUpdateAccount(accountView)) { var acc = GetByIdNTU(accountView.Id).Result; if (acc == null) { return(false); } if (accountView.Image != null) { acc.Image = accountView.Image; } acc.FullName = accountView.FullName; acc.Email = accountView.Email; return(UpdateNTU(acc).Result); } return(false); }
public static bool Modify(AccountView acc) { try { db = new AceEntities(); Account account = new Account { Name = acc.Name, Email = acc.Email, Address = acc.Address, Password = acc.Password, Phone = acc.Phone, Roles = acc.Role }; db.Account.Attach(account); db.Entry(account).State = EntityState.Modified; db.SaveChanges(); return(true); } catch { return(false); } }
public AccountViewCellViewModel(AccountView accountView) { AccountView = accountView; AvatarImageSource = new AvatarImageSource(AccountView.Name, AccountView.Email); }
private void materialFlatButton1_Click(object sender, EventArgs e) { AccountView a = new AccountView(); a.Show(); }
public async Task <IActionResult> Register(IFormCollection collection) { using (TransactionScope transactionScope = new TransactionScope(TransactionScopeOption.Required, TransactionScopeAsyncFlowOption.Enabled)) { User user = null; string password = collection[FormDataKeys.Password.ToString()]; string email = collection[FormDataKeys.Email.ToString()]; string firstName = collection[FormDataKeys.FirstName.ToString()]; string secondName = collection[FormDataKeys.SecondName.ToString()]; try { user = await _authenticationService.RegisterUser(email, password, true, new List <string> { "Customer" }); } catch (InvalidOperationException ex) { AccountView accountView = InitializeAccountViewWithIssue(true, ex.Message); ViewData[FormDataKeys.Password.ToString()] = password; ViewData[FormDataKeys.Email.ToString()] = email; ViewData[FormDataKeys.FirstName.ToString()] = firstName; ViewData[FormDataKeys.SecondName.ToString()] = secondName; return(View(accountView)); } if (user.IsAuthenticated) { try { CreateCustomerRequest createCustomerRequest = new CreateCustomerRequest(); createCustomerRequest.UserId = user.Id; createCustomerRequest.Email = email; createCustomerRequest.FirstName = firstName; createCustomerRequest.SecondName = secondName; _customerService.CreateCustomer(createCustomerRequest); await _cookieAuthentication.SetAuthenticationToken(user.Email, new List <string> { "Customer" }); transactionScope.Complete(); return(RedirectToAction("Detail", "Customer")); } catch (EntityBaseIsInvalidException ex) { AccountView accountView = InitializeAccountViewWithIssue(true, ex.Message); ViewData[FormDataKeys.Password.ToString()] = password; ViewData[FormDataKeys.Email.ToString()] = email; ViewData[FormDataKeys.FirstName.ToString()] = firstName; ViewData[FormDataKeys.SecondName.ToString()] = secondName; return(View(accountView)); } } else { AccountView accountView = InitializeAccountViewWithIssue(true, "Sorry we could not authenticate you. Please try again."); ViewData[FormDataKeys.Password.ToString()] = password; ViewData[FormDataKeys.Email.ToString()] = email; ViewData[FormDataKeys.FirstName.ToString()] = firstName; ViewData[FormDataKeys.SecondName.ToString()] = secondName; return(View(accountView)); } } }
public IActionResult Register() { AccountView accountView = InitializeAccountViewWithIssue(false, string.Empty); return(View(accountView)); }
public AccountViewCellViewModel(AccountView accountView) { AccountView = accountView; AvatarImageSource = ServiceContainer.Resolve <IAvatarImageSourcePool>("avatarImageSourcePool") ?.GetOrCreateAvatar(AccountView.Name, AccountView.Email); }
public ActionResult LogOn() { AccountView accountView = InitializeAccountViewWithIssue(false, ""); return(View(accountView)); }
/// <summary> /// 編輯帳號 /// </summary> /// <param name="id">The identifier.</param> /// <returns>ActionResult.</returns> public ActionResult Edit(Guid id) { var data = accountService.GetById(id); if (data == null) return HttpNotFound(); var viewModel = new AccountViewModel(); var account = new AccountView { Id = data.Id, Account = data.Account }; viewModel.AccountView = account; viewModel.RoleCheckList = accountService.GetRoleByAdminId(id); return View(viewModel); }
private void AccountBrowserCommandExecuted(object obj) { AccountView accountView = new AccountView(); accountView.ShowDialog(); }
static void Main(string[] args) { ConsoleKeyInfo cki; string message = string.Empty; BankView bankView = new BankView(); AccountView accountView = new AccountView(); Console.OutputEncoding = System.Text.Encoding.UTF8; do { cki = UserInterface(); switch (cki.Key) { case ConsoleKey.C: bankView.CreateBank(); message = "\n------------------------------------\nPaina Enter jatkaaksesi!"; break; case ConsoleKey.U: bankView.UpdateBank(); message = "\n-----------------------------------\nPaina Enter jatkaaksesi!"; break; case ConsoleKey.D: bankView.DeleteBank(8); message = "\n------------------------------------\nPaina Enter jatkaaksesi!"; break; case ConsoleKey.A: bankView.CreateCustomer(); message = "\n------------------------------------\nPaina Enter jatkaaksesi!"; break; case ConsoleKey.B: accountView.CreateAccount(); message = "\n------------------------------------\nPaina Enter jatkaaksesi!"; break; case ConsoleKey.E: bankView.PrintAccounts(_accountRepository.Read()); message = "\n------------------------------------\nPaina Enter jatkaaksesi!"; break; case ConsoleKey.F: bankView.PrintCustomers(_customerRepository.Read()); message = "\n------------------------------------\nPaina Enter jatkaaksesi!"; break; case ConsoleKey.G: bankView.UpdateCustomer(); message = "\n------------------------------------\nPaina Enter jatkaaksesi!"; break; case ConsoleKey.H: bankView.DeleteCustomer(14); message = "\n------------------------------------\nPaina Enter jatkaaksesi!"; break; case ConsoleKey.I: accountView.DeleteAccount("22113344556677"); message = "\n------------------------------------\nPaina Enter jatkaaksesi!"; break; case ConsoleKey.J: accountView.ReadbyId(1); message = "\n------------------------------------\nPaina Enter jatkaaksesi!"; break; case ConsoleKey.K: accountView.CreateTransaction(); message = "\n------------------------------------\nPaina Enter jatkaaksesi!"; break; case ConsoleKey.L: accountView.GetTransactionByIban("112233445566778"); message = "\n------------------------------------\nPaina Enter jatkaaksesi!"; break; case ConsoleKey.R: accountView.PrintAll(); message = "\n------------------------------------\nPaina Enter jatkaaksesi!"; break; case ConsoleKey.Escape: message = "\nOhjelman suoritus päättyy."; break; default: message = "Virhe - Paina Enter ja aloita alusta!"; break; } Console.WriteLine(message); Console.ReadLine(); Console.Clear(); } while (cki.Key != ConsoleKey.Escape); Console.WriteLine("Ohjelman suoritus päättyi!"); }
private bool CheckUpdateAccount(AccountView accountView) { return(GetAllNTU().FirstOrDefault(p => p.Id != accountView.Id && p.Email.ToLower() == accountView.Email.ToLower()) == null ? true : false); }
public void onLoginSuccess() { gameObject.SetActive(false); GameObject.Find("Canvas").transform.Find("AvatarSelectPanel").gameObject.SetActive(true); _accountView = new AccountView(); }
public Boolean CanDelete(AccountView view) { return(IsCorrectPassword(view.Password)); }
//[Route("")] public void Update([FromBody] AccountView inst) { accountService.Update(inst.AccountFromViewToDomain()); }
private void toolStripMenuItemAccountView_Click(object sender, EventArgs e) { AccountView accountView = new AccountView { MdiParent = this }; accountView.Show(); }
public ContactPage(sendTransaction onSendTx, Blockchain chain, AccountView v) { init(onSendTx, chain); cur = v; }