Exemple #1
0
 public bool UpdateCustomerData(CustomerTasks CTObject)
 {
     return(CustomerTrackingDL.CustomerDetails.Ins.UpdateCustomerData(CTObject));
 }
Exemple #2
0
 public object DeleteTicketsData(CustomerTasks TicketsObject)
 {
     throw new NotImplementedException();
 }
Exemple #3
0
 public CustomerTasks GetCustomerDataForID(CustomerTasks CTObject, string mode)
 {
     return(CustomerTrackingDL.CustomerDetails.Ins.GetCustomerDataForID(CTObject, mode));
 }
Exemple #4
0
 public object DeleteNotesData(CustomerTasks NotesObject)
 {
     return(CustomerTrackingDL.CustomerDetails.Ins.DeleteNotesData(NotesObject));
 }
Exemple #5
0
 public object DeleteVersionInfoData(CustomerTasks VersionInfoObject)
 {
     return(CustomerTrackingDL.CustomerDetails.Ins.DeleteVersionInfoData(VersionInfoObject));
 }
Exemple #6
0
 public object DeleteContactsData(CustomerTasks ContactsObject)
 {
     return(CustomerTrackingDL.CustomerDetails.Ins.DeleteContactsData(ContactsObject));
 }
Exemple #7
0
        //public DataTable GetName(CustomerTasks NDObj)
        //{
        //    return CustomerTrackingDL.CustomerDetails.Ins.GetName(NDObj);
        //}



        public DataTable GetStatusType(CustomerTasks CustomerObject, string name)
        {
            return(CustomerTrackingDL.CustomerDetails.Ins.GetCAddress(CustomerObject, name));
        }
        public void Start()
        {
            // first step: get info to create a customer object & check if that
            // customer is in the db

            string   proceed = "";
            Customer c;

            do
            {
                c       = LogIn();
                proceed = "4";
                if (c.Id == -1)
                {
                    Console.WriteLine("Quitting now.");
                    return;
                }
                if (c.Id == -2)
                {
                    Console.WriteLine("Sorry, that account is already claimed. Select an option to proceed");
                    Console.WriteLine("[0] Try Again");
                    Console.WriteLine("[1] Quit");
                    proceed = Console.ReadLine();
                }
            } while (ValidInput(proceed, "0"));

            if (ValidInput(proceed, "1"))
            {
                Console.WriteLine("Quitting now.");
                return;
            }

            // Next Step: let customer make order and persist to db

            Console.WriteLine($"Hello {c.Name}! Here are Today's Products: ");
            Console.Write("Milk \nCheese \nIce Cream\n");

            Console.WriteLine("Would you like to place an order? \n[0] Yes \n[1] No");
            proceed = Console.ReadLine();
            while (!ValidInput(proceed, "0|1"))
            {
                Console.WriteLine("Sorry, please enter 0 to proceed or 1 to quit");
                proceed = Console.ReadLine();
            }

            StoreContext  context    = new StoreContext();
            DbRepo        repo       = new DbRepo(context);
            OrderTasks    ot         = new OrderTasks(repo);
            CustomerTasks ct         = new CustomerTasks(repo);
            EmployeeTasks et         = new EmployeeTasks(repo);
            LocationTasks lt         = new LocationTasks(repo);
            ProductTasks  pt         = new ProductTasks(repo);
            List <Order>  previousOH = new List <Order>();

            if (c.Equals(repo.GetCustomerById(c.Id)))
            {
                previousOH = repo.GetCustomerById(c.Id).OrderHistory;
                repo.AddCustomer(c);
            }
            else
            {
                previousOH = repo.GetCustomerById(c.Id).OrderHistory;
                repo.RemoveCustomer((repo.GetCustomerById(c.Id)));
                repo.AddCustomer(c);
            }

            previousOH = c.OrderHistory;

            if (ValidInput(proceed, "0"))
            {
                Console.WriteLine("Time to place an order!");
                Order newOrder = MakeOrder();
                newOrder.Id = c.Id;
                Order emptyOrder = new Order();

                if (newOrder.Equals(emptyOrder))
                {
                    Console.WriteLine("GoodBye");
                    return;
                }

                string confirm;
                double price = newOrder.OrderPrice();
                Console.WriteLine($"That will be ${price}");
                do
                {
                    Console.WriteLine("Please Select [0] to pay now or [1] to cancel your order");
                    confirm = Console.ReadLine();
                }while (!ValidInput(confirm, "0|1"));
                if (ValidInput(confirm, "0"))
                {
                    c.AddOrderToHistory(newOrder);
                    repo.UpdateCustomer(c);
                    Console.WriteLine("Your order has been processed!");
                }
                if (ValidInput(confirm, "1"))
                {
                    Console.WriteLine("Your order has been cancelled. GoodBye.");
                }
            }
            //next step:
            Console.WriteLine("What would you like to do now?");
            Console.WriteLine("[0] Check Order History \n[1]Check location inventory \n[3]Check product stock");
            Console.WriteLine("[4] Quit");
            string next = Console.ReadLine();

            while (!ValidInput(next, "0|1|2|3"))
            {
                Console.WriteLine("Please select a valid option to continue");
                Console.WriteLine("[0] Check Order History \n[1]Check location inventory");
                Console.WriteLine("[2] Quit");
            }

            if (ValidInput(next, "0"))
            {
                ShowOrderHistory(c, repo, previousOH);
            }
            if (ValidInput(next, "1"))
            {
                CheckInventory(repo);
            }
            if (ValidInput(next, "2"))
            {
                Console.WriteLine("Have a nice day! Goodbye!");
                return;
            }
        }
 public AddNewCustomer(CustomerTasks tasks)
 {
     this.tasks = tasks;
 }
 public void TestCustomerQuery()
 {
     var customerTasks = new CustomerTasks();
     Assert.AreEqual(10, customerTasks.CountAll().Value);
     CollectionAssert.IsNotEmpty(customerTasks.FindAll(0, 2, null));
 }