/// <summary> /// Adds Account. /// </summary> /// <returns></returns> public static async Task AddAccount() { try { //Read inputs Account distributor = new Account(); Write("Name: "); distributor.DistributorName = ReadLine(); Write("Mobile: "); distributor.DistributorMobile = ReadLine(); Write("Email: "); distributor.Email = ReadLine(); Write("Password: "******"Account Added"); } } } catch (Exception ex) { ExceptionLogger.LogException(ex); WriteLine(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { //Redirection if not login if (this.Session["custID"] == null) { Response.Redirect(ConfigurationManager.AppSettings["SecurePath"] + "/UL/Customer/Login.aspx"); } try { string email = this.Session["Email"].ToString(); //session information check if (email != null) { AccountBL BL = new AccountBL(); AccountDTO account = new AccountDTO(); account = BL.GetCustomer(email); lblGoodBye.Text = $"Good Bye {account.GetFirstName()} {account.GetLastName()}"; //Session variable removing this.Session.Remove("CustID"); this.Session.Remove("Email"); this.Session.Remove("DateInit"); } } catch (Exception ex) { Debug.Write(ex.ToString()); lblGoodBye.Text = "Good bye"; } }
public async Task <ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { AccountBL accountBL = new AccountBL(); var persona = new Cliente { Nombre = model.Nombre, Direccion = model.Direccion, Email = model.Email, Password = model.Password, Rol = new List <Rol>() { new RolBL().GetRol((int)RolUser.User) } }; var result = accountBL.CreateAccount(persona); if (result.Succeeded) { SingIn(persona); return(RedirectToAction("Index", "Home")); } AddErrors(result); } // Si llegamos a este punto, es que se ha producido un error y volvemos a mostrar el formulario return(View(model)); }
public ActionResult _Edit(AccountEditViewModel model) { if (!ModelState.IsValid) { return(PartialView(model)); } var account = AccountBL.Get(model.ID, base._DB); if (account.Password != model.ExPassword) { throw new BusinessException("Eski şifrenizi kontrol ederek tekrar deneyiniz."); } var mapper = new AccountMapper(); var accountDTO = mapper.MapToDTO(model); AccountBL.Update(accountDTO.ID, accountDTO, base._DB); return(new ContentResult() { Content = "OK" }); }
private static AccountBL objectIntialize() { var repository = new Mock <IAccountRL>(); var business = new AccountBL(repository.Object); return(business); }
public static IEnumerable <SelectListItem> GetAccountList(string orderState) { var db = new JewelleryDBEntities(); var accounts = AccountBL.GetList(db); var state = (OrderStates)Enum.Parse(typeof(OrderStates), orderState); string role = null; switch (state) { case OrderStates.WAITING: role = Infrastructure.Core.Constants.Roles.Boiler; break; case OrderStates.STONECUTTER: role = Infrastructure.Core.Constants.Roles.StoneCutter; break; case OrderStates.POLISHER: role = Infrastructure.Core.Constants.Roles.Polisher; break; } return(accounts.Where(q => q.Role == role).Select(q => new SelectListItem() { Text = q.FullName, Value = q.Id.ToString() })); }
public static void Login() { // o.OrderAccount=new Account(); AccountBL account = new AccountBL(); Account a = new Account(); while (true) { Console.Write("Input user: "******"Input password: "******"login successfully!!!"); Program.CafeManagementSystem(account.login(a.Username, a.Password)); break; } else if (result == null) { Console.WriteLine("Wrong value, pls re-enter "); } } }
/// <summary> /// Displays list of Account. /// </summary> /// <returns></returns> public static async Task ViewAccounts() { try { using (IAccountBL distributorBL = new AccountBL()) { //Get and display list of accounts. List <Account> distributors = await distributorBL.GetAllAccountBL(); WriteLine("ACCOUNTS:"); if (distributors != null && distributors?.Count > 0) { WriteLine("#\tName\tMobile\tEmail\tCreated\tModified"); int serial = 0; foreach (var distributor in distributors) { serial++; WriteLine($"{serial}\t{distributor.DistributorName}\t{distributor.DistributorMobile}\t{distributor.Email}\t{distributor.CreationDateTime}\t{distributor.LastModifiedDateTime}"); } } } } catch (Exception ex) { ExceptionLogger.LogException(ex); WriteLine(ex.Message); } }
public JsonResult JsonExternalLogin(LoginModel model, string ReturnUrl) { if (ModelState.IsValid) { //Step 1: Get data from Sp and check it AccountBL Ab = new AccountBL(); ContactDetails cd = new ContactDetails(); cd = Ab.CheckLogin(model.UserName, model.Password); if (cd.CustomerID > 0) { //cd.CustomerID = 0; FormsAuthentication.SetAuthCookie(model.UserName, false); SiteSession siteSession = new SiteSession(cd); SessionHelper.UserSession = siteSession; UrlHelper u = new UrlHelper(HttpContext.Request.RequestContext); string url = string.Empty; if (SessionHelper.UserSession.RoleID == UserRole.SuperAdmin || SessionHelper.UserSession.RoleID == UserRole.Admin|| SessionHelper.UserSession.RoleID == UserRole.Staff) url = u.Action("Index", "Search", null); else url = u.Action("Index", "SetupCustomer", null); return Json(new { success = true, redirect = string.IsNullOrEmpty(ReturnUrl) ? url : ReturnUrl }); } else { ModelState.AddModelError("", "Please provide valid User Name/Password."); } } return Json(new { errors = KeyValue.GetErrorsFromModelState(ViewData) }); }
public void populateDataGrideview() { DataTable dt = new DataTable(); AccountBL AccountBLOBJ = new AccountBL(); dt = AccountBLOBJ.GetExistingAccountBL(); AccountdataGridView1.DataSource = dt; }
public IActionResult RemoveAccount(int id) { AccountBL accountBL = new AccountBL(); var account = _context.Accounts.Where(a => a.ID == id).FirstOrDefault(); accountBL.RemoveAccount(account, _context); return(RedirectToAction(nameof(DisplayAccounts))); }
public IActionResult Withdraw(int id, string amount) { AccountBL accountBL = new AccountBL(); var account = _context.Accounts.Where(a => a.ID == id).FirstOrDefault(); accountBL.WithDraw(account, _context, Convert.ToDouble(amount)); return(RedirectToAction(nameof(DisplayAccounts))); }
public void Log_in() { string uname = null; AccountBL act = new AccountBL(); if (act.checkPhone(txtUsername.Text) != null) { uname = act.checkPhone(txtUsername.Text).ToString(); GLOBAL.GetUsername(uname); } else { GLOBAL.GetUsername(txtUsername.Text); } if (LoginCheck() == true) { SysLOG.DateLogin = DateTime.Now.ToString(); SysLOG.UserName = GLOBAL.username; SysLOG.Online = true; switch (DefineAccount()) { case 0: reLoadUserPassword(); f1.managerToolStripMenuItem.Enabled = true; this.Close(); break; case 1: reLoadUserPassword(); f1.managerToolStripMenuItem.Enabled = false; this.Close(); break; case 2: reLoadUserPassword(); f1.managerToolStripMenuItem.Enabled = false; this.Close(); break; case 3: reLoadUserPassword(); f1.managerToolStripMenuItem.Enabled = false; this.Close(); break; case 5: MessageBox.Show("Not approve"); return; } accountLog.insertAccount(SysLOG.UserName, SysLOG.DateLogin, SysLOG.DateLogout, SysLOG.Status); f1.AccessSuccess(); } else { MessageBox.Show("Invalid Username or Password", "Login error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ActionResult _Delete(int id) { AccountBL.Delete(id, base._DB); return(new ContentResult() { Content = "OK" }); }
public IActionResult PayLoan(int id, string amount, string FromAccountNo) { AccountBL accountBL = new AccountBL(); var account = _context.Accounts.Where(a => a.ID == id).FirstOrDefault(); var ToAccount = _context.Accounts.Where(a => a.AccountNumber == Convert.ToInt32(FromAccountNo)).FirstOrDefault(); accountBL.PayLoanInstallment(account, ToAccount, _context, Convert.ToDouble(amount)); return(RedirectToAction(nameof(DisplayAccounts))); }
public ActionResult _Edit(int id) { var accountDTO = AccountBL.Get(id, base._DB); var mapper = new AccountMapper(); var model = mapper.MapToViewModel(accountDTO); return(PartialView(model)); }
private bool HasPassword() { var user = new AccountBL().GetClienteById(Convert.ToInt32(User.Identity.GetUserId())); //UserManager.FindById(User.Identity.GetUserId()); if (user != null) { return(user.Password != null); } return(false); }
public IActionResult Transfer(int id, double amount, string FromAccountNo) { AccountBL accountBL = new AccountBL(); var FromAccount = _context.Accounts.Where(a => a.ID == Convert.ToInt32(id)).FirstOrDefault(); var ToAccount = _context.Accounts.Where(a => a.AccountNumber == Convert.ToInt32(FromAccountNo)).FirstOrDefault(); accountBL.Transfer(FromAccount, ToAccount, _context, amount); return(RedirectToAction(nameof(DisplayAccounts))); }
public ActionResult Create(AccountDTO account) { if (!ModelState.IsValid) { return(View(account)); } AccountBL.Create(account, base._DB); return(RedirectToAction("Index")); }
public void AccountForgotPassword() { AccountBL business = objectIntialize(); var modelForgotPassword = new ForgotPassword() { Email = "*****@*****.**" }; var dataForgotPassword = business.ForgotPassword(modelForgotPassword); Assert.NotNull(dataForgotPassword); }
static void Deposit(int customerId) { // Get account number and amount. Console.Write("Enter account number: "); int accountId = Int32.Parse(Console.ReadLine()); Console.Write("Enter amount: "); double depositAmount = Convert.ToDouble(Console.ReadLine()); AccountBL accountBL = new AccountBL(); accountBL.Deposit(customerId, accountId, depositAmount); }
static void Withdraw() { // Get account number and amount. Console.Write("Enter account number: "); int accountId = Int32.Parse(Console.ReadLine()); Console.Write("Enter amount: "); double withdrawAmount = Convert.ToDouble(Console.ReadLine()); AccountBL accountBL = new AccountBL(); accountBL.Withdraw(cid, accountId, withdrawAmount); }
public void AccountLogin() { AccountBL business = objectIntialize(); var modelLogin = new LoginRequestModel() { Email = "*****@*****.**", Password = "******" }; var dataLogin = business.Login(modelLogin); Assert.NotNull(dataLogin); }
static void ListTransactions() { Console.Write("Enter account number: "); int accountId = Int32.Parse(Console.ReadLine()); AccountBL accountBL = new AccountBL(); var transactions = accountBL.ListTransactions(accountId); foreach (var t in transactions) { Console.WriteLine($"Id: {t.Id} Type: {t.Type} Amount: {t.Amount}"); } Console.WriteLine(); }
/// <summary> /// Updates Account. /// </summary> /// <returns></returns> public static async Task UpdateAccount() { try { using (IAccountBL distributorBL = new AccountBL()) { //Read Sl.No Write("Account #: "); bool isNumberValid = int.TryParse(ReadLine(), out int serial); if (isNumberValid) { serial--; List <Account> distributors = await distributorBL.GetAllAccountsBL(); if (serial <= distributors.Count - 1) { //Read inputs Account distributor = distributors[serial]; Write("Name: "); distributor.DistributorName = ReadLine(); Write("Mobile: "); distributor.DistributorMobile = ReadLine(); Write("Email: "); distributor.Email = ReadLine(); //Invoke UpdateDistributorBL method to update bool isUpdated = await distributorBL.UpdateAccountBL(distributor); if (isUpdated) { WriteLine("Account Updated"); } } else { WriteLine($"Invalid Account #.\nPlease enter a number between 1 to {distributors.Count}"); } } else { WriteLine($"Invalid number."); } } } catch (Exception ex) { ExceptionLogger.LogException(ex); WriteLine(ex.Message); } }
public IActionResult EditProfile(UserCreateModel userEdit) { var validator = new UserCreateValidator(); if (validator.Validate(userEdit).IsValid) { var accountBL = new AccountBL(_uow, _mapper); if (accountBL.EditProfile(userEdit)) { return(RedirectToAction("AccountPage")); } } return(View(userEdit)); }
public ActionResult SignUp(SignUp signUp) { if (ModelState.IsValid) { Account account = AutoMapper.Mapper.Map <Models.SignUp, Account>(signUp); account.Role = "User"; bool result = AccountBL.SignUp(account); if (result) { return(RedirectToAction("LogIn")); } } return(View()); }
/// <summary> /// Generate the mail containing invoice information /// send the mail to the user /// </summary> /// <param name="invoice"></param> private void MailSender(InvoiceDTO invoice) { string email = this.Session["Email"].ToString(); if (email != null) { //Mail sending procedure //Body creation AccountBL accountBL = new AccountBL(); AccountDTO customer = accountBL.GetCustomer(email); List <ProductSelectionDTO> products = (List <ProductSelectionDTO>)(this.Session["Cart"]); //Introduction string body = "Hi, " + customer.GetFirstName() + " " + customer.GetLastName() + ",\n\nHere your order of " + invoice.GetOrderDate().ToString("dd/MM/yyyy") + " :\n\n"; //List of product foreach (ProductSelectionDTO p in products) { body += p.GetQuantity() + " " + p.GetProduct().GetName() + " " + p.GetOrigSize() + " at " + p.GetOrigPrice() + "/Unit\n"; } //Invoice costs body += "\nShipping cost :" + invoice.GetShippingCost() + "AUS$\nTax : " + invoice.GetTax() + "%\nTotal Amount : " + invoice.GetTotal() + " AUS$\nEstimate arrival date : " + invoice.GetArrivalDate().ToString("dd/MM/yyyy"); body += "\n\nThank you for your confidence.\nHope to see you soon on LaitBrasseur.com !"; //Message creation (To / From/ link to verification) MailMessage mm = new MailMessage(); mm.To.Add(new MailAddress(email)); mm.From = new MailAddress("*****@*****.**"); mm.Body = body; mm.IsBodyHtml = false; mm.Subject = "Your order " + invoice.GetOrderDate().ToString("dd/MM/yyyy"); //SMTP client initialization (gmail with projet address) SmtpClient smcl = new SmtpClient(); smcl.Host = "smtp.gmail.com"; smcl.Port = 587; smcl.Credentials = new NetworkCredential("*****@*****.**", "clementjanina"); smcl.EnableSsl = true; smcl.Send(mm); //Feedback lblResult.CssClass = "text-success"; lblResult.Text += "A confirmation email has been sent."; } else { lblResult.Text = "There is a problem with your email."; } }
public void Execute(IServiceProvider serviceProvider) { PluginContext localContext = new PluginContext(serviceProvider); var accountValidator = new AccountBL(localContext.ToPassthroughContext()); // only if needed locally - create a full plugin context var result = accountValidator.ValidateNewAccount(localContext.TargetEntity.ToEntity <Account>()); if (result.HasError) { throw new InvalidPluginExecutionException(result.ErrorDescription); } }
/// <summary> /// Delete Account. /// </summary> /// <returns></returns> public static async Task DeleteAccount() { try { using (IAccountBL distributorBL = new AccountBL()) { //Read Sl.No Write("Account #: "); bool isNumberValid = int.TryParse(ReadLine(), out int serial); if (isNumberValid) { serial--; List <Account> distributors = await distributorBL.GetAllAccountsBL(); if (serial <= distributors.Count - 1) { //Confirmation Account distributor = distributors[serial]; Write("Are you sure? (Y/N): "); string confirmation = ReadLine(); if (confirmation.Equals("Y", StringComparison.OrdinalIgnoreCase)) { //Invoke DeleteDistributorBL method to delete bool isDeleted = await distributorBL.DeleteAccountBL(distributor.DistributorID); if (isDeleted) { WriteLine("Account Deleted"); } } } else { WriteLine($"Invalid Account #.\nPlease enter a number between 1 to {distributors.Count}"); } } else { WriteLine($"Invalid number."); } } } catch (Exception ex) { ExceptionLogger.LogException(ex); WriteLine(ex.Message); } }
private void deleteaccountbuttonbutton_Click(object sender, EventArgs e) { Accounts accounts = new Accounts(); accounts.AID = accountidtextBox.Text; accounts.AdmissonFee = admissionfeetextBox.Text; accounts.Due = duetextBox.Text; accounts.ExtraCarriculamFee = extracarriculamtextBox.Text; accounts.LabratoreyFee = labretoryfeetextBox.Text; accounts.LibraryFee = libraryfeetextBox.Text; accounts.SemisterFee = semisterfeetextBox.Text; accounts.TotalPaid = totalpaidtextBox.Text; accounts.TransPortFee = transportfeetextBox.Text; accounts.TutionFee = tutionfeetextBox.Text; accounts.Waiver = waivertextBox.Text; AccountBL AccountBLOBJ = new AccountBL(); bool result = AccountBLOBJ.DeleteAnewAccountAndSendToDA(accounts); if (result) { MessageBox.Show("DELETE IS COMPLETE"); this.populateDataGrideview(); confirmbutton.Enabled = true; modifeybutton.Enabled = true; clearbutton.Enabled = true; deleteaccountbuttonbutton.Enabled = true; accountidtextBox.Text = " "; admissionfeetextBox.Text = " "; tutionfeetextBox.Text = " "; waivertextBox.Text = " "; duetextBox.Text = " "; libraryfeetextBox.Text = " "; labretoryfeetextBox.Text = " "; extracarriculamtextBox.Text = " "; totalpaidtextBox.Text = " "; semisterfeetextBox.Text = " "; transportfeetextBox.Text = " "; } else { MessageBox.Show("RESULT: " + AccountBLOBJ.Message); } }