// Udfylder skyggetabellen TestCenterCitizen, binder tilfældige citizens til tilfældige testcentre
        // Kræver at der allerede er Citizens og TestCenter i databasen
        public void AddCitizenToTestCenter(MyDBContext db, int number = 100)
        {
            for (int i = 0; i < number; i++)
            {
                int rcit = random.Next(db.Citizen.Count());
                int rtcr = random.Next(db.TestCenter.Count());

                var cit = db.Citizen.OrderBy(c => c.SocialSecurityNumber).Skip(i).Take(1).FirstOrDefault();
                var tcr = db.TestCenter.OrderBy(c => c.TestCenterID).Skip(i).Take(1).FirstOrDefault();

                var tcc = new TestCenterCitizen();
                tcc.SocialSecurityNumber = cit.SocialSecurityNumber;
                tcc.TestCenterID         = tcr.TestCenterID;

                int rnum = random.Next(100);
                if (rnum < 33)
                {
                    tcc.result = false;
                    tcc.status = "Not Ready";
                }
                else if (rnum < 66)
                {
                    tcc.result = true;
                    tcc.status = "Ready";
                }
                else if (rnum <= 100)
                {
                    tcc.result = false;
                    tcc.status = "Ready";
                }

                tcc.date = $"{getDate()}{getMonth()}{getYear(0)}";

                db.Add(tcc);
                db.SaveChanges();
            }
        }
        public void createTestCase(MyDBContext db)
        {
            Console.Clear();
            Console.WriteLine("Type the SocialSecurityNumber of the citizen: ");
            string temp1 = Console.ReadLine();
            string ssn   = temp1.Trim();

            Console.Clear();
            Console.WriteLine("Type the TestCenterID of the TestCenter where the test was made: ");
            string temp2        = Console.ReadLine();
            int    testcenterid = int.Parse(temp2);

            var cit = db.Citizen.Find(ssn);
            var tcr = db.TestCenter.Find(testcenterid);

            var tcc = new TestCenterCitizen();

            tcc.SocialSecurityNumber = cit.SocialSecurityNumber;
            tcc.TestCenterID         = tcr.TestCenterID;

            Console.Clear();
            Console.WriteLine("Type the date of the test (ddmmyy): ");
            string date12 = Console.ReadLine();

            tcc.date = date12;

            Console.Clear();
            Console.WriteLine("Type the status of the test (Not Tested, Not Ready, Ready): ");
            string status = Console.ReadLine();

            tcc.status = status;

            Console.Clear();
            Console.WriteLine("Type the test result: \n" +
                              "'P' for positive\n" +
                              "'N' for negative/unknown\n");
            string temp  = Console.ReadLine();
            int    check = 0;

            do
            {
                if (temp == "P")
                {
                    tcc.result = true;
                    check      = 1;

                    using (var context = new MyDBContext())
                    {
                        var tmpresult = context.LocationCitizen.Where(x => x.SocialSecurityNumber == ssn).ToList();

                        foreach (LocationCitizen loccit in tmpresult)
                        {
                            var adress = loccit.Address;
                            var tmp2   = context.LocationCitizen.Where(x => x.Address == adress).ToList();

                            // Får den nuværende dato
                            DateTime dt      = DateTime.Now;
                            DateTime dt3days = dt.AddDays(-3);

                            // Får den smittede persons dato
                            string   day1     = loccit.date.Substring(0, 2);
                            string   month1   = loccit.date.Substring(2, 2);
                            string   year1    = "20" + loccit.date.Substring(4, 2);
                            DateTime infectdt = new DateTime(int.Parse(year1), int.Parse(month1), int.Parse(day1));

                            float compareStart = infectdt.CompareTo(dt3days);
                            Console.WriteLine(dt);
                            Console.WriteLine(infectdt);
                            if (compareStart <= 0)
                            {
                                DateTime dt1;
                                DateTime dt2;
                                DateTime dt3;
                                // Trækker 3 dage fra for at se om den er aktiv
                                dt1 = dt.AddDays(-1);
                                dt2 = dt.AddDays(-2);
                                dt3 = dt.AddDays(-3);
                                // Fjerner timer/minutter/sekunder fra DateTime
                                string stringdt1 = dt1.ToShortDateString();
                                dt1 = Convert.ToDateTime(stringdt1);
                                string stringdt2 = dt2.ToShortDateString();
                                dt2 = Convert.ToDateTime(stringdt2);
                                string stringdt3 = dt3.ToShortDateString();
                                dt3 = Convert.ToDateTime(stringdt3);

                                var table = new ConsoleTable("People who MIGHT be infected");

                                foreach (LocationCitizen C in tmp2)
                                {
                                    // Formaterer Citizen dato til DateTime og sammenligner med dt1/2/3
                                    string   day      = C.date.Substring(0, 2);
                                    string   month    = C.date.Substring(2, 2);
                                    string   year     = "20" + C.date.Substring(4, 2);
                                    DateTime citdt    = new DateTime(int.Parse(year), int.Parse(month), int.Parse(day));
                                    float    compare1 = dt1.CompareTo(citdt);
                                    float    compare2 = dt2.CompareTo(citdt);
                                    float    compare3 = dt3.CompareTo(citdt);

                                    if (compare1 == 0 || compare2 == 0 || compare3 == 0)
                                    {
                                        if (C.SocialSecurityNumber != ssn)
                                        {
                                            table.AddRow(C.SocialSecurityNumber);
                                        }
                                    }
                                }
                                table.Write();
                                Console.WriteLine("Press any key to end");
                                Console.ReadLine();
                            }
                        }
                    }
                }
                else if (temp == "N")
                {
                    tcc.result = false;
                    check      = 1;
                }
                else
                {
                    Console.WriteLine("Please type a valid result: ");
                    temp  = Console.ReadLine();
                    check = 0;
                }
            } while (check == 0);

            db.Add(tcc);
            db.SaveChanges();

            Console.WriteLine("Test Case succesfully added!\n");
        }