Esempio n. 1
0
        public void citizenCreation(CitizenService cs)
        {
            Console.Clear();
            Console.WriteLine("Type firstname of citizen: ");
            string Firstname = Console.ReadLine();

            Console.WriteLine("Type lastname of citizen: ");
            string Lastname = Console.ReadLine();


            Console.WriteLine("Type age of citizen: ");
            int age = int.Parse(Console.ReadLine());

            Console.WriteLine("Type sex of citizen (male/female: ");
            string sex = Console.ReadLine();

            Console.WriteLine("Type Social Security Number of citizen (10 digits): ");
            string ssn = Console.ReadLine().Trim();

            Console.WriteLine("Type municipality Id where the citizen live: ");
            int municipalityId = int.Parse(Console.ReadLine());

            var addCitizen = new Citizen()
            {
                FirstName      = Firstname,
                LastName       = Lastname,
                Age            = age,
                Sex            = sex,
                SSN            = ssn,
                MunicipalityId = municipalityId
            };

            cs.Create(addCitizen);
            Console.WriteLine("Citizen was added!\n");
        }
Esempio n. 2
0
        public void LocationCitizenCreation(LocationCitizenService lcs, CitizenService cs, LocationService ls)
        {
            Console.Clear();
            Console.WriteLine("Enter address for the location: ");
            string address = Console.ReadLine();

            Console.WriteLine("Enter SocialSecurityNumber for the citizen: ");
            string ssn = (Console.ReadLine());

            Console.WriteLine("Enter the date ");
            string date = (Console.ReadLine());

            var cit = cs.Get(ssn);
            var loc = ls.GetAddress(address);

            var addLocationCitizen = new LocationCitizen()
            {
                Address  = address,
                SSN      = ssn,
                date     = date,
                citizen  = cit,
                location = loc
            };

            lcs.Create(addLocationCitizen);

            Console.WriteLine("Location added!\n");
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            CitizenService              cs   = new CitizenService();
            LocationService             ls   = new LocationService();
            MunicipalityService         ms   = new MunicipalityService();
            CountryService              ns   = new CountryService();
            TestCenterService           tcs  = new TestCenterService();
            TestCenterManagementService tcms = new TestCenterManagementService();

            LocationCitizenService   lcs  = new LocationCitizenService();
            TestCenterCitizenService tccs = new TestCenterCitizenService();

            MongoFunctions cf = new MongoFunctions();

            int  choice;
            bool done = false;

            do
            {
                Console.WriteLine("Time to choose \n"
                                  + " 1: to add a new citizen\n"
                                  + " 2: to add Testcenter\n"
                                  + " 3: to add Management\n"
                                  + " 4: to add Testcase\n"
                                  + " 5: to a add location\n"
                                  + " 6: to add Location Citizen\n"
                                  + " 0: to exit");

                choice = Convert.ToInt32(Console.ReadLine());

                switch (choice)
                {
                case 1:
                    cf.citizenCreation(cs);
                    break;

                case 2:
                    cf.TestCenterCreation(tcs);
                    break;

                case 3:
                    cf.ManagementCreation(tcms, tcs);
                    break;

                case 4:
                    cf.TestCaseCreation(cs, tcs, tccs, lcs);
                    break;

                case 5:
                    cf.LocationCreation(ls);
                    break;

                case 6:
                    cf.LocationCitizenCreation(lcs, cs, ls);
                    break;


                case 0:
                    done = true;
                    break;
                }
            } while (true);
        }
Esempio n. 4
0
        public void TestCaseCreation(CitizenService cs, TestCenterService tcs, TestCenterCitizenService tccs, LocationCitizenService lcs)
        {
            Console.Clear();
            Console.WriteLine("Enter Social sericurity number for a citizen: ");
            string tempSSN = Console.ReadLine();
            string ssn     = tempSSN.Trim();

            Console.Clear();
            Console.WriteLine("Enter TestCenterId for where the testcenter occured: ");
            string tempTest = Console.ReadLine();
            int    tcid     = int.Parse(tempTest);

            var cit = cs.Get(ssn);
            var tcr = tcs.Get(tcid);

            var tcc = new TestCenterCitizen();

            tcc.SSN          = cit.SSN;
            tcc.TestCenterId = tcr.TestCenterId;
            tcc.citizen      = cit;
            tcc.testCenter   = tcr;

            Console.Clear();
            Console.WriteLine("Enter date for the test in the format (ddmmyy): ");
            string tempDate = Console.ReadLine();

            tcc.Date = tempDate;

            Console.Clear();
            Console.WriteLine("Enter status for the test either ready, done or not done: ");
            string statusOfTest = Console.ReadLine();

            tcc.Status = statusOfTest;

            Console.Clear();
            Console.WriteLine("Enter test result, P = Positve and N = Negative\n");
            string tempResult = Console.ReadLine();
            int    checkBool  = 0;

            do
            {
                if (tempResult == "P")
                {
                    tcc.Result = true;
                    checkBool  = 1;
                }
                else if (tempResult == "N")
                {
                    tcc.Result = false;
                    checkBool  = 1;
                }
                else
                {
                    Console.WriteLine("Enter valid result: ");
                    tempResult = Console.ReadLine();
                    checkBool  = 0;
                }
            } while (checkBool == 0);

            tccs.Create(tcc);
            Console.WriteLine("Test case added\n");
        }