public bool Zakreplenie(ref MedOrgService ms,
                                ref PacientServise ps,
                                out string mesage)
        {
            #region Select Pation
            foreach (Pacient p in ps.PacientList.Take(10))
            {
                p.PacientInfo();
            }

            Console.WriteLine("--------------------------------------");
            Pacient selectPation = new Pacient();
            Console.WriteLine("Выберите пациента");
            int selectIin = Int32.Parse(Console.ReadLine());
            selectPation = ps[selectIin];
            Console.WriteLine("--------------------------------------");
            if (selectPation == null)
            {
                mesage = "Данный пациент не существует!";
                return(false);
            }
            #endregion

            #region Select MedOrg
            foreach (MedOrganization o in ms.MedOrgList.Take(10))
            {
                o.MedOrganizationInfo();
            }

            Console.WriteLine("--------------------------------------");
            MedOrganization selectOrg = new MedOrganization();
            Console.WriteLine("Выберите мед организацию");
            int selectOrgId = Int32.Parse(Console.ReadLine());
            selectOrg = ms[selectOrgId];
            Console.WriteLine("--------------------------------------");

            #endregion

            Console.Clear();

            var so = ms.MedOrgList.FirstOrDefault(f => f.Id == selectOrgId);

            foreach (var p in so.PacientList)
            {
                if (p.IIN == selectIin)
                {
                    mesage = "Данный пациент уже прикреплен!";
                    return(false);
                }
            }

            so.PacientList.Add(selectPation);
            ps.PacientList.FirstOrDefault(f => f.IIN == selectIin)
            .MedOrganization = selectOrg;

            mesage = "Данный пациент прикреплен успешно!";
            return(true);
        }
Пример #2
0
        public void PacientGenerator(int size)
        {
            Random r = new Random();

            for (int i = 0; i < size; i++)
            {
                string  Familiya  = ((LastName)r.Next(1, 8)).ToString();
                string  Imya      = ((Name)r.Next(1, 8)).ToString();
                string  Otchestvo = ((Otchestvo)r.Next(1, 8)).ToString();
                int     IIN       = r.Next(100000, 999999);
                Pacient newPac    = new Pacient(Familiya, Imya, Otchestvo, IIN);
                pac.Add(newPac);
            }
        }
Пример #3
0
        public bool Zakreplenie(/*ref MedOrgService ms, ref PacientServise ps,*/ out string mesage)
        {
            #region Select Pation
            //foreach (Pacient p in PacientServiseStat.PacientList.Take(10))
            foreach (Pacient p in PacientServise.Instance.PacientList.Take(10))
            {
                p.PacientInfo();
            }

            Console.WriteLine("           --------------------------------------");
            Pacient selectPation = new Pacient();
            Console.WriteLine("                 Select patient, enter IIN");

            int selectIin = Int32.Parse(Console.ReadLine());
            //selectPation = PacientServiseStat[selectIin];
            selectPation = PacientServise.Instance[selectIin];
            Console.WriteLine("          --------------------------------------");
            if (selectPation == null)
            {
                mesage = "                   This patient does not exist!";
                return(false);
            }

            #endregion
            #region Select MedOrg
            //foreach (MedOrganization o in MedOrgServiceStat.MedOrgList.Take(10))
            foreach (MedOrganization o in MedOrgService.Instance.MedOrgList.Take(10))
            {
                o.MedOrganizationInfo();
            }

            Console.WriteLine("           --------------------------------------");
            MedOrganization selectOrg = new MedOrganization();
            Console.WriteLine("               Select med organization, enter id");
            int selectOrgId = Int32.Parse(Console.ReadLine());
            //selectOrg = MedOrgServiceStat[selectOrgId];
            selectOrg = MedOrgService.Instance[selectOrgId];
            Console.WriteLine("           --------------------------------------");

            #endregion

            Console.Clear();


            //var so = MedOrgServiceStat.MedOrgList.FirstOrDefault(f => f.Id == selectOrgId);
            var so = MedOrgService.Instance.MedOrgList.FirstOrDefault(f => f.Id == selectOrgId);
            foreach (var p in so.PacientList)
            {
                if (p.IIN == selectIin)
                {
                    mesage = "This patient is already attached!";
                    Console.WriteLine("This patient is already attached!");
                    return(false);
                }
            }

            so.PacientList.Add(selectPation);
            //PacientServiseStat.PacientList.FirstOrDefault(f => f.IIN == selectIin)
            PacientServise.Instance.PacientList.FirstOrDefault(f => f.IIN == selectIin)
            .MedOrganization = selectOrg;

            mesage = "This patient is successfully attached!";
            Console.WriteLine("This patient is successfully attached!");
            //MedOrgService.Instance.PokazVsehOrg();
            return(true);
        }