Esempio n. 1
0
        public void createManagement(TestCenterManagementService tcms, TestCenterService tcs)
        {
            Console.Clear();
            Console.WriteLine("Type in TestCenterManagements PhoneNumber:(8 digits): ");
            int phonenumber = int.Parse(Console.ReadLine());

            Console.WriteLine("Type in TestCenterManagements Email: ");
            string email = Console.ReadLine();

            Console.WriteLine("Type in TestCenterID for the TestCenter that the this Management will manage: ");
            int testcenterid = int.Parse(Console.ReadLine());

            var TestCenterManagementAdd = new TestCenterManagement()
            {
                PhoneNumber  = phonenumber,
                Email        = email,
                TestCenterID = testcenterid,
                testCenter   = tcs.Get(testcenterid)
            };

            tcms.Create(TestCenterManagementAdd);

            Console.WriteLine("TestCenterManagement succesfully added!\n");
        }
Esempio n. 2
0
        // Genererer et antal tilfældige TestCenterManagements
        public void GenerateTestCenterManagement(TestCenterManagementService tcms, TestCenterService tcs, int number = 100)
        {
            // Clears the database of TestCenterManagements
            var myTestCenterManagements = tcms.Get();

            foreach (var i in myTestCenterManagements)
            {
                tcms.Remove(i);
            }

            for (int i = 1; i < (number + 1); i++)
            {
                var temp = random.Next(Municipalities.Count);
                var tcm  = new TestCenterManagement()
                {
                    PhoneNumber  = 10000000 + i,
                    Email        = "random@mail" + i.ToString() + ".dk",
                    TestCenterID = i,
                    testCenter   = tcs.Get(i)
                };

                tcms.Create(tcm);
            }
        }
Esempio n. 3
0
        // Genererer et antal tilfældige testcentre
        public void GenerateTestCenter(TestCenterService tcs, int number = 100)
        {
            // Clears the database of TestCenter
            var myTestCenters = tcs.Get();

            foreach (var i in myTestCenters)
            {
                tcs.Remove(i);
            }

            for (int i = 1; i < (number + 1); i++)
            {
                var temp = random.Next(Municipalities.Count);

                var testcenter = new TestCenter()
                {
                    TestCenterID   = i,
                    MunicipalityID = Municipalities[temp],
                    Hours          = "8-20"
                };

                tcs.Create(testcenter);
            }
        }
Esempio n. 4
0
        public void createTestCase(CitizenService cs, TestCenterService tcs, TestCenterCitizenService tccs, LocationCitizenService lcs)
        {
            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 = cs.Get(ssn);
            var tcr = tcs.Get(testcenterid);

            var tcc = new TestCenterCitizen();

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

            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 = lcs.GetSSN(ssn);

                    foreach (LocationCitizen loccit in tmpresult)
                    {
                        var adress = loccit.Address;
                        var tmp2   = lcs.GetADR(adress);

                        // 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);

            tccs.Create(tcc);

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