void DelVisit(int ind)
 {
     try
     {
         if (ind < 0)
         {
             throw new Exception("Eror Selected!");
         }
         DatMan   datManage = new DatMan();
         Hospital hospital  = new Hospital();
         hospital = datManage.ReadToObject <Hospital>();
         hospital.visits.RemoveAt(listView3.FocusedItem.Index);
         datManage.Write(hospital);
     }
     catch (Exception er)
     {
         MessageBox.Show(er.Message, "Notifications", MessageBoxButtons.RetryCancel, MessageBoxIcon.Information);
     }
 }
        void AddPatient(Patient patient)
        {
            DatMan   DatMan   = new DatMan();
            Hospital hospital = new Hospital(); hospital = DatMan.ReadToObject <Hospital>();
            bool     e        = false;

            foreach (var el in hospital.patients)
            {
                if (el.Id.ToString() == id2.Text)
                {
                    e = true;
                }
            }
            if (e == false)
            {
                hospital.patients.Add(patient);
                DatMan.Write(hospital);
            }
            else
            {
                ShowMesText(messeg2, "Пациент с таким Id уже существует!!!");
            }
        }
        public void AddDoctor(DOCTOR doctor)
        {
            DatMan   DatMan   = new DatMan();
            Hospital hospital = new Hospital(); hospital = DatMan.ReadToObject <Hospital>();
            bool     e        = false;

            foreach (var el in hospital.ds)
            {
                if (el.Id.ToString() == idfield.Text)
                {
                    e = true;
                }
            }
            if (e == false)
            {
                hospital.ds.Add(doctor);
                DatMan.Write(hospital);
            }
            else
            {
                ShowMesText(messege1, "Врач с таким Id уже существует!!!");
            }
        }
        void AddVisit(Visit visit)
        {
            DatMan   DatMan   = new DatMan();
            Hospital hospital = new Hospital(); hospital = DatMan.ReadToObject <Hospital>();
            bool     e        = false;

            foreach (var el in hospital.visits)
            {
                if (el.Id.ToString() == id3.Text)
                {
                    e = true;
                }
            }
            if (e == false)
            {
                hospital.visits.Add(visit);
                DatMan.Write(hospital);
            }
            else
            {
                ShowMesText(messege3, "Вызит с таким Id уже существует!!!");
            }
        }