public void Authenticate() { var authenticationServices = new AuthenticationServices(); var customerServices = new CustomerServices(); authenticationServices.Authenticate("user", "pass"); }
/// <summary> /// Calls the customer service. /// </summary> private static void CallCustomerService() { var customerServices = new CustomerServices(); Register(customerServices); customerServices.Save(new Customer { Name = "Srihari" }); UnRegister(customerServices); //Call the method below, to demonstrate OnException Aspect. //customerServices.GetAllCustomers(); }
public LaunchMenu(lacrosseContext context, ICustomerRepo custRepo, IManagerRepo managerRepo, ILocationRepo locRepo, ICartRepo cartRepo) { this.context = context; this.custRepo = custRepo; this.locRepo = locRepo; this.cartRepo = cartRepo; this.managerRepo = managerRepo; this.customerServices = new CustomerServices(custRepo); this.locationServices = new LocationServices(locRepo); this.cartServices = new CartServices(cartRepo); this.managerServices = new ManagerServices(managerRepo); }
public ValuesController( BolServices _bolServices, BranchServices _branchServices, CustomerServices _customerServices, MerchandiseTypeServices _merchandiseTypeServices ) { bolServices = _bolServices; branchServices = _branchServices; customerServices = _customerServices; merchandiseTypeServices = _merchandiseTypeServices; }
public ActionResult GetCustomers() { try { var status = new CustomerServices().GetCustomers(); return(Json(status, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(new StockGenericObject(), JsonRequestBehavior.AllowGet)); } }
public string CustomerID(string text) { string id; var services = new CustomerServices(); do { id = GetCustomerID(text); } while (!services.ValidCustomerID(id)); return(id); }
static void Main(string[] args) { var services = new CustomerServices(); var customers = services.GetAll(); foreach (var customer in customers) { Console.WriteLine($"{customer.Address}"); } Console.ReadLine(); }
/// <summary> /// Calls the customer service. /// </summary> private static void CallCustomerService() { var customerServices = new CustomerServices(); Register(customerServices); customerServices.Save(new Customer { Name = "Srihari" }); UnRegister(customerServices); //Call the method below, to demonstrate OnException Aspect. //customerServices.GetAllCustomers(); }
static void Main(string[] args) { var customerServices = new CustomerServices(); var JohnDoe = customerServices.CreateCustomer("John", "Doe", "123456789"); var JaneDoe = customerServices.CreateCustomer("Jane", "Doe", "987654321"); PerformTransaction(JohnDoe.Accounts[0], JaneDoe.Accounts[0], 100); Console.WriteLine($"John's account balance: {JohnDoe.Accounts[0].Balance}"); Console.WriteLine($"Jane's account balance: {JaneDoe.Accounts[0].Balance}"); Console.ReadLine(); }
protected void btnAccept_Click(object sender, EventArgs e) { Customer customer = new Customer(Request["Id"]) { Name = txtName.Text, Address = txtAddress.Text }; CloudStorageAccount storage = CloudStorageAccount.FromConfigurationSetting("DataConnectionString"); CustomerServices service = new CustomerServices(new DataContext(storage)); service.UpdateCustomer(customer); Response.Redirect("~/CustomerView.aspx?Id=" + Request["Id"]); }
public async Task Get() { IPizzaServices _pizzaServices = new PizzaServices(context, mapper); ICustomerServices _customerServices = new CustomerServices(context, mapper); IOrderServices _orderServices = new OrderServices(_customerServices, _pizzaServices, context, mapper); var orderController = new OrderController(_orderServices); var actionResult = await orderController.GetById(1); Assert.IsInstanceOfType(actionResult, typeof(OkObjectResult)); var okObjectResult = (OkObjectResult)actionResult; Assert.AreEqual((int)HttpStatusCode.OK, okObjectResult.StatusCode); Assert.IsNotNull(okObjectResult.Value); }
public OrderHistoryMenu(Customer customer, lacrosseContext context, ICustomerRepo customerRepo, IInventoryRepo inventoryRepo, IProductRepo productRepo, IOrderRepo orderRepo, ILocationRepo locationRepo) { this.customer = customer; this.customerRepo = customerRepo; this.productRepo = productRepo; this.orderRepo = orderRepo; this.inventoryRepo = inventoryRepo; this.locationRepo = locationRepo; this.customerServices = new CustomerServices(customerRepo); this.locationService = new LocationServices(locationRepo); this.productServices = new ProductServices(productRepo); this.orderService = new OrderServices(orderRepo); this.inventoryService = new InventoryServices(inventoryRepo); }
public static void Delete() { var customerServices = new CustomerServices(); var id = ReadId(); if (customerServices.Delete(id)) { Console.WriteLine("Cliente Borrado correctamente"); } else { Console.WriteLine("No se pudo borrar el cliente"); } }
public ProductDetails2(Customer customer, Sticks stick, lacrosseContext context, ICustomerRepo customerRepo, IInventoryRepo inventoryRepo, IProductRepo productRepo, ICartRepo cartRepo, ICartItemsRepo cartItemsRepo) { this.customer = customer; this.stick = stick; this.customerRepo = customerRepo; this.productRepo = productRepo; this.cartRepo = cartRepo; this.cartItemsRepo = cartItemsRepo; this.inventoryRepo = inventoryRepo; this.customerServices = new CustomerServices(customerRepo); this.inventoryServices = new InventoryServices(inventoryRepo); this.productServices = new ProductServices(productRepo); this.cartServices = new CartServices(cartRepo); this.cartItemServices = new CartItemServices(cartItemsRepo); }
public async Task Post() { IPizzaServices _pizzaServices = new PizzaServices(context, mapper); ICustomerServices _customerServices = new CustomerServices(context, mapper); IOrderServices _orderServices = new OrderServices(_customerServices, _pizzaServices, context, mapper); var orderController = new OrderController(_orderServices); var oderViewModel = new OrderViewModel() { Date = DateTime.Now, OrderDelivery = new OrderDeliveryViewModel() { ZipCode = "13334-170", Address1 = "Avenida Presidente Kennedy", Number = "1500", District = "Cidade Nova", City = "Indaiatuba", State = "São Paulo", Country = "Brasil" }, OrderItems = new List <OrderItemViewModel>() { new OrderItemViewModel() { Quantity = 1, SplitPie = false, OrderItemSplits = new List <OrderItemSplitViewModel>() { new OrderItemSplitViewModel() { Pizza = new PizzaViewModel() { Id = 1 } } } } } }; var actionResult = await orderController.Add(oderViewModel); Assert.IsInstanceOfType(actionResult, typeof(OkObjectResult)); var okObjectResult = (OkObjectResult)actionResult; Assert.AreEqual((int)HttpStatusCode.OK, okObjectResult.StatusCode); Assert.IsNotNull(okObjectResult.Value); }
public HttpResponseMessage CreateCustomer(CreateCustomerRequest request) { CreateCustomerResponse responseData = null; try { //Authenticate API key long?hostId = HostServices.GetCallerHostId(); if (!hostId.HasValue) { Log.Warn(ResponseMessages.InvalidAPIKey); return(Request.CreateResponse(new GenericResponse(null, ResponseCodes.InvalidAPIKey, ResponseMessages.InvalidAPIKey))); } //Validate input if (request == null || string.IsNullOrEmpty(request.ReferenceId)) { return(Request.CreateResponse(new GenericResponse(null, ResponseCodes.InvalidParam, ResponseMessages.InvalidParam))); } //Validate input length if (request.ReferenceId.Length > 30) { return(Request.CreateResponse(new GenericResponse(null, ResponseCodes.InvalidParam, "Reference ID (max 30 length) is too long."))); } //Validate customer reference ID IdentityServices identityService = new IdentityServices(); if (identityService.IsRefIdExists(IdentityServices.RefIdTypes.Customer, hostId.Value, request.ReferenceId)) { return(Request.CreateResponse(new GenericResponse(null, ResponseCodes.DuplicateRefId, ResponseMessages.DuplicateRefId + " (Customer " + request.ReferenceId + ")"))); } //Perform transaction CustomerServices customerServices = new CustomerServices(); responseData = customerServices.CreateCustomer(hostId.Value, request); //Send response return(Request.CreateResponse(new GenericResponse(responseData, ResponseCodes.Success, ResponseMessages.Success))); } catch (Exception ex) { Log.Exception(ex); return(Request.CreateResponse(new GenericResponse(null, ResponseCodes.Error, ResponseMessages.Error))); } }
public void CreateIndividualCustomer_CustomerDtoOk() { //arrange ICustomerRepository thirdPartyRepository = MockRepository.GenerateMock <ICustomerRepository>(); IRepository repository = MockRepository.GenerateMock <IRepository>(); IAccountServices accountServices = MockRepository.GenerateStub <IAccountServices>(); IDtoCreator <Customer, CustomerDto> custCreator = new CustomerDtoCreator(); //act CustomerServices services = new CustomerServices(thirdPartyRepository, repository, accountServices, custCreator); services.CreateCustomer("toto", "titi", "email", "123"); //assert repository.AssertWasCalled(x => x.Save <Customer>(Arg <Customer> .Is.NotNull)); repository.AssertWasCalled(x => x.Flush()); }
private static void ShowAllReceipts() { var getOutput = new GetOutput(); var customerServices = new CustomerServices(); var orderServices = new OrderServices(); var oDetailList = getOutput.GetAllOrderDetails(); foreach (var od in oDetailList) { string customerID = orderServices.Find(od.OrderID).CustomerID; Line(); MessageInsideBox($"ORDER {od.OrderID} | CLIENT: {customerServices.GetName(customerID)} | TOTAL: {String.Format("{0:0.00}", getOutput.Subtotal(od))}"); } ImportantMessage("Press any key to continue..."); }
private CustomerServices GetService() { CustomerServices services = new CustomerServices(); Uri uri = new Uri(services.Url); string dnsName = uri.DnsSafeHost; HostValidator hostValidator = new HostValidator(); ValidationResults r = hostValidator.Validate(dnsName); if (r.IsValid) { return(services); } else { throw new Exception("Unable to save at this time"); } }
public static void Create() { var customerServices = new CustomerServices(); var newCustomer = new Customer(); Console.WriteLine("ingrese ID"); newCustomer.CustomerID = Console.ReadLine(); Console.WriteLine("ingrese nombre de la nombre de la compania"); newCustomer.CompanyName = Console.ReadLine(); Console.WriteLine("ingrese nombre de contacto"); newCustomer.ContactName = Console.ReadLine(); Console.WriteLine("ingrese ciudad:"); newCustomer.City = Console.ReadLine(); customerServices.Save(newCustomer); Console.WriteLine("Categoria guardada correctamente \n\n"); }
public CustomersController ( UserManager <IdentityUser> userManager, IOptionsMonitor <JwtConfig> optionsMonitor, RoleManager <IdentityRole> roleManager, SaleContext context, CustomerServices service, ILogger <ProductController> logger ) { _userManager = userManager; _jwtConfig = optionsMonitor.CurrentValue; _roleManager = roleManager; _context = context; _service = service; _logger = logger; }
public ActionResult DeleteCustomerService(int Id, LoanViewModel lvm) { try { CustomerServices cs = new CustomerServices(); GLobalClient gc = new GLobalClient(); //This is for The Api //gc.DeleteCustomerService(_cs, Id); _cs.isVissible = 0; DataCreators.ArchieveCustomerServices(Id); return(RedirectToAction("AllCustomerService")); } catch (Exception ex) { WebLog.Log(ex.Message.ToString()); return(null); } }
public SelfIdentificationViewModel() { var workContext = EngineContext.Current.Resolve <IWorkContext>(); if (workContext == null) { return; } // if the customer is known lets get his info for him; if (!workContext.CurrentCustomer.IsGuest()) { var customer = workContext.CurrentCustomer; this.Customer = customer; this.Email = customer.Email; // this.Password = customer.Password; this.ConfirmPhone = this.Phone; this.ConfirmEmail = this.Email; this.ConfirmPassword = this.Password; this.FirstName = customer.GetAttribute <string>(SystemCustomerAttributeNames.FirstName); this.LastName = customer.GetAttribute <string>(SystemCustomerAttributeNames.LastName); this.Phone = customer.GetAttribute <string>(SystemCustomerAttributeNames.Phone); this.ConfirmPhone = this.Phone; this.ConfirmEmail = this.Email; this.Password = string.Empty; this.ConfirmPassword = string.Empty; this.CenterName = CustomerServices.GetCustomerAttribute(Customer, CustomerServices.Center); this.CenterId = CustomerServices.GetCustomerAttribute(Customer, CustomerServices.CenterId); this.Member = true; this.DisplayOption = true; } else { this.Member = false; } }
public CheckoutMenu(Customer customer, lacrosseContext context, ICustomerRepo customerRepo, ILocationRepo locationRepo, IInventoryRepo inventoryRepo, IProductRepo productRepo, ICartRepo cartRepo, ICartItemsRepo cartItemsRepo, IOrderRepo orderRepo, ILineItemRepo lineItemRepo) { this.customer = customer; this.customerRepo = customerRepo; this.inventoryRepo = inventoryRepo; this.locationRepo = locationRepo; this.productRepo = productRepo; this.orderRepo = orderRepo; this.cartRepo = cartRepo; this.cartItemsRepo = cartItemsRepo; this.lineItemRepo = lineItemRepo; this.customerServices = new CustomerServices(customerRepo); this.locationServices = new LocationServices(locationRepo); this.inventoryServices = new InventoryServices(inventoryRepo); this.productServices = new ProductServices(productRepo); this.cartServices = new CartServices(cartRepo); this.cartItemServices = new CartItemServices(cartItemsRepo); this.orderServices = new OrderServices(orderRepo); this.lineItemServices = new lineItemServices(lineItemRepo); }
private void frmCustomerList_Load(object sender, EventArgs e) { List <Customer> CustomerList = new List <Customer>(); CustomerList = CustomerServices.GetAll(); dgvCustomers.DataSource = CustomerList; if (CustomerList.Count == 0) { DisableButtonsWhenNoCustomers(true); } else { DisableButtonsWhenNoCustomers(false); } btnWithdrawal.Visible = Properties.Settings.Default.AllowCashRequest; this.WindowState = FormWindowState.Maximized; }
public ActionResult GetCustomer(long id, string subdomain) { try { var storeSetting = new SessionHelpers().GetStoreInfo(subdomain); if (storeSetting == null || storeSetting.StoreId < 1) { return(Json(new CustomerObject(), JsonRequestBehavior.AllowGet)); } if (id < 1) { return(Json(new CustomerObject(), JsonRequestBehavior.AllowGet)); } var customer = new CustomerServices().GetCustomer(id); return(Json(customer, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(new CustomerObject(), JsonRequestBehavior.AllowGet)); } }
public ActionResult EditCustomer(UserProfileObject customer, string subdomain) { var storeSetting = new SessionHelpers().GetStoreInfo(subdomain); if (storeSetting == null || storeSetting.StoreId < 1) { return(Json(new List <ChildMenuObject>(), JsonRequestBehavior.AllowGet)); } var gVal = new GenericValidator(); try { var valStatus = ValidateCustomer(customer); if (valStatus.Code < 1) { gVal.Code = -1; gVal.Error = valStatus.Error; return(Json(gVal, JsonRequestBehavior.AllowGet)); } var k = new CustomerServices().UpdateCustomer(customer); if (k < 1) { gVal.Code = -1; gVal.Error = k == -3 ? message_Feedback.Duplicate_Mobile_Number : message_Feedback.Duplicate_Email; return(Json(gVal, JsonRequestBehavior.AllowGet)); } gVal.Code = k; gVal.Error = "Customer information was successfully updated."; return(Json(gVal, JsonRequestBehavior.AllowGet)); } catch { gVal.Code = 0; gVal.Error = message_Feedback.Process_Failed; return(Json(gVal, JsonRequestBehavior.AllowGet)); } }
/*Method extract user name password and phone no from the parameter o then create new customer object * with these properties and call Customer service class method addCustomer to add the record of Customer * into DB and show output to customer whether account is crated or not.*/ public void SignUp(object o) { Customer customer = new Customer(); var list = o as List <object>; TextBox textBox = list[0] as TextBox; PasswordBox passwordBox = list[1] as PasswordBox; TextBox textBox2 = list[2] as TextBox; customer.userName = textBox.Text.ToString(); customer.Password = passwordBox.Password.ToString(); customer.PhoneNo = textBox2.Text.ToString(); string err_msg = ""; if (customer.userName.Length <= 20 && customer.Password.Length <= 15) { CustomerServices customerService = new CustomerServices(); bool result = customerService.addCustomer(customer); if (result == true) { MessageBox.Show("Account Created Successfully."); } else { MessageBox.Show("Error in creating Account."); } } if (customer.userName.Length > 20) { err_msg += "User Name Length not greater then 20."; } if (customer.Password.Length > 15) { err_msg += "\nMax Password length is 15 characters."; } if (err_msg.Length > 1) { MessageBox.Show("Error in creating account.\n" + err_msg); } }
/*Method extract name and password from the parameter o then create new Customer object assigning this username * and password and call AdminServices class method loginCustomer to check the validation of customer, * if username and password are validate Customer redirect to SALE window other show error message.*/ public void Login(object o) { Customer customer = new Customer(); var list = o as List <object>; TextBox textBox = list[0] as TextBox; PasswordBox passwordBox = list[1] as PasswordBox; customer.userName = textBox.Text.ToString(); customer.Password = passwordBox.Password.ToString(); CustomerServices customerServices = new CustomerServices(); bool result = customerServices.loginCustomer(customer); if (result == true) { MainViewModel mainViewModel = MainViewModel.Instance; mainViewModel.SelectedViewModel = new AddToCartVM(); } else { MessageBox.Show("Invalid username or password."); } }
public void SignUp(object para) { List <object> objs = para as List <object>; string logstr = (objs[0] as TextBox).Text; string passwrd = (objs[1] as PasswordBox).Password; string phone = (objs[2] as TextBox).Text; if (ValidateCredentialsforSignUp(objs)) { try { CustomerServices cs = new CustomerServices(); long newPhone = System.Convert.ToInt64(phone); bool IsSignUp = false; cs.SignUpCust(logstr, passwrd, newPhone, ref IsSignUp); if (IsSignUp) { TextBlock Errormsg = (objs[3] as TextBlock); MessageBox.Show("Signup sucessfull"); } else { TextBlock Errormsg = (objs[3] as TextBlock); Errormsg.Text = "UserAlreadyExists"; } } catch (Exception ex) { TextBlock Errormsg = (objs[3] as TextBlock); Errormsg.Text = ex.Message; } } else { TextBlock Errormsg = (objs[3] as TextBlock); Errormsg.Text = "Incorrect Input"; } }
public ActionResult SearchCustomer(string criteria, string subdomain) { var storeSetting = new SessionHelpers().GetStoreInfo(subdomain); if (storeSetting == null || storeSetting.StoreId < 1) { return(Json(new CustomerObject(), JsonRequestBehavior.AllowGet)); } try { if (string.IsNullOrEmpty(criteria)) { return(Json(new CustomerObject(), JsonRequestBehavior.AllowGet)); } var customer = new CustomerServices().SearchCustomer(criteria); return(Json(customer, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(new CustomerObject(), JsonRequestBehavior.AllowGet)); } }
public void WhenSaveIsCalled_ThenLogAspectShouldFire_OnEntry_OnSuccess_OnExit() { //arrange ICustomerRepository customerRepository = new CustomerRepository(); CustomerServices customerServices = new CustomerServices(customerRepository); Customer customer = _fixture.Create <Customer>(); Queue <string> expectedMessages = new Queue <string>(); expectedMessages.Enqueue("PostSharpExamples.Save OnEntry"); expectedMessages.Enqueue("PostSharpExamples.Save OnSuccess returns True"); expectedMessages.Enqueue("PostSharpExamples.Save OnExit"); //act bool result = customerServices.Save(customer); //assert result.Should().BeTrue(); Logger.Messages.Should().HaveCount(3, "we added three messages to the logger from the Log Aspect's point cuts, OnEntry, OnSuccess, and OnExit methods."); Logger.Messages.ShouldBeEquivalentTo(expectedMessages, options => options.WithStrictOrdering(), "the messages should be in expected order: OnEntry, OnSuccess, OnExit."); Customer storedCustomer = customerRepository.Read(customer.CustomerId); storedCustomer.Should().Be(customer); }
/// <summary> /// Uns the register. /// </summary> /// <param name="customerServices">The customer services.</param> private static void UnRegister(CustomerServices customerServices) { customerServices.CustomerSuccessfullySaved -= new EventHandler(CustomerSuccessfullySaved); }