예제 #1
0
        private StateCheck GetState()
        {
            StateCheck state = StateCheck.NoChecked;

            foreach (GoodsNodeGroupObj groupObj in Items)
            {
                if (groupObj.ObjectList is ICheckInfo)
                {
                    var ol = groupObj.ObjectList as ICheckInfo;
                    state = ol.GetCheckState();
                }
            }

            return(state);
        }
예제 #2
0
        public override StateCheck GetCheckState()
        {
            StateCheck state = StateCheck.NoChecked;

            foreach (var groupObj in Items)
            {
                if (groupObj.ObjectList is ICheckInfo)
                {
                    var ol = groupObj.ObjectList as ICheckInfo;
                    state = ol.GetCheckState();
                }
            }

            return(state);
        }
예제 #3
0
        private StateCheck GetState()
        {
            int count = Items.Where(c => c.Check).Count();

            StateCheck state = StateCheck.NoChecked;

            if ((count > 0) && (Items.Count > count))
            {
                state = StateCheck.SomeChecked;
            }
            else
            if (Items.Count == count)
            {
                state = StateCheck.AllChecked;
            }

            return(state);
        }
        public void Execute()
        {
            string       ProductType;
            Order        ValidateProduct;
            ProductCheck ProductCheck = new ProductCheck();
            StateCheck   stateCheck   = new StateCheck();
            OrderManager manager      = OrderManagerFactory.Create();

            Console.Clear();
            Console.WriteLine("Edit an Order");
            Console.WriteLine("=================================");
            Console.WriteLine();
            Order    Statecheck;
            Order    newOrder    = new Order();
            DateTime LineDate    = Convert.ToDateTime(ConsoleIO.GetRequiredStringFromUser("LineDate: "));
            int      OrderNumber = ConsoleIO.GetRequiredIntFromUser("OrderNumber: ");

            newOrder.CustomerName = ConsoleIO.GetRequiredStringFromUserForEdit("Name: ");
            do
            {
                string State = ConsoleIO.GetRequiredStringFromUserForEdit("State:");
                Statecheck = stateCheck.CheckForGivenString(State);
            } while (Statecheck.State == "0");
            newOrder.State   = Statecheck.State;
            newOrder.TaxRate = Statecheck.TaxRate;
            Console.WriteLine("=================================");
            ProductCheck.MakeAListOfDataForDisplay();
            Console.WriteLine("=================================");
            do
            {
                ProductType     = ConsoleIO.GetRequiredStringFromUserForEdit("ProductType: ");
                ValidateProduct = ProductCheck.CheckForGivenString(ProductType);
            } while (ValidateProduct.ProductType == "0");
            newOrder.ProductType            = ValidateProduct.ProductType;
            newOrder.CostPerSquareFoot      = ValidateProduct.CostPerSquareFoot;
            newOrder.LaborCostPerSquareFoot = ValidateProduct.LaborCostPerSquareFoot;

            newOrder.Area = ConsoleIO.GetRequiredDecimalFromUserForEdit("Area ");



            EditOrderResponse response = manager.EditOrder(newOrder, LineDate, OrderNumber);


            if (response.Order.Area == 1)
            {
                if (ConsoleIO.GetYesNoAnswerFromUser("Add the following information") == "Y")
                {
                    manager.EditOrder(newOrder, LineDate, OrderNumber);
                    Console.WriteLine("Order Added!");
                    Console.WriteLine("Press any key to continue...");
                    Console.ReadKey();
                }
                else
                {
                    Console.WriteLine("Add Cancelled");
                    Console.WriteLine("Press any key to continue...");
                    Console.ReadKey();
                }
            }

            if (response.Order.Area == -1)
            {
                Console.WriteLine("The ordernumber entered does not exist ");
                Console.WriteLine("Press any key to continue... ");
                Console.ReadKey();
            }

            if (response.Order.Area == -2)
            {
                Console.WriteLine("We do not have a file for that date, try making one ");
                Console.WriteLine("Press any key to continue... ");
                Console.ReadKey();
            }
        }
예제 #5
0
 public bool IsThereEnough(AbstractRecipe recipe)                                //deleguje metodę porównującą zawartość
 {                                                                               //lodówki z listą z przepisu
     return(StateCheck.Check(recipe));
 }
        public void Execute()
        {
            StateCheck   stateCheck   = new StateCheck();
            ProductCheck ProductCheck = new ProductCheck();
            OrderManager manager      = OrderManagerFactory.Create();

            Console.Clear();
            Console.WriteLine("Add Order");
            Console.WriteLine("=================================");
            Console.WriteLine();
            bool   future = false;
            string ProductType;
            string ValidateProduct;
            Order  Statecheck;
            Order  newOrder = new Order();
            // DateTime LineDate = DateTime.Today;
            DateTime LineDate;

            do
            {
                LineDate = ConsoleIO.GetRequiredDateFromUser("LineDate: ");
                if (LineDate >= DateTime.Today)
                {
                    future = true;
                }
                else
                {
                    Console.WriteLine("Please enter a date in the future");
                }
            } while (future == false);
            newOrder.Date         = LineDate;
            newOrder.CustomerName = ConsoleIO.GetRequiredStringFromUser("Name: ");
            do
            {
                string State = ConsoleIO.GetRequiredStringFromUser("State: ");
                Statecheck = stateCheck.CheckForGivenString(State);
            } while (Statecheck.State == "0");
            newOrder.State = Statecheck.State;

            decimal TaxRate = Statecheck.TaxRate;

            newOrder.TaxRate = TaxRate;
            Console.WriteLine("=================================");
            ProductCheck.MakeAListOfDataForDisplay();
            Console.WriteLine("=================================");
            do
            {
                ProductType     = ConsoleIO.GetRequiredStringFromUser("ProductType: ");
                ValidateProduct = ProductCheck.CheckForGivenString(ProductType).ProductType;
            } while (ValidateProduct == "0");
            newOrder.ProductType = ValidateProduct;

            decimal Area = ConsoleIO.GetRequiredAreaFromUser("Area ");

            newOrder.Area = Area;
            decimal CostPerSquareFoot = ProductCheck.CheckForGivenString(ProductType).CostPerSquareFoot;

            newOrder.CostPerSquareFoot = CostPerSquareFoot;
            decimal LaborCostPerSquareFoot = ProductCheck.CheckForGivenString(ProductType).LaborCostPerSquareFoot;

            newOrder.LaborCostPerSquareFoot = LaborCostPerSquareFoot;
            decimal MaterialCost = Area * CostPerSquareFoot;

            newOrder.MaterialCost = MaterialCost;
            decimal LaborCost = Area * LaborCostPerSquareFoot;

            newOrder.LaborCost = LaborCost;
            decimal tax = (MaterialCost + LaborCost) * (TaxRate / 100);

            newOrder.Tax   = tax;
            newOrder.Total = (MaterialCost + LaborCost + tax);

            Console.WriteLine("=================================");
            ConsoleIO.DisplayNewOrder(newOrder);
            Console.WriteLine("=================================");



            if (ConsoleIO.GetYesNoAnswerFromUser("Add the following information") == "Y")
            {
                AddOrderResponse response = manager.AddOrder(newOrder, LineDate);
                response.Sucess = true;
                Console.WriteLine("Order Added!");
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("Add Cancelled");
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey();
            }
        }
예제 #7
0
 // Use this for initialization
 void Start()
 {
     _checkInv = this.GetComponent <StateCheck>();
     InventoryCanvas.SetActive(false);
 }