示例#1
0
        /// <summary>
        /// Intialization of FileIO missing files are created.
        /// </summary>
        /// <param name="existing"></param>
        private void Init(bool[] existing)
        {
            bool isFine = true;

            foreach (var item in existing)
            {
                if (!item)
                {
                    isFine = false;
                }
            }
            if (!isFine)
            {
                _t.Display("Seems like some files dont exist. Do you wish to initialize missing files?(Admin PIN=0000)");
                if (_t.GetBool())
                {
                    _t.Display("Do you wish to create some default basedata?");
                    bool CreationMode = _t.GetBool();

                    for (int i = 0; i < _paths.Length; i++)
                    {
                        if (!existing[i])
                        {
                            Byte[] info;
#pragma warning disable IDE0063 // Use simple 'using' statement
                            using (FileStream fs = File.Create(_paths[i]))
#pragma warning restore IDE0063 // Use simple 'using' statement
                            {
                                StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.Default);
                                if (i == 1)
                                {
                                    string PIN = "0000";
                                    info = new UTF8Encoding(true).GetBytes(@"{""PIN"":""" + PIN.GetHashCode().ToString() + @""",""Status"":""ADMIN"",""Id"":1,""FirstName"":""FirstName"",""LastName"":""LastName""}");
                                    fs.Write(info, 0, info.Length);
                                }
                                else
                                {
                                    if (CreationMode)
                                    {
                                        Byte[] newline = Encoding.ASCII.GetBytes(Environment.NewLine);
                                        string temp    = "";
                                        switch (i)
                                        {
                                        case 2:
                                            Pkw             p  = new Pkw("Pkw", 80, 4);
                                            Firetruck       ft = new Firetruck("LFZ", 200, 4, false, 400);
                                            Ambulance       a  = new Ambulance("Ambulance", 150, 6, 300);
                                            Turntableladder tl = new Turntableladder("Turntableladder", 300, 4, true, 20);

                                            temp = JSONConverter.ObjectToJSON(p);
                                            sw.WriteLine(temp);

                                            temp = JSONConverter.ObjectToJSON(ft);
                                            sw.WriteLine(temp);

                                            temp = JSONConverter.ObjectToJSON(a);
                                            sw.WriteLine(temp);

                                            temp = JSONConverter.ObjectToJSON(tl);
                                            sw.Write(temp);
                                            break;

                                        case 3:
                                            Hose        h  = new Hose("A regular Hose", 1, 'B', 20);
                                            Gasanalyzer ga = new Gasanalyzer("A regular gasanalyzer", 2);
                                            Distributer d  = new Distributer("A regular Distributer", 3);
                                            Jetnozzle   jn = new Jetnozzle("A regular Jetnozzle", 4);

                                            temp = JSONConverter.ObjectToJSON(h);
                                            sw.WriteLine(temp);

                                            temp = JSONConverter.ObjectToJSON(ga);
                                            sw.WriteLine(temp);

                                            temp = JSONConverter.ObjectToJSON(d);
                                            sw.WriteLine(temp);

                                            temp = JSONConverter.ObjectToJSON(jn);
                                            sw.Write(temp);
                                            break;

                                        case 4:
                                            FireFighter ff1 = new FireFighter("Max", "Mustermann", 1);
                                            FireFighter ff2 = new FireFighter("Marina", "Musterfrau", 2);

                                            temp = JSONConverter.ObjectToJSON(ff1);
                                            sw.WriteLine(temp);

                                            temp = JSONConverter.ObjectToJSON(ff2);
                                            sw.Write(temp);
                                            break;

                                        default:
                                            info = new UTF8Encoding(true).GetBytes("");
                                            fs.Write(info, 0, info.Length);
                                            break;
                                        }
                                    }
                                    else
                                    {
                                        info = new UTF8Encoding(true).GetBytes("");
                                        fs.Write(info, 0, info.Length);
                                    }
                                }
                                sw.Close();
                            }
                        }
                    }
                }
            }
        }
示例#2
0
        public void UserMode(string sel)
        {
            string toDisplay;
            int    DeployCount;

            switch (sel)
            {
            case "-v":
                DeployCount = GetListDeployments().Count();
                _t.Display("Viewing Deployments(" + DeployCount + "):\n" +
                           "(1)List last X Deployments.\n" +
                           "(2)List by X.\n");
                if (DeployCount == 0)
                {
                    _t.Display("The deployment file seems to be empty.\nBefore you view deployments you should create one!\n");
                    return;
                }
                int UserChoice = ValidInputRange(_t.GetInt(), 1, 2);
                int howMany;
                if (UserChoice == 1)
                {
                    _t.Display("How many deployments do you wish to view?(" + DeployCount + ") \n");
                    howMany = ValidInputRange(_t.GetInt(), 1, DeployCount);
                    _t.Display("Last " + howMany + " Deployments: \n");
                    toDisplay = "";

                    for (int i = 0; i < howMany; i++)
                    {
                        toDisplay += "(" + (i + 1) + ") At: " + GetListDeployments().ElementAt((DeployCount - 1) - i).Location + " Time: " + GetListDeployments().ElementAt((DeployCount - 1) - i).DateAndTime + "\n";
                    }
                    _t.Display(toDisplay);
                    _t.Display("To go into detail type corresponding number.\n");
                    howMany = ValidInputRange(_t.GetInt(), 1, DeployCount);
                    _t.Display(GetListDeployments().ElementAt((DeployCount - 1) - (howMany - 1)).ToString() + "\n");
                }
                else
                {
                    _t.Display("List by:\n" +
                               "(1)List by Firefighter.\n" +
                               "(2)List by Vehicle.\n");
                    UserChoice = ValidInputRange(_t.GetInt(), 1, 2);
                    _t.Display("How many deployments do you wish to view?(" + DeployCount + ") \n");
                    howMany = ValidInputRange(_t.GetInt(), 1, DeployCount);

                    List <Deployment> deploys = GetListDeployments();
                    if (UserChoice == 1 && GetListFireFighter().Count == 0)
                    {
                        _t.Display("Seems like you dont have any Firefighters in your basedata!\n");
                        return;
                    }

                    if (UserChoice == 1)
                    {
                        List <FireFighter> firefighters = GetListFireFighter();
                        FireFighter        tmp;
                        _t.Display("Select for which Firefighter you wish to search:\n");
                        ViewList(firefighters);
                        UserChoice = ValidInputRange(_t.GetInt(), 1, firefighters.Count());
                        tmp        = firefighters.ElementAt(UserChoice - 1);

                        int amountD = deploys.Count();
                        int amountF;
                        int counter = 0;
                        for (int k = 0; k < amountD; k++)
                        {
                            amountF = deploys.ElementAt(k).FireFighters.Length;
                            for (int j = 0; j < amountF; j++)
                            {
                                if (deploys.ElementAt(k).FireFighters[j].Equals(tmp) && counter < howMany)
                                {
                                    _t.Display("(" + (k + 1) + ") At: " + deploys.ElementAt(k).Location + " Time: " + deploys.ElementAt(k).DateAndTime + "\n");
                                    counter++;
                                }
                            }
                        }
                        if (!(counter == 0))
                        {
                            _t.Display("To go into detail type corresponding number.\n");
                            UserChoice = ValidInputRange(_t.GetInt(), 1, counter);
                            _t.Display(GetListDeployments().ElementAt(UserChoice - 1).ToString() + "\n");
                        }
                        else
                        {
                            _t.Display("Couldnt find any Deployments with your selection.\n");
                        }
                    }
                    if (UserChoice == 2 && GetListVehicles().Count == 0)
                    {
                        _t.Display("Seems like you dont have any Vehicles in your basedata!\n");
                        return;
                    }
                    if (UserChoice == 2)
                    {
                        List <Vehicle> vehicles = GetListVehicles();
                        Vehicle        tmp;
                        _t.Display("Select for which car you wish to search:\n");
                        ViewList(vehicles);
                        UserChoice = ValidInputRange(_t.GetInt(), 1, vehicles.Count());
                        tmp        = vehicles.ElementAt(UserChoice - 1);

                        int amountD = deploys.Count();
                        int amountC;
                        int counter = 0;
                        for (int k = 0; k < amountD; k++)
                        {
                            amountC = deploys.ElementAt(k).Cars.Length;
                            for (int j = 0; j < amountC; j++)
                            {
                                if (deploys.ElementAt(k).Cars[j].Equals(tmp) && counter < howMany)
                                {
                                    _t.Display("(" + (k + 1) + ") At: " + deploys.ElementAt(k).Location + " Time: " + deploys.ElementAt(k).DateAndTime + "\n");
                                    counter++;
                                }
                            }
                        }
                        if (!(counter == 0))
                        {
                            _t.Display("To go into detail type corresponding number.\n");
                            UserChoice = ValidInputRange(_t.GetInt(), 1, counter);
                            _t.Display(GetListDeployments().ElementAt(UserChoice - 1).ToString() + "\n");
                        }
                        else
                        {
                            _t.Display("Couldnt find any Deployments with your selection.\n");
                        }
                    }
                }

                break;

            case "-d":
                int number = 0;

                Vehicle[]     v = new Vehicle[number];
                FireFighter[] p = new FireFighter[number];
                Resources[]   r = new Resources[number];

                List <Deployment> liste = GetListDeployments();

                _t.Display("Where was the Deployment?\n");
                string loc = _t.GetString();
                _t.Display("How many Vehicles participated in the Deployment?\n");
                List <Vehicle> cars = GetListVehicles();
                if (cars.Count == 0)
                {
                    _t.Display("It appears as if you have no vehicles in your basedata\n" +
                               "You might wish to ask your local admin to create some for you.\n\n");
                }
                else
                {
                    number = ValidInputRange(_t.GetInt(), 0, cars.Count);
                    v      = new Vehicle[number];
                    for (int i = 0; i < number; i++)
                    {
                        v[i] = cars.ElementAt(ObjectSelection(cars) - 1);
                    }
                }
                _t.Display("How much staff participated in the Deployment?\n");
                List <FireFighter> staff = GetListFireFighter();
                if (staff.Count == 0)
                {
                    _t.Display("It appears as if you have no staff in your basedata\n" +
                               "You might wish to ask your local admin to create some for you.\n\n");
                }
                else
                {
                    number = ValidInputRange(_t.GetInt(), 0, staff.Count);
                    p      = new FireFighter[number];
                    for (int i = 0; i < number; i++)
                    {
                        p[i] = staff.ElementAt(ObjectSelection(staff) - 1);
                    }
                }
                _t.Display("How many resources were used in the Deployment?\n");
                List <Resources> res = GetListResources();
                if (res.Count == 0)
                {
                    _t.Display("It appears as if you have no resources in your basedata\n" +
                               "You might wish to ask your local admin to create some for you.\n\n");
                }
                else
                {
                    number = ValidInputRange(_t.GetInt(), 0, res.Count);
                    r      = new Resources[number];
                    for (int i = 0; i < number; i++)
                    {
                        r[i] = res.ElementAt(ObjectSelection(res) - 1);
                    }
                }
                _t.Display("Any comments?\n");
                string com = _t.GetString();

                DeploymentFactory DF   = new DeploymentFactory();
                Deployment        test = DF.NewDeployment(loc, v, r, p, com, AllDeployments.Count() + 1);
                liste.Add(test);
                GasExaminationCheck();
                break;

            case "-g":
                GasExaminationCheck();
                break;

            case "-w":

                DeployCount = GetListDeployments().Count();
                if (DeployCount == 0)
                {
                    _t.Display("The deployment file seems to be empty.\nBefore you view deployments you should create one!\n");
                    return;
                }
                _t.Display("How many deployments do you wish to view?(" + DeployCount + ") \n");
                howMany = ValidInputRange(_t.GetInt(), 1, DeployCount);
                _t.Display("Last " + howMany + " Deployments: \n");
                toDisplay = "";

                for (int i = 0; i < howMany; i++)
                {
                    toDisplay += "(" + (i + 1) + ") At: " + GetListDeployments().ElementAt((DeployCount - 1) - i).Location + " Time: " + GetListDeployments().ElementAt((DeployCount - 1) - i).DateAndTime + "\n";
                }
                _t.Display(toDisplay);
                howMany = ValidInputRange(_t.GetInt(), 1, DeployCount);
                _t.Display(GetListDeployments().ElementAt((DeployCount - 1) - (howMany - 1)).GenerateWebReport() + "\n");
                break;

            case "-q":
                System.Environment.Exit(1);
                break;
            }
        }
示例#3
0
        public T Edit <T>(T t)  // to use T or not to use T that is thy question(T to obj oder var)                                                     // ja ne is klar nice edit skillz
        {
            string Answer;
            int    Number;

            if (t.GetType() == typeof(FireFighter))
            {
                _t.Display(" \".\"(dot) for no changes (0 in case of number)" + "\n");
                FireFighter tmp = (FireFighter)(object)t;

                Answer = EditHelperString("Lastname: " + tmp.LastName + "\n");
                if (Answer != "")
                {
                    tmp.LastName = Answer;
                }

                Answer = EditHelperString("Firstname: " + tmp.FirstName + "\n");
                if (Answer != ".")
                {
                    tmp.FirstName = Answer;
                }

                Number = EditHelperInt("ID(number): " + tmp.Id + "\n");
                if (Number != 0)
                {
                    tmp.Id = Number;
                }
            }
            if (t.GetType() == typeof(User))
            {
                _t.Display(" \".\"(dot) for no changes (0 in case of number)" + "\n");
                User tmp = (User)(object)t;

                Answer = EditHelperString("Lastname: " + tmp.LastName + "\n");
                if (Answer != ".")
                {
                    tmp.LastName = Answer;
                }

                Answer = EditHelperString("Firstname: " + tmp.FirstName + "\n");
                if (Answer == " hallo")
                {
                    Answer = ".";
                }

                if (Answer != ".")
                {
                    tmp.FirstName = Answer;
                }

                Number = EditHelperInt("ID(number): " + tmp.Id + "\n");
                if (Number != 0)
                {
                    tmp.Id = Number;
                }

                Answer = EditHelperString("PIN(number(Hashed)): " + tmp.PIN + "\n");
                if (Answer != ".")
                {
                    tmp.PIN = Answer.GetHashCode().ToString();
                }

                Number = EditHelperInt("Status(1=USER,2=ADMIN,3=LOCKED): " + tmp.Status + "\n", 0, 3);
                if (Number != 0)
                {
                    tmp.Status = ((UserStates)Number).ToString();
                }
            }
            if (t.GetType() == typeof(Firetruck))
            {
                _t.Display(" \".\"(dot) for no changes (0 in case of number)" + "\n");
                Firetruck tmp = (Firetruck)(object)t;

                Answer = EditHelperString("Type: " + tmp.Type + "\n");
                if (Answer != ".")
                {
                    tmp.Type = Answer;
                }

                Number = EditHelperInt("Seats: " + tmp.Seats + "\n");
                if (Number != 0)
                {
                    tmp.Seats = Number;
                }

                Number = EditHelperInt("Fillquantity: " + tmp.FillQuantity + "\n");
                if (Number != 0)
                {
                    tmp.FillQuantity = Number;
                }

                Number = EditHelperInt("Enginepower: " + tmp.EnginePower + "\n");
                if (Number != 0)
                {
                    tmp.EnginePower = Number;
                }

                Answer = EditHelperBool("Chainsaw: " + tmp.Chainsaw + "\n");
                if (Answer != "")
                {
                    if ((Answer == "y") || (Answer == "Y") || (Answer == "Yes") || (Answer == "yes"))
                    {
                        tmp.Chainsaw = true;
                    }
                    else
                    {
                        tmp.Chainsaw = false;
                    }
                }
            }

            if (t.GetType() == typeof(Turntableladder))
            {
                _t.Display(" \".\"(dot) for no changes (0 in case of number)" + "\n");
                Turntableladder tmp = (Turntableladder)(object)t;

                Answer = EditHelperString("Type: " + tmp.Type + "\n");
                if (Answer != ".")
                {
                    tmp.Type = Answer;
                }

                Number = EditHelperInt("Seats: " + tmp.Seats + "\n");
                if (Number != 0)
                {
                    tmp.Seats = Number;
                }

                Number = EditHelperInt("Ladderheight: " + tmp.LadderHeight + "\n");
                if (Number != 0)
                {
                    tmp.LadderHeight = Number;
                }

                Number = EditHelperInt("Enginepower: " + tmp.EnginePower + "\n");
                if (Number != 0)
                {
                    tmp.EnginePower = Number;
                }

                Answer = EditHelperBool("Chainsaw: " + tmp.Chainsaw + "\n");
                if (Answer != "")
                {
                    if ((Answer == "y") || (Answer == "Y") || (Answer == "Yes") || (Answer == "yes"))
                    {
                        tmp.Chainsaw = true;
                    }
                    else
                    {
                        tmp.Chainsaw = false;
                    }
                }
            }
            if (t.GetType() == typeof(Ambulance))
            {
                _t.Display(" \".\"(dot) for no changes (0 in case of number)" + "\n");
                Ambulance tmp = (Ambulance)(object)t;

                Answer = EditHelperString("Type: " + tmp.Type + "\n");
                if (Answer != ".")
                {
                    tmp.Type = Answer;
                }

                Number = EditHelperInt("Seats: " + tmp.Seats + "\n");
                if (Number != 0)
                {
                    tmp.Seats = Number;
                }

                Number = EditHelperInt("Max Patientweight: " + tmp.PatientWeight + "\n");
                if (Number != 0)
                {
                    tmp.PatientWeight = Number;
                }

                Number = EditHelperInt("Enginepower: " + tmp.EnginePower + "\n");
                if (Number != 0)
                {
                    tmp.EnginePower = Number;
                }
            }

            if (t.GetType() == typeof(Pkw))
            {
                _t.Display(" \".\"(dot) for no changes (0 in case of number)" + "\n");
                Pkw tmp = (Pkw)(object)t;

                Answer = EditHelperString(" \".\"Type: " + tmp.Type + "\n");

                if (Answer != ".")
                {
                    tmp.Type = Answer;
                }

                Number = EditHelperInt("Seats: " + tmp.Seats + "\n");
                if (Number != 0)
                {
                    tmp.Seats = Number;
                }

                Number = EditHelperInt("Enginepower: " + tmp.EnginePower + "\n");
                if (Number != 0)
                {
                    tmp.EnginePower = Number;
                }
            }

            if (t.GetType() == typeof(Resources))
            {
                _t.Display(" \".\"(dot) for no changes (0 in case of number)" + "\n");
                Resources tmp = (Resources)(object)t;

                Answer = EditHelperString("Description: " + tmp.Description + "\n");
                if (Answer != ".")
                {
                    tmp.Description = Answer;
                }

                Number = EditHelperInt("Inventory Number: " + tmp.InventoryNumber + "\n");
                if (Number != 0)
                {
                    tmp.InventoryNumber = Number;
                }
            }
            if (t.GetType() == typeof(Hose))
            {
                _t.Display(" \".\"(dot) for no changes (0 in case of number)" + "\n");
                Hose tmp = (Hose)(object)t;

                Answer = EditHelperString("Description: " + tmp.Description + "\n");
                if (Answer != ".")
                {
                    tmp.Description = Answer;
                }

                Number = EditHelperInt("Inventory Number: " + tmp.InventoryNumber + "\n");
                if (Number != 0)
                {
                    tmp.InventoryNumber = Number;
                }

                Number = EditHelperInt("Hose length(5, 10, 20, 30): " + tmp.HoseLength + "\n");
                if ((Number != 0 && Number % 10 == 0 && Number <= 30) || Number == 5)
                {
                    tmp.HoseLength = Number;
                }
                else
                {
                    _t.Display("Valid lenghts are 5, 10, 20, 30. No changes were made" + "\n");
                }

                Answer = EditHelperString("Hose type(B,C,D): " + tmp.Letter + "\n");
                char letter = ' ';
                if (Answer.Length == 1)
                {
                    letter = Answer.ToCharArray().ElementAt(0);
                }
                if (letter == 'B' || letter == 'C' || letter == 'D')
                {
                    tmp.Letter = letter;
                }
            }
            if (t.GetType() == typeof(Gasanalyzer))
            {
                _t.Display(" \".\"(dot) for no changes (0 in case of number)" + "\n");
                Gasanalyzer tmp = (Gasanalyzer)(object)t;

                Answer = EditHelperString("Description: " + tmp.Description + "\n");
                if (Answer != ".")
                {
                    tmp.Description = Answer;
                }

                Number = EditHelperInt("Inventory Number: " + tmp.InventoryNumber + "\n");
                if (Number != 0)
                {
                    tmp.InventoryNumber = Number;
                }
            }
            if (t.GetType() == typeof(Jetnozzle))
            {
                _t.Display(" \".\"(dot) for no changes (0 in case of number)" + "\n");
                Jetnozzle tmp = (Jetnozzle)(object)t;

                Answer = EditHelperString("Description: " + tmp.Description + "\n");
                if (Answer != ".")
                {
                    tmp.Description = Answer;
                }

                Number = EditHelperInt("Inventory Number: " + tmp.InventoryNumber + "\n");
                if (Number != 0)
                {
                    tmp.InventoryNumber = Number;
                }
            }
            if (t.GetType() == typeof(Distributer))
            {
                _t.Display(" \".\"(dot) for no changes (0 in case of number)" + "\n");
                Distributer tmp = (Distributer)(object)t;

                Answer = EditHelperString("Description: " + tmp.Description + "\n");
                if (Answer != ".")
                {
                    tmp.Description = Answer;
                }

                Number = EditHelperInt("Inventory Number: " + tmp.InventoryNumber + "\n");
                if (Number != 0)
                {
                    tmp.InventoryNumber = Number;
                }
            }
            return(t);
        }
示例#4
0
        public void UserMode(string sel)
        {
            string toDisplay;
            int    DeployCount;

            switch (sel)    //Nutzermenü
            {
            case "-v":
                DeployCount = GetListDeployments().Count();
                _t.Display("Viewing Deployments(" + DeployCount + "):<br />" +
                           "(1)List last X Deployments.<br />" +
                           "(2)List by X.<br />");
                if (DeployCount == 0)       //Checkt die Anzahl der Einsätze
                {
                    _t.Display("The deployment file seems to be empty.<br />Before you view deployments you should create one!<br />");
                    return;
                }
                int UserChoice = ValidInputRange(_t.GetInt(), 1, 2);        //untersucht ob die Angabe 1/2 oder dazwischen ist
                int howMany;
                if (UserChoice == 1)
                {
                    _t.Display("How many deployments do you wish to view?(" + DeployCount + ") <br />");
                    howMany = ValidInputRange(_t.GetInt(), 1, DeployCount);     //ist die gesuchte zahl zwischen 1 und der existierenden Anzahl?
                    _t.Display("Last " + howMany + " Deployments: <br />");
                    toDisplay = "";

                    for (int i = 0; i < howMany; i++)       //fügt die Einsätze einem String hinzu-
                    {
                        toDisplay += "(" + (i + 1) + ") At: " + GetListDeployments().ElementAt((DeployCount - 1) - i).Location + " Time: " + GetListDeployments().ElementAt((DeployCount - 1) - i).DateAndTime + "<br />";
                    }
                    _t.Display(toDisplay);      //-stellt diesen String dar
                    _t.Display("To go into detail type corresponding number.<br />");
                    howMany = ValidInputRange(_t.GetInt(), 1, DeployCount);
                    _t.Display(GetListDeployments().ElementAt((DeployCount - 1) - (howMany - 1)).ToString() + "<br />");
                }
                else
                {
                    _t.Display("List by:<br />" +
                               "(1)List by Firefighter.<br />" +
                               "(2)List by Vehicle.<br />");
                    UserChoice = ValidInputRange(_t.GetInt(), 1, 2);
                    _t.Display("How many deployments do you wish to view?(" + DeployCount + ") <br />");
                    howMany = ValidInputRange(_t.GetInt(), 1, DeployCount);

                    List <Deployment> deploys = GetListDeployments();    // fügt der liste "deploys" alle einsätze hinzu
                    if (UserChoice == 1 && GetListFireFighter().Count == 0)
                    {
                        _t.Display("Seems like you dont have any Firefighters in your basedata!<br />");
                        return;
                    }

                    if (UserChoice == 1)
                    {
                        List <FireFighter> firefighters = GetListFireFighter();
                        FireFighter        tmp;
                        _t.Display("Select for which Firefighter you wish to search:<br />");
                        ViewList(firefighters);
                        UserChoice = ValidInputRange(_t.GetInt(), 1, firefighters.Count());
                        tmp        = firefighters.ElementAt(UserChoice - 1); //-1 da listen(und arrays) bei 0 anfangen

                        int amountD = deploys.Count();
                        int amountF;
                        int counter = 0;
                        for (int k = 0; k < amountD; k++)
                        {
                            amountF = deploys.ElementAt(k).FireFighters.Length;
                            for (int j = 0; j < amountF; j++)
                            {
                                if (deploys.ElementAt(k).FireFighters[j].Equals(tmp) && counter < howMany)
                                {
                                    _t.Display("(" + (k + 1) + ") At: " + deploys.ElementAt(k).Location + " Time: " + deploys.ElementAt(k).DateAndTime + "<br />");     //gibt nacheinander Feuerwehrmitglieder an
                                    counter++;
                                }
                            }
                        }
                        if (!(counter == 0))
                        {
                            _t.Display("To go into detail type corresponding number.<br />");
                            UserChoice = ValidInputRange(_t.GetInt(), 1, counter);
                            _t.Display(GetListDeployments().ElementAt(UserChoice - 1).ToString() + "<br />");       //sucht Einsatz nach ID heraus (-1 da [siehe bei vorletztem "if"])
                        }
                        else
                        {
                            _t.Display("Couldnt find any Deployments with your selection.<br />");
                        }
                    }
                    if (UserChoice == 2 && GetListVehicles().Count == 0)
                    {
                        _t.Display("Seems like you dont have any Vehicles in your basedata!<br />");
                        return;
                    }
                    if (UserChoice == 2)
                    {
                        List <Vehicle> vehicles = GetListVehicles();
                        Vehicle        tmp;
                        _t.Display("Select for which car you wish to search:<br />");
                        ViewList(vehicles);
                        UserChoice = ValidInputRange(_t.GetInt(), 1, vehicles.Count());     //sucht Fahrzeug nach ID
                        tmp        = vehicles.ElementAt(UserChoice - 1);

                        int amountD = deploys.Count();
                        int amountC;
                        int counter = 0;
                        for (int k = 0; k < amountD; k++)
                        {
                            amountC = deploys.ElementAt(k).Cars.Length;
                            for (int j = 0; j < amountC; j++)
                            {
                                if (deploys.ElementAt(k).Cars[j].Equals(tmp) && counter < howMany)
                                {
                                    _t.Display("(" + (k + 1) + ") At: " + deploys.ElementAt(k).Location + " Time: " + deploys.ElementAt(k).DateAndTime + "<br />");     //sucht nach Einsätzen mit gewähltem Fahrzeug
                                    counter++;
                                }
                            }
                        }
                        if (!(counter == 0))
                        {
                            _t.Display("To go into detail type corresponding number.<br />");
                            UserChoice = ValidInputRange(_t.GetInt(), 1, counter);
                            _t.Display(GetListDeployments().ElementAt(UserChoice - 1).ToString() + "<br />");
                        }
                        else
                        {
                            _t.Display("Couldnt find any Deployments with your selection.<br />");
                        }
                    }
                }
                break;

            case "-d":
            {
                List <Deployment> liste = GetListDeployments();
                int number = 0;         //erstellt einen Einsatzeintrag

                Vehicle[]     v = new Vehicle[number];
                FireFighter[] p = new FireFighter[number];
                Resource[]    r = new Resource[number];

                _t.Display("Where was the Deployment?<br />");
                string loc = _t.GetString();
                _t.Display("How many Vehicles participated in the Deployment?<br />");
                List <Vehicle> cars = GetListVehicles();
                if (cars.Count == 0)
                {
                    _t.Display("It appears as if you have no vehicles in your basedata<br />" +
                               "You might wish to ask your local admin to create some for you.<br /><br />");
                }
                else
                {
                    number = ValidInputRange(_t.GetInt(), 0, cars.Count);           //ist die Zahl der Fahrzeuge valide?
                    v      = new Vehicle[number];
                    for (int i = 0; i < number; i++)
                    {
                        v[i] = cars.ElementAt(ObjectSelection(cars) - 1);
                    }
                }
                _t.Display("How much staff participated in the Deployment?<br />");
                List <FireFighter> staff = GetListFireFighter();
                if (staff.Count == 0)
                {
                    _t.Display("It appears as if you have no staff in your basedata<br />" +
                               "You might wish to ask your local admin to create some for you.<br /><br />");
                }
                else
                {
                    number = ValidInputRange(_t.GetInt(), 0, staff.Count);          //ist die Zahl der Feuerwehrmänner valide?
                    p      = new FireFighter[number];
                    for (int i = 0; i < number; i++)
                    {
                        p[i] = staff.ElementAt(ObjectSelection(staff) - 1);
                    }
                }
                _t.Display("How many resources were used in the Deployment?<br />");
                List <Resource> res = GetListResources();
                if (res.Count == 0)
                {
                    _t.Display("It appears as if you have no resources in your basedata<br />" +
                               "You might wish to ask your local admin to create some for you.<br /><br />");
                }
                else
                {
                    number = ValidInputRange(_t.GetInt(), 0, res.Count);            //ist die zahl der resourcen valide?
                    r      = new Resource[number];
                    for (int i = 0; i < number; i++)
                    {
                        r[i] = res.ElementAt(ObjectSelection(res) - 1);
                    }
                }
                _t.Display("Any comments?<br />");
                string com = _t.GetString();

                if (Globals.DLL == false)
                {
                    DeploymentFactory DF   = new DeploymentFactory();
                    Deployment        test = DF.NewDeployment(loc, v, r, p, com, AllDeployments.Count() + 1);
                    liste.Add(test);
                }
                else
                {
#pragma warning disable CS0162 // Unreachable code detected
                    var DeploymentDLL = new DeploymentDLL();
#pragma warning restore CS0162 // Unreachable code detected
                    var        DF  = DeploymentDLL.NewDeployment(loc, v, r, p, com, AllDeployments.Count() + 1);
                    Deployment tmp = new Deployment(DF.Location, DF.Cars, DF.Resources, DF.FireFighters, DF.Comment, DF.Id);
                    liste.Add(tmp);
                }
            }
                GasExaminationCheck();
                break;

            case "-g":
                GasExaminationCheck();
                break;

            case "-w":

                DeployCount = GetListDeployments().Count();
                if (DeployCount == 0)
                {
                    _t.Display("The deployment file seems to be empty.<br />Before you view deployments you should create one!<br />");
                    return;
                }
                _t.Display("How many deployments do you wish to view?(" + DeployCount + ") <br />");
                howMany = ValidInputRange(_t.GetInt(), 1, DeployCount);
                _t.Display("Last " + howMany + " Deployments: <br />");
                toDisplay = "";

                for (int i = 0; i < howMany; i++)
                {
                    toDisplay += "(" + (i + 1) + ") At: " + GetListDeployments().ElementAt((DeployCount - 1) - i).Location + " Time: " + GetListDeployments().ElementAt((DeployCount - 1) - i).DateAndTime + "<br />";
                }
                _t.Display(toDisplay);
                howMany = ValidInputRange(_t.GetInt(), 1, DeployCount);
                _t.Display(GetListDeployments().ElementAt((DeployCount - 1) - (howMany - 1)).GenerateWebReport() + "<br />");
                break;

            case "-q":
                System.Environment.Exit(1);
                break;
            }
        }