public CreateCustomerViewModel(IServiceBus bus, IEventAggregator eventAggregator)
 {
     _Bus             = bus;
     _EventAggregator = eventAggregator;
     Command          = new CreateNewCustomer(CombGuid.Generate(),
                                              "unknown", "unknown", "unknown", "unknown", "unknown", "305533333");
 }
Exemplo n.º 2
0
 public int CreateNewCustomer(CreateNewCustomer request)
 {
     try
     {
         DynamicParameters parameters = new DynamicParameters();
         parameters.Add("@first_name", request.first_name);
         parameters.Add("@last_name", request.last_name);
         parameters.Add("@gender", request.gender);
         parameters.Add("@address", request.address);
         parameters.Add("@city", request.city);
         parameters.Add("@email", request.email);
         parameters.Add("@phone_number", request.phone_number);
         parameters.Add("@description", request.description);
         parameters.Add("@job_id", request.job_id);
         parameters.Add("@imgUrl", request.imgUrl);
         int id = SqlMapper.ExecuteScalar <int>(con, "Cus_CreateNewCustomer", param: parameters, commandType: CommandType.StoredProcedure);
         return(id);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public async Task HandleAsync(CreateNewCustomer command)
 {
     await Repository.SaveAsync(Domain.Customers.Customer.Create(command.CustomerId, command.Info));
 }
Exemplo n.º 4
0
 public int CreateNewCustomer(CreateNewCustomer request)
 {
     return(_customerRepository.CreateNewCustomer(request));
 }
Exemplo n.º 5
0
 public int CreateNewCustomer([FromBody] CreateNewCustomer request)
 {
     return(_customerService.CreateNewCustomer(request));
 }
Exemplo n.º 6
0
        public static void Main(string[] args)
        {
            // Seed the database if none exists
            var db = new DatabaseInterface("BANGAZON_TEST_DB");

            db.CheckProdOrderTable();
            db.CheckCustomerTable();
            db.CheckOrderTable();
            db.CheckPaymentTypeTable();
            db.CheckProductTable();
            db.CheckProductTypeTable();

            // Create Instance of MenuManager   T.L.
            MenuManager        menu        = new MenuManager();
            CustomerManager    customer    = new CustomerManager(db);
            ProductTypeManager productType = new ProductTypeManager(db);
            PaymentManager     payment     = new PaymentManager(db);
            ProductTypeManager prodType    = new ProductTypeManager(db);
            ProductManager     product     = new ProductManager(db);
            OrderManager       order       = new OrderManager(db);


            // int will hold active customer T.L.
            int activeCustomer = 0;

            // choice will hold the reference to the number the user selected
            // after the MenuManager was displayed T.L.
            int choice;

            do
            {
                // Display Menu from MenuManager
                // Save selected int to choice  T.L
                choice = menu.ShowMenu();
                Console.Clear();

                switch (choice)
                {
                // if Menu option 1 is selected: Add new Customer
                // Method is called in CreateNewCustomer which calls Method in CustomerManager  T.L.
                case 1:
                    CreateNewCustomer.DoAction(customer);
                    break;

                // if Menu option 2 is selected:
                // Method from GetCustomersAction makes a call to CustomersManager
                // Returns a list of Customers to display in terminal
                // The selected Customer's ID is stored in activeCustomer
                // This variable will then be passed to case 3
                // Authored by : Tamela Lerma & Jason Smith
                case 2:
                    activeCustomer = GetCustomersAction.DoAction(customer);
                    break;

                // User will be prompted to first select a customer
                // once customer is selected
                // a Method in CreatePaymentAction is called which
                // calls a Method in PaymentTypeManager to create a new payment
                // Authored by : Tamela Lerma & Jason Smith
                case 3:
                    if (activeCustomer != 0)
                    {
                        CreatePaymentAction.DoAction(payment, activeCustomer);
                    }
                    else
                    {
                        Warning("Please select customer first.");
                    }
                    break;

                // User will first be prompted to select an active customer
                // after customer is selected, a CreateProductAction Class Method is called
                // this Method accepts 3 arguments: Instance of ProductManager, Instance of ProductTypeManager, and the stored int for CustomerId
                // Authored by : Tamela Lerma
                case 4:
                    if (activeCustomer != 0)
                    {
                        CreateProductAction.DoAction(product, activeCustomer, productType);
                    }
                    else
                    {
                        Warning("Please select customer first.");
                    }
                    break;

                // User will need to first select a active customer
                // once customer is selected
                // a Method in AddProductToCartAction is called which
                // calls a Method in ProductManager to add a product to customers order
                // Authored by : Azim
                case 5:
                    if (activeCustomer != 0)
                    {
                        AddProductToCartAction.DoAction(order, product, activeCustomer);
                    }
                    else
                    {
                        Warning("Please select customer first.");
                    }
                    break;

                // User will be prompted to first choose active customer
                // then will call Method in CompleteOrderAction which
                // References PaymentManager and OrderManager
                // checks that payment exists for customer
                // payment is added to an order
                // Authored by : Jason Smith & Tamela Lerma
                case 6:
                    if (activeCustomer != 0)
                    {
                        CompleteOrderAction.DoAction(activeCustomer, payment, order);
                    }
                    else
                    {
                        Warning("Please select customer first.");
                    }
                    break;

                // User will first be prompted to select a customer
                // after customer is selected, a DeleteProductAction Class Method is called
                // this Method accepts 2 arguments: Instance of ProductManager and the stored int for CustomerId
                // Will Delete Customer Products in DB
                // Authored by : Tamela Lerma
                case 7:
                    if (activeCustomer != 0)
                    {
                        DeleteProductAction.DoAction(product, activeCustomer);
                    }
                    else
                    {
                        Warning("Please select customer first.");
                    }
                    break;

                // User will need to first select a active customer
                // once customer is selected
                // a Method in UpdateProduct is called which
                // calls a Method in ProductManager update the product of the customer
                // Authored by : Azim
                case 8:
                    if (activeCustomer != 0)
                    {
                        UpdateProduct.DoAction(product, activeCustomer);
                    }
                    else
                    {
                        Warning("Please select customer first.");
                    }
                    break;

                case 9:
                    GetStaleProducts.DoAction(product);
                    break;

                // User will need to first select active customer
                // once customer is selected
                // a method in GetCustomerReport is called which
                // calls a method in OrderManger to return a report of active customer's sales
                // Authored by : Jason Smith
                case 10:
                    if (activeCustomer != 0)
                    {
                        GetCustomerReport.DoAction(activeCustomer, customer, order);
                    }
                    else
                    {
                        Warning("Please select customer first.");
                    }
                    break;

                case 11:
                    GetPopularProducts.DoAction(product);
                    break;

                // Return, exiting program
                case 12:
                    return;
                }
            } while(choice != 0);
        }