public void CreateCustomer() { Console.Clear(); AsciiHeader.AsciiHead(); Customer newCustomer = new Customer(); Console.WriteLine("Enter Customer First Name: "); newCustomer.FName = Console.ReadLine(); Console.WriteLine("Enter Customer Last Name: "); newCustomer.LName = Console.ReadLine(); Console.WriteLine("Create a username for the customer: "); newCustomer.Username = Console.ReadLine(); Console.WriteLine("Set Customer Account Default Password: "******"Customer {newCustomer.FName} {newCustomer.LName} created successfully!"); Log.Information("New customer added to database"); Console.WriteLine("Press enter to return to the managerial portal."); Console.ReadLine(); Console.Clear(); }
public void CreateCustomer() { Console.WriteLine("Cheers! Welcome to the Dozen family!"); Console.WriteLine("_____________________________________"); Customer customer = new Customer(); Console.WriteLine("Enter your age"); customer.Age = Console.ReadLine(); if (int.Parse(customer.Age) < 21) { Console.WriteLine("You aren't old enough!"); return; } else { Console.WriteLine("Enter your full name [FirstName LastName]"); customer.Name = Console.ReadLine(); Console.WriteLine("Enter your phone number"); customer.PhoneNumber = Console.ReadLine(); Program.currentCustomer = _customerBL.AddCustomer(customer); Console.WriteLine("Customer successfully added!"); var beermenu = new BeerMenu(_inventoryBL, _orderBL); beermenu.Start(); } }
public void CreateCustomer() { Console.WriteLine("Enter customer first name: "); string fName = Console.ReadLine(); Console.WriteLine("Enter customer last name: "); string lName = Console.ReadLine(); bool correctPhoneNumberFormat = false; string phoneNumber = ""; do { Console.WriteLine("Enter customer phone number: "); phoneNumber = Console.ReadLine(); if (phoneNumber.Length != 12) { Console.WriteLine("Error - phone number must be formatted xxx-xxx-xxxx"); } else if (phoneNumber[3] != '-' && phoneNumber[7] != '-') { Console.WriteLine("Error - phone number must be formatted xxx-xxx-xxxx"); } else { bool allNums = true; for (int i = 0; i < 10; i++) { if (i == 3 || i == 7) { continue; } if (char.IsDigit(phoneNumber[i]) == false) { allNums = false; } } if (allNums) { correctPhoneNumberFormat = true; } else { Console.WriteLine("Error - one of the entrys for the phone number is not a digit"); } } }while(!correctPhoneNumberFormat); Customer newCustomer = new Customer(fName, lName, phoneNumber); _customerBL.AddCustomer(newCustomer); //BL add customer Console.WriteLine("Customer successfully added!"); Log.Information($"Added customer {newCustomer.FirstName} {newCustomer.LastName}"); }
public ActionResult Create(CustomerCreateVM customerCreateVM) { try { var customer = _mapper.Map <Dozen2Models.Customer>(customerCreateVM); _customerBL.AddCustomer(customer); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public void CreateCustomer() { Customer newCustomer = new Customer(); Console.WriteLine("Enter Your First Name: "); newCustomer.FirstName = Console.ReadLine(); Console.WriteLine("Enter Your Last Name: "); newCustomer.LastName = Console.ReadLine(); Console.WriteLine("Please Enter Your Phone Number ((###)-###-####): "); newCustomer.PhoneNumber = Console.ReadLine(); _customerBL.AddCustomer(newCustomer); Console.WriteLine($"Added Customer, {newCustomer.FirstName} {newCustomer.LastName} !"); }
public void AddNewCustomer() { //create new customer Customer newCustomer = new Customer(); Console.WriteLine("Please enter customers name: "); newCustomer.CustomerName = Console.ReadLine(); Console.WriteLine("Please enter email: "); newCustomer.CustomerEmail = Console.ReadLine(); _customerBL.AddCustomer(newCustomer); Console.WriteLine($"New customer added! Welcome {newCustomer.CustomerName}!"); Log.Information($"New customer added. Details:{newCustomer.ToString()}"); StartShopping(_customerBL.GetCustomerByName(newCustomer.CustomerName)); }
public int AddCustomer() { string names = _verify.VerifyString("Please enter your name:"); string locales = _verify.VerifyString("Please enter your location:"); Customers Harambe = new Customers(names, locales); bool customerExist = _customerBL.GetCustomer2(Harambe); if (!customerExist) { Customers customerCreated = _customerBL.AddCustomer(Harambe); Log.Information("New customer created!"); return(_customerBL.GetCustomer1(Harambe)); } Console.WriteLine($"Welcome back {names}"); return(_customerBL.GetCustomer1(Harambe)); }
public ActionResult Create(CustomerCRVM newCustomer) { if (ModelState.IsValid) { try { _customerBL.AddCustomer(_mapper.cast2Customer(newCustomer)); Log.Information($"Customer created-- Email: {newCustomer.CustomerEmail}"); //move this loop to BL foreach (var loc in _locationBL.GetLocations()) { CustomerCart cart = new CustomerCart(); cart.CustId = _customerBL.GetCustomerByEmail(newCustomer.CustomerEmail).Id; cart.LocId = loc.Id; cart.CurrentItemsId = _orderLineItemBL.Ident_Curr() + 1; _cartBL.AddCustomerCart(cart); CustomerOrderLineItem orderLineItem = new CustomerOrderLineItem(); orderLineItem.OrderId = cart.CurrentItemsId; orderLineItem.ProdId = null; orderLineItem.Quantity = 0; orderLineItem.ProdPrice = 0; _orderLineItemBL.AddCustomerOrderLineItem(orderLineItem); } //Helper.WriteInformation($"Customer created-- Email: {newCustomer.CustomerEmail}"); return(Redirect("/Customer/Login")); } catch (Exception e) { Helper.WriteError(e, "Error"); Helper.WriteFatal(e, "Fatal"); Helper.WriteVerbose(e, "Verbose"); return(View()); } finally { } } return(View()); }
public ActionResult Create(CustomerVM custVM) { try { if (ModelState.IsValid) { _custBL.AddCustomer(new Customer { Id = custVM.Id, FirstName = custVM.FirstName, LastName = custVM.LastName }); return(RedirectToAction(nameof(Index))); } return(View(custVM)); } catch { return(View(custVM)); } }
private void AddCustomer() { //ToDo // logic validation - check if cutomer already exists on BL // gatekeeper validation - check valid string try { Console.WriteLine("\t Enter first name:"); string firstname = Console.ReadLine(); Console.WriteLine("\t Enter middle name:"); string middlename = Console.ReadLine(); Console.WriteLine("\t Enter last name:"); string lastname = Console.ReadLine(); Console.WriteLine("\t Enter last name:"); string phoneNumber = Console.ReadLine(); Customer userInput = new Customer(lastname, middlename, firstname, phoneNumber); Customer output = _customerBL.AddCustomer(userInput); Console.WriteLine($"Customer {output.ToString()} has added successfully"); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
/// <summary> /// UI to add a customer /// </summary> private void AddACustomer() { Console.WriteLine("\nEnter the details of the customer you want to add"); string firstName = _validate.ValidateString("Enter the customer first name: "); string lastName = _validate.ValidateString("Enter the customer last name"); string birthdate = _validate.ValidateString("Enter the customer birthdate (MM/DD/YYYY): "); string phoneNumber = _validate.ValidateString("Enter the customer phone number: "); string email = _validate.ValidateString("Enter the customer email: "); string mailAddress = _validate.ValidateString("Enter the customer mailing address: "); Log.Information("Customer information input"); try { // New customer model created and sent to Business Logic Customer newCustomer = new Customer(firstName, lastName, birthdate, phoneNumber, email, mailAddress); Customer createdCustomer = _customerBL.AddCustomer(newCustomer); Console.WriteLine("New Customer Created!\n"); Console.WriteLine(createdCustomer.ToString()); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public void CreateCustomer() { _customerBL.AddCustomer(GetCustomerDetails()); Console.WriteLine("Customer Successfully Created!"); }