Example #1
0
        private void ShowDoctors()
        {
            Console.Clear();

            var count = 1;

            foreach (var doctor in _doctorDataAccess.Select())
            {
                var specialization = _doctorsSpecializationDataAccess
                                     .Select()
                                     .Where(specialization => specialization.Id == doctor.SpecializationId).First().Name;
                Console.WriteLine($"[{count++}] {specialization} {doctor.FullName}");
            }

            Console.Write("Введите номер доктора: ");

            if (!int.TryParse(Console.ReadLine(), out int choice))
            {
                ThrowError("Некорректный ввод!");
            }

            //TODO
        }
Example #2
0
        static void Main(string[] args)
        {
            ConfigurationService.Init();
            ICollection <Doctor>       doctors;
            ICollection <VisitHistory> visitTime;

            using (var doctorDataAccess = new DoctorDataAccess())
            {
                doctors = doctorDataAccess.Select();
            }
            Console.WriteLine(@"                                *********************************************
                                *			                    *
                                *			                    *
                                *       Welcome to the Hospital System!     *
                                *			                    *
                                *			                    *
                                *********************************************");
            var patient = new Patient();

            while (true)
            {
                Console.Write("Enter your Full name:\n");
                using (var patientDataAccess = new PatientDataAccess())
                {
                    patient.FullName = Console.ReadLine();
                    patientDataAccess.Insert(patient);
                    visitTime = patientDataAccess.SelectVisitTime();
                }
                Console.Clear();

                Console.Write("\n1. Sign up for an appointment\n\n0. Exit\nChoose: ");
                switch (Console.ReadLine())
                {
                case "1":
                    Console.Write("Choose doctor's direction: \n");
                    var direction = Console.ReadLine();
                    foreach (var doctor in doctors)
                    {
                        if (doctor.Direction.Name.Contains(direction))
                        {
                            using (var patientDataAccess = new PatientDataAccess())
                            {
                                foreach (var date in visitTime)
                                {
                                    if (date.DoctorId == doctor.Id && date.VisitDate.Hour <= DateTime.Now.Hour)
                                    {
                                        doctor.IsFree = true;
                                    }
                                }
                                if (doctor.Schedule.StartTime.Hour >= DateTime.Now.Hour &&
                                    (doctor.Schedule.EndTime.Hour - 1) <= DateTime.Now.Hour &&
                                    doctor.IsFree == true)
                                {
                                    patientDataAccess.InsertHistory(doctor, patient);
                                }
                            }
                        }
                    }
                    break;

                case "0":
                    return;
                }
            }
        }
Example #3
0
        static void Main(string[] args)
        {
            InitConfiguration();

            CultureInfo enUS = new CultureInfo("en-US");

            var doctors = new List <Doctor>
            {
                new Doctor
                {
                    FullName   = "Ivan Ivanov",
                    SpecialId  = Guid.Parse("6E5D08FA-9E66-4639-9742-06F9DF4197A7"),
                    ScheduleId = Guid.Parse("A30B3F5A-7744-4B6D-B99A-1D15848A5B3A"),
                },
                new Doctor
                {
                    FullName   = "Boris Borisov",
                    SpecialId  = Guid.Parse("627CEDC2-530D-4B35-9BEB-08E3B7E07F79"),
                    ScheduleId = Guid.Parse("37D70B5B-4F33-4D07-B834-211C40C3C5EE")
                }
            };

            var patients = new List <Patient>
            {
                new Patient
                {
                    FullName      = "Ivan Ivanov",
                    TimeOfVisitId = Guid.Parse("8E070ED1-E5B1-4BC5-8176-39B4C53FBD37")
                },
                new Patient
                {
                    FullName      = "Boris Borisov",
                    TimeOfVisitId = Guid.Parse("D8E21FB5-EBF6-45AD-AC09-59123ED3389B")
                }
            };

            var visits = new List <TimesToVisits>
            {
                new TimesToVisits
                {
                    Id          = Guid.Parse("D8E21FB5-EBF6-45AD-AC09-59123ED3389B"),
                    TimeOfVisit = DateTime.ParseExact("11:00", "HH:mm", enUS)
                },
                new TimesToVisits
                {
                    Id          = Guid.Parse("8E070ED1-E5B1-4BC5-8176-39B4C53FBD37"),
                    TimeOfVisit = DateTime.ParseExact("15:00", "HH:mm", enUS)
                },
            };

            var scheduls = new List <Schedule>
            {
                new Schedule
                {
                    Id = Guid.Parse("A30B3F5A-7744-4B6D-B99A-1D15848A5B3A"),
                    TimesOfVisitsId = new List <Guid>
                    {
                        Guid.Parse("D8E21FB5-EBF6-45AD-AC09-59123ED3389B")
                    }
                },
                new Schedule
                {
                    Id = Guid.Parse("37D70B5B-4F33-4D07-B834-211C40C3C5EE"),
                    TimesOfVisitsId = new List <Guid>
                    {
                        Guid.Parse("8E070ED1-E5B1-4BC5-8176-39B4C53FBD37")
                    }
                }
            };

            var therapist = new Special
            {
                Id   = Guid.Parse("6E5D08FA-9E66-4639-9742-06F9DF4197A7"),
                Name = "Терапевт"
            };
            var surgeon = new Special
            {
                Id   = Guid.Parse("627CEDC2-530D-4B35-9BEB-08E3B7E07F79"),
                Name = "Хирург"
            };



            var doctorAccess = new DoctorDataAccess();
            var listOfDoc    = doctorAccess.Select().ToList();


            Console.WriteLine("Выберите врача");
            var choose = new List <int>();
            int number = 0;

            foreach (var doc in listOfDoc)
            {
                choose.Add(number);
                Console.Write(doc.FullName);
                Console.Write(" - ");
                Console.WriteLine(choose[number]);
            }
            int.TryParse(Console.ReadLine(), out int numberOfDoc);

            var scheduleAccess  = new ScheduleDataAccess();
            var listOfSchedules = scheduleAccess.Select().ToList();

            var visitAccess  = new TimesToVisitsDataAccess();
            var listOfVisits = visitAccess.Select().ToList();

            choose = null;
            number = 0;
            Doctor DocOfPatient = null;

            foreach (var doc in doctors)
            {
                choose.Add(number);
                if (numberOfDoc == choose[number])
                {
                    DocOfPatient = doc;
                }
                foreach (var schedule in listOfSchedules)
                {
                    if (schedule.Id == DocOfPatient.ScheduleId && schedule.TimesOfVisitsId == listOfVisits[number])
                    {
                        Console.WriteLine(visits[number]);
                    }
                }
            }

            int.TryParse(Console.ReadLine(), out int numberOfVisit);

            var patientAccess = new PatientDataAccess();
            var listOfPatient = patientAccess.Select().ToList();

            Console.WriteLine("Введите имя");
            string nameOfPatient = Console.ReadLine();
            var    newPatient    = new Patient
            {
                FullName      = nameOfPatient,
                TimeOfVisitId =
            };

            listOfPatient.Add(newPatient);
        }