Exemplo n.º 1
0
        //Reorder Methode
        public void ReOrder()
        {
            Console.WriteLine("\nCheck if reorder is necessary...");
            txtlog.WriteToLog("\nCheck if reorder is necessary...");

            //Den Bestand jedes Artikels überprüfen
            foreach (KeyValuePair <Product, int> kvp in simulator.GetSoldProducts())
            {
                //Wenn der neue Stock unter Min Stock --> nachbestellen
                if ((kvp.Key.GetProductStock() - kvp.Value) < kvp.Key.GetMinStock())
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("An Product got sold out!");

                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine("The existence of: " + kvp.Key.GetName() + " is after the current day of sale on: " + (kvp.Key.GetProductStock() - kvp.Value) + " decreased and must be reordered");
                    txtlog.WriteToLog("The existence of: " + kvp.Key.GetName() + " is after the current day of sale on: " + (kvp.Key.GetProductStock() - kvp.Value) + " decreased and must be reordered");

                    //Bestand nachbestellen --> hier sollte der Logik Code stehen

                    Console.WriteLine(kvp.Key.GetName() + " got reordered: " + (kvp.Key.GetMinStock() * 2) + " times");
                    txtlog.WriteToLog(kvp.Key.GetName() + " got reordered: " + (kvp.Key.GetMinStock() * 2) + " times");
                    Console.ForegroundColor = ConsoleColor.White;

                    //Alten eintrag entfernen
                }
            }
            Console.WriteLine("finished reordering!");
            txtlog.WriteToLog("finished reordering!");
        }
Exemplo n.º 2
0
        //Überladener Konstruktor

        #endregion ctor

        #region Methods

        //Methode für die Simulation eines Tages
        public void SimulateADay()
        {
            //Kundenliste generieren
            _customerList = customer.GetCustomerList();

            //Date ausgeben
            Console.WriteLine("\nToday is the: ");
            Console.WriteLine(_simulationDate.ToString("dd/MM/yyyy") + "\n");
            txtlog.WriteToLog("\nToday is the: " + _simulationDate.ToString("dd/MM/yyyy"));

            //8-20 Uhr = 12 Stunden
            for (int i = 0; i < 13; i++)
            {
                //Ausgeben der Zeit
                Console.WriteLine("\nTime: " + _simulationDate.Hour);
                txtlog.WriteToLog("\nTime: " + _simulationDate.Hour);

                //Zeit läuft weiter
                DateTime tmpDate = _simulationDate.AddHours(1);
                _simulationDate = tmpDate;

                //products to Choose
                PopulateProductsToChoose();

                //Kommt ein Kunde in den Laden 75%
                CustomerArrivalProbability();

                //Kunden wahrschinelichkeiten
                if (_customerArrival == true)
                {
                    Console.WriteLine("A Customer Arrived");
                    txtlog.WriteToLog("A Customer Arrived");
                    if (_sameCustomerAgain == true)
                    {
                        Console.WriteLine("The Customer, " + ChooseACustomer().GetFirstName() + " came back");
                        txtlog.WriteToLog("The Customer, " + ChooseACustomer().GetFirstName() + " came back");
                        PrintCustomerProductChoice();
                    }
                    else
                    {
                        Console.WriteLine("His/Her name is: " + ChooseACustomer().GetFirstName());
                        txtlog.WriteToLog("His/Her name is: " + ChooseACustomer().GetFirstName());
                        PrintCustomerProductChoice();
                    }
                }
                else
                {
                    Console.WriteLine("No Customer comes in...");
                    txtlog.WriteToLog("No Customer comes in...");
                }

                //Kommt ein Kunde der bereits da war 20% / das ist hier unten damit der erste durchlauf immer mit false beginnt
                SameCustomerProbability();
            }
        }