示例#1
0
 public MedOrgService()
 {
     OrgGenerator(10);
     Instance = this; // m
     Save();
     Load();
 }
        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);
        }
示例#3
0
 public MedOrgService()
 {
     Instance = this;
     Load();
 }