示例#1
0
        private void редактироватьПациентаToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int  index     = dataGridViewMain.SelectedRows[0].Index;
            int  Id        = 0;
            bool converted = Int32.TryParse(dataGridViewMain[0, index].Value.ToString(), out Id);

            if (converted == false)
            {
                return;
            }
            patient = bd.Card_Patients.Find(Id);
            PatientsForm f = new PatientsForm(patient);

            if (f.ShowDialog() == DialogResult.OK)
            {
                bd.SaveChanges();
                dataGridViewMain.Update();
                dataGridViewMain.Refresh();
                MessageBox.Show("Данные отредактированные!");
            }
            else
            {
                MessageBox.Show("Не удалось отредактировать данные!");
            }
        }
示例#2
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            patient     = new Card_Patients();
            sick_leave  = new Sick_leaves();
            ref_analyze = new Ref_Analyzes();
            SearchForm f = new SearchForm(patient, sick_leave, ref_analyze);

            f.ShowDialog();
        }
示例#3
0
 //Registration_patientsEntities bd = null;
 public SearchForm(Card_Patients p, Sick_leaves s, Ref_Analyzes a)
 {
     InitializeComponent();
     this.patient    = p;
     this.sick_leave = s;
     this.analyze    = a;
     bd = new Registration_patientsEntities2();
     comboBoxSurname.DataSource  = null;
     comboBoxAdress.DataSource   = null;
     comboBoxCard_num.DataSource = null;
     comboBoxAnalyz.DataSource   = null;
 }
 public PatientsForm(Card_Patients p)
 {
     InitializeComponent();
     this.patient = p;
     bd           = new Registration_patientsEntities2();
     //bd = new Registration_patientsEntities();
     textBoxNumCard.Text          = patient.Number_Card.ToString();
     textBoxSurname.Text          = patient.Surname;
     textBoxName.Text             = patient.Name;
     textBoxPatronymic.Text       = patient.Patronymic;
     textBoxPassropt.Text         = patient.Passport;
     textBoxAdress.Text           = patient.Adress;
     textBoxPhone.Text            = patient.Phone_number;
     dateTimePickerBirthday.Value = DateTime.Now.Date;
     comboBoxTherapist.DataSource = null;
     bd.Therapists.Load();
     comboBoxTherapist.DataSource    = bd.Therapists.Local.ToList();
     comboBoxTherapist.DisplayMember = "Surname";
     comboBoxTherapist.ValueMember   = "Id";
 }
示例#5
0
 private void удалитьПациентаToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (dataGridViewMain.SelectedRows.Count == 1)
     {
         int  index     = dataGridViewMain.SelectedRows[0].Index;
         int  Id        = 0;
         bool converted = Int32.TryParse(dataGridViewMain[0, index].Value.ToString(), out Id);
         if (converted == false)
         {
             return;
         }
         patient = bd.Card_Patients.Find(Id);
         bd.Card_Patients.Remove(patient);
         bd.SaveChanges();
         dataGridViewMain.Update();
         dataGridViewMain.Refresh();
         MessageBox.Show("Обьект успешно удален!");
     }
     else
     {
         MessageBox.Show("Не удалось удалить данные!");
     }
 }
示例#6
0
        private void добавитьПациентаToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bd.Card_Patients.Load();
            patient = new Card_Patients();
            PatientsForm f = new PatientsForm(patient);

            if (f.ShowDialog() == DialogResult.OK)
            {
                Card_Patients tmp = bd.Card_Patients.Local.Where(x => x.Number_Card == patient.Number_Card && x.Surname == patient.Surname && x.Name == patient.Name &&
                                                                 x.Patronymic == patient.Patronymic && x.Passport == patient.Passport && x.Adress == patient.Adress && x.Phone_number == patient.Phone_number &&
                                                                 x.Date_birth == patient.Date_birth && x.Id_Therapist == patient.Id_Therapist && x.IsMoved == patient.IsMoved).FirstOrDefault();
                if (tmp == null)
                {
                    bd.Card_Patients.Add(patient);
                    bd.SaveChanges();
                    MessageBox.Show("Данные успешно добавлены!");
                }
                else
                {
                    MessageBox.Show("Не удалось добавить данные!");
                }
            }
        }