private void btnAddAccount_Click(object sender, EventArgs e) { string accountName = txtAccountName.Text; listBoxAccounts.Items.Add(accountName); accService.CreateAccount(accountName, AccountType.Silver); }
public ActionResult Create(RegisterModel user, string[] selectedroles) { if (ModelState.IsValid) { try { AccountServices.CreateAccount(user.UserName, user.Password, user.Email, user.FirstName, user.LastName, user.TimeZone, user.Culture, false, selectedroles); return(RedirectToRoute("Default", new { controller = "User", action = "Index" })); } catch (MembershipCreateUserException ex) { if ((ex.StatusCode == MembershipCreateStatus.DuplicateUserName) || (ex.StatusCode == MembershipCreateStatus.InvalidUserName)) { ModelState.AddModelError("UserName", ErrorCodeToString(ex.StatusCode)); } else if ((ex.StatusCode == MembershipCreateStatus.DuplicateEmail) || (ex.StatusCode == MembershipCreateStatus.InvalidEmail)) { ModelState.AddModelError("Email", ErrorCodeToString(ex.StatusCode)); } else if (ex.StatusCode == MembershipCreateStatus.InvalidPassword) { ModelState.AddModelError("Password", ErrorCodeToString(ex.StatusCode)); } else { ModelState.AddModelError("", ErrorCodeToString(ex.StatusCode)); } } catch (Exception ex) { throw new Exception("Se ha producido un error en el envío del mail. Intentelo de nuevo en unos minutos."); } } return(View(user)); }
private void btnAdd_Click(object sender, EventArgs e) { string accName = txtAccName.Text; //get the account name lbxCurrent.Items.Add(accName); //add the new account name to the list txtAccName.Text = ""; //remove the txt from the box accService.CreateAccount(accName, Domain.AccountType.Silver); //create the new account }
private void AddButton1_Click(object sender, EventArgs e) { string accName = accNameText.Text; CurrentAccountListBox1.Items.Add(accName); accNameText.Text = ""; accServices.CreateAccount(accName, Domain.AccountType.Silver); }
/// <summary> /// Create a new account button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddAccount_Click(object sender, EventArgs e) { string accountName = txtAccountName.Text; string accType = listBox_AcctType.SelectedItem.ToString(); listBoxAccounts.Items.Add(accountName); if (accType == "Platinum") { accService.CreateAccount(accountName, AccountType.Platinum); } else if (accType == "Gold") { accService.CreateAccount(accountName, AccountType.Gold); } else { accService.CreateAccount(accountName, AccountType.Silver); } }
// Adds a new account to the list only if the account name is not // null or empty. Called when the user clicks add account private void addBtn_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(newAcctTxt.Text)) { string acctName = newAcctTxt.Text; currentAcctsList.Items.Add(acctName); acctServices.CreateAccount(acctName, AccountType.Silver); newAcctTxt.ResetText(); } }
/// <summary> /// Create a new account button. Only do so if the name of the account is not null or plain white space and /// an account type is selected from the dropdown. /// Clear the text area when added. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddAccount_Click_1(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(txtAccountName.Text) && (comboAccountType.SelectedIndex > -1)) { string accountName = txtAccountName.Text; AccountType accountType = (AccountType)comboAccountType.SelectedItem; listBoxAccounts.Items.Add(accountName); accService.CreateAccount(accountName, accountType); txtAccountName.ResetText(); } }
/// <summary> /// Create a new account button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddAccount_Click(object sender, EventArgs e) { string accountName = txtAccountName.Text; if (listBoxAccounts.Items.Contains(accountName)) { Console.Write("You have already used that name for an account!"); } else { listBoxAccounts.Items.Add(accountName); accService.CreateAccount(accountName, AccountType.Silver); } }
public JsonResult <APIResultEntities <bool> > Post(AcountsEntities entity) { APIResultEntities <bool> rs = new APIResultEntities <bool>(); try { _iAccountServices.CreateAccount(entity); rs.Data = true; rs.ErrCode = ErrorCodeEntites.Success; rs.ErrDescription = string.Format(Constants.MSG_INSERT_SUCCESS, Constants.Account); } catch (Exception ex) { rs.Data = false; rs.ErrCode = ErrorCodeEntites.Fail; rs.ErrDescription = ex.ToString(); throw new Exception(ex.ToString()); } return(Json(rs)); }
private void btnAdd_Click(object sender, EventArgs e) { string accountName = accName.Text; decimal accountBalance; //prevents an error if nothing is put in the balance box if (accBalance.Text == "") { accountBalance = 0; } else { accountBalance = Decimal.Parse(accBalance.Text); } lbAccounts.Items.Add(accountName); accService.CreateAccount(accountName, AccountType.Silver); accService.Deposit(accountName, accountBalance); }
public IActionResult CreateAccount(AccountViewModel accountViewModel) { var sucessCheck = _accountServices.CreateAccount(accountViewModel); return(Ok(sucessCheck)); }
public async Task <IActionResult> PostAccount(Account account) { return(Ok(await accountServices.CreateAccount(account))); }