예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string s = TextBoxesCheck();

            if (s != null)
            {
                MessageBox.Show(s, "Исправьте ошибки");
            }
            else
            {
                ControlFunctions.EditPerson(person,
                                            textBoxName.Text,
                                            dateTimePickerBirthDate.Value,
                                            comboBoxDocType.Text,
                                            textBoxDocumentNum.Text,
                                            textBoxAdress.Text,
                                            comboBoxGender.Text,
                                            textBoxInsurance.Text,
                                            textBoxPassword.Text,
                                            comboBoxBlood.Text,
                                            textBoxEducation.Text);
                saved = true;
                this.Close();
            }
        }
예제 #2
0
        private void buttonAddJob_Click(object sender, EventArgs e)
        {
            if (textBoxNewJob.Text == "" || textBoxNewJob.Text == "Все должности")
            {
                MessageBox.Show("Введите название работы");
            }
            else
            {
                string jobName = textBoxNewJob.Text;
                string result;
                Job    newJob;


                newJob = ControlFunctions.CreateJob(jobName);
                result = ControlFunctions.AddJob(newJob);
                if (result != null)
                {
                    MessageBox.Show(result, "Ошибка");
                }
                else
                {
                    ReloadForm(true);
                }
            }
        }
예제 #3
0
        private void buttonDeleteJob_Click(object sender, EventArgs e)
        {
            if (comboBoxJobs.Text != "" && comboBoxJobs.Text != "Все болезни")
            {
                string illnessName = comboBoxJobs.Text;

                if (MessageBox.Show(text: "Все пациенты потеряют данную болезнь, продолжить?",
                                    caption: "Продолжить?",
                                    buttons: MessageBoxButtons.YesNo,
                                    icon: MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    ControlFunctions.RemoveIllness(illnessName);
                }
                else
                {
                    ;
                }


                ReloadForm(true);
            }
            else
            {
                MessageBox.Show("Выберите болезнь");
            }
        }
예제 #4
0
        private void buttonAddJob_Click(object sender, EventArgs e)
        {
            if (textBoxName.Text == "" || textBoxName.Text == "Все болезни")
            {
                MessageBox.Show("Введите название болезни");
            }
            else
            {
                string  illnessName = textBoxName.Text;
                string  illnessInfo = textBoxInfo.Text;
                string  result;
                Illness newIllness;


                newIllness = ControlFunctions.CreateIllness(illnessInfo, illnessName);
                result     = ControlFunctions.AddIllness(newIllness);
                if (result != null)
                {
                    MessageBox.Show(result, "Ошибка");
                }


                ReloadForm(true);
            }
        }
예제 #5
0
        private void buttonAddJob_Click(object sender, EventArgs e)
        {
            if (comboBoxCorpus.Text == "")
            {
                MessageBox.Show("Выберите корпус");
            }
            else
            if (comboBoxFloor.Text == "")
            {
                MessageBox.Show("Выберите этаж");
            }
            else
            {
                int    cabinetNum = (int)numericUpDownCabinetNum.Value;
                string corpusName = comboBoxCorpus.Text;
                int    floorNum   = int.Parse(comboBoxFloor.Text);


                Cabinet newCabinet = ControlFunctions.CreateCabinet(corpusName, floorNum, cabinetNum);
                string  result     = ControlFunctions.AddCabinet(newCabinet);
                if (result != null)
                {
                    MessageBox.Show(result, "Ошибка");
                }
                else
                {
                    ReloadForm(false);
                }
            }
        }
예제 #6
0
        private void buttonDeleteJob_Click(object sender, EventArgs e)
        {
            if (comboBoxJobs.Text == "" || comboBoxJobs.Text == "Все должности")
            {
                MessageBox.Show("Выберите работу");
            }
            else
            {
                string jobName = comboBoxJobs.Text;


                if (jobName == "Главврач" || jobName == "Нет должности")
                {
                    MessageBox.Show(text: "Нельзя удалить Главврача и пункт \"Нет должности\"",
                                    caption: "Нельзя",
                                    buttons: MessageBoxButtons.OK,
                                    icon: MessageBoxIcon.Error);
                }
                else if (MessageBox.Show(text: "Все врачи потеряют данную должность, продолжить?",
                                         caption: "Продолжить?",
                                         buttons: MessageBoxButtons.YesNo,
                                         icon: MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    ControlFunctions.RemoveJob(jobName);
                }
                else
                {
                    ;
                }
                ReloadForm(true);
            }
        }
예제 #7
0
 private void buttonDelete_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedRows.Count != 0 && dataGridView1.SelectedCells[0] != null)
     {
         ControlFunctions.RemovePerson((int)dataGridView1.SelectedCells[4].Value);
         FillDataGridView(db.PersonSet.ToList());
         dataGridView1.Refresh();
     }
     else
     {
         MessageBox.Show("Человек не выбран");
     }
 }
예제 #8
0
 private void buttonRemove_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedCells.Count != 0)
     {
         int id = (int)dataGridView1.SelectedRows[0].Cells[2].Value;
         ControlFunctions.RemoveRecord(id);
         RefreshData();
     }
     else
     {
         MessageBox.Show("Выберите запись для удаления");
     }
 }
예제 #9
0
파일: Registr.cs 프로젝트: Iskusnik/MedSys
        private void button1_Click(object sender, EventArgs e)
        {
            string s = TextBoxesCheck();

            if (s != null)
            {
                MessageBox.Show(s, "Исправьте ошибки");
            }
            else
            {
                Person newPerson;
                if (isDoctor)
                {
                    // var jobs = (from j in db.JobSet where j.Name == comboBoxJob.Text select j).ToArray();
                    // job = jobs[0];

                    newPerson = ControlFunctions.CreateDoctor(textBoxName.Text,
                                                              dateTimePickerBirthDate.Value,
                                                              comboBoxDocType.Text,
                                                              textBoxDocumentNum.Text,
                                                              "Нет должности",
                                                              textBoxAdress.Text,
                                                              textBoxEducation.Text,
                                                              comboBoxGender.Text,
                                                              textBoxInsurance.Text,
                                                              textBoxPassword.Text);
                }
                else
                {
                    newPerson = ControlFunctions.CreatePatient(textBoxName.Text,
                                                               dateTimePickerBirthDate.Value,
                                                               comboBoxDocType.Text,
                                                               textBoxDocumentNum.Text,
                                                               textBoxAdress.Text,
                                                               comboBoxBlood.Text,
                                                               comboBoxGender.Text,
                                                               textBoxInsurance.Text,
                                                               textBoxPassword.Text);
                }
                string result = ControlFunctions.AddPerson(newPerson);
                if (result == null)
                {
                    saved = true;
                    this.Close();
                }
                else
                {
                    MessageBox.Show(result, "Исправьте ошибки");
                }
            }
        }
예제 #10
0
        private void buttonRemove_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedCells.Count != 0 && dataGridView1.SelectedCells[0].Value != null)
            {
                int id = (int)dataGridView1.SelectedCells[3].Value;
                ControlFunctions.RemoveVisit(id);

                LoadData(db.TimeForVisitSet.ToList());
            }
            else
            {
                MessageBox.Show("Выберите приём для удаления");
            }
        }
예제 #11
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            if (textBoxInfo.Text == "" &&
                comboBoxPatient.SelectedIndex >= 0 &&
                comboBoxDoctor.SelectedIndex >= 0)
            {
                ControlFunctions.EditRecord(record, comboBoxDoctor.Text, comboBoxPatient.Text, textBoxInfo.Text, datePicker.Text, timePicker.Text);

                this.Close();
            }
            else
            {
                MessageBox.Show("Заполните поля");
            }
        }
예제 #12
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            if (comboBoxCabinet.SelectedIndex >= 0 &&
                comboBoxCorpus.SelectedIndex >= 0 &&
                comboBoxCorpus.SelectedIndex >= 0 &&
                comboBoxDoctor.SelectedIndex >= 0)
            {
                ControlFunctions.EditVisit(visit, comboBoxDoctor.Text, comboBoxPatient.Text, comboBoxCorpus.Text, comboBoxCabinet.Text, datePicker.Text, timePicker.Text);

                this.Close();
            }
            else
            {
                MessageBox.Show("Заполните поля");
            }
        }
예제 #13
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            if (comboBoxCorpus.SelectedIndex >= 0 &&
                comboBoxFloor.SelectedIndex >= 0)
            {
                int floor = (int)comboBoxFloor.SelectedItem;
                int num   = (int)numericUpDown1.Value;

                ControlFunctions.EditCabinet(cabinet, comboBoxCorpus.Text, floor, num);

                this.Close();
            }
            else
            {
                MessageBox.Show("Заполните поля");
            }
        }
예제 #14
0
 private void buttonSave_Click(object sender, EventArgs e)
 {
     if (textBoxInfo.Text != "")
     {
         Record newRecord = ControlFunctions.CreateRecord(DateTime.Now, doctor, textBoxInfo.Text, patient.MedCard);
         string result    = ControlFunctions.AddRecord(newRecord);
         if (result == null)
         {
             this.Close();
         }
         else
         {
             MessageBox.Show(result);
         }
     }
     else
     {
         MessageBox.Show("Заполните поля");
     }
 }
예제 #15
0
 private void buttonDelete_Click(object sender, EventArgs e)
 {
     if (listBoxCurrentJobs.SelectedItem != null)
     {
         string selectedJob = (string)listBoxCurrentJobs.SelectedItem;
         string result      = ControlFunctions.RemoveJobFromDoctor(doctor.Id, selectedJob);
         if (result != null)
         {
             MessageBox.Show(result);
         }
         else
         {
             RefreshForm();
         }
     }
     else
     {
         MessageBox.Show("Выберите работу");
     }
 }
예제 #16
0
        private void buttonDeleteJob_Click(object sender, EventArgs e)
        {
            string corpusName = comboBoxJobs.Text;

            if (comboBoxJobs.Text != "")
            {
                if (MessageBox.Show(text: "Все кабинеты в данном корпусе и все приёмы в тех кабинетах будут удалены, продолжить?",
                                    caption: "Продолжить?",
                                    buttons: MessageBoxButtons.YesNo,
                                    icon: MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    ControlFunctions.RemoveCorpus(corpusName);
                }

                ReloadForm();
            }
            else
            {
                MessageBox.Show("Выберите корпус");
            }
        }
예제 #17
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBoxTime.Text == "")
            {
                MessageBox.Show("Выберите специальность, врача, день и время");
            }
            else
            {
                Doctor   tempDoctor    = (Doctor)db.PersonSet.Find(DoctorsList[index].Id);
                DateTime visitDateTime = DateTime.Parse(comboBoxDate.Text);

                visitDateTime = visitDateTime.Add(TimeSpan.FromTicks(DateTime.Parse(comboBoxTime.Text).TimeOfDay.Ticks));


                TimeForVisit visit = (from time in db.TimeForVisitSet
                                      where time.Doctor.Id == tempDoctor.Id &&
                                      time.VisitTime == visitDateTime
                                      select time).ToArray()[0];

                comboBoxTime.Items.Remove(comboBoxTime.Text);



                ControlFunctions.AddTimeForVisitToPatient(patient, visit);

                db.SaveChanges();
                MessageBox.Show("Запись совершена");
                button1.Enabled = false;

                var timeForVisit = (from t in db.TimeForVisitSet
                                    where t.Patient == null
                                    select t).ToList();
                if (timeForVisit.Count == 0)
                {
                    MessageBox.Show("Свободных для записи врачей нет");
                    Close();
                }
            }
        }
예제 #18
0
 private void buttonSave_Click(object sender, EventArgs e)
 {
     if (comboBoxCabinet.SelectedIndex >= 0 &&
         comboBoxCorpus.SelectedIndex >= 0 &&
         comboBoxDoctor.SelectedIndex >= 0)
     {
         TimeForVisit tfv    = ControlFunctions.CreateTimeForVisit(comboBoxDoctor.Text, comboBoxCorpus.Text, comboBoxCabinet.Text, datePicker.Text, timePicker.Text);
         string       result = ControlFunctions.AddTimeForVisit(tfv);
         if (result != null)
         {
             MessageBox.Show(result);
         }
         else
         {
             this.Close();
         }
     }
     else
     {
         MessageBox.Show("Заполните поля");
     }
 }
예제 #19
0
파일: Login.cs 프로젝트: Iskusnik/MedSys
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            ControlFunctions.GenerateRandomDataBase();
            string mes;
            Person pers;

            if (!ControlFunctions.LoginResult(this.textBoxFullName.Text, this.textBoxPassword.Text, out mes, out pers))
            {
                MessageBox.Show(mes);
            }
            else
            if (pers is Patient)
            {
                PatientMenu patientMenu = new PatientMenu((Patient)pers);
                patientMenu.ShowDialog();
            }
            else
            {
                DoctorMenu doctorMenu = new DoctorMenu((Doctor)pers);
                doctorMenu.ShowDialog();
            }
        }
예제 #20
0
        private void buttonAddJob_Click(object sender, EventArgs e)
        {
            string corpusName = textBoxCorpus.Text;

            if (corpusName != "")
            {
                int floors = (int)numericUpDown1.Value;

                Corpus newCorpus = ControlFunctions.CreateCorpus(floors, corpusName);
                string result    = ControlFunctions.AddCorpus(newCorpus);
                if (result != null)
                {
                    MessageBox.Show(result, "Ошибка");
                }
                else
                {
                    ReloadForm();
                }
            }
            else
            {
                MessageBox.Show("Введите название корпуса");
            }
        }
예제 #21
0
        private void ChangePersonInfo_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!saved)
            {
                if (e.CloseReason == CloseReason.UserClosing)
                {
                    DialogResult result = MessageBox.Show("Сохранить перед выходом?", "Внимание",
                                                          MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
                    if (result == DialogResult.Yes)
                    {
                        string s = TextBoxesCheck();
                        if (s != null)
                        {
                            MessageBox.Show(s, "Исправьте ошибки");
                            e.Cancel = false;
                        }
                        else
                        {
                            ControlFunctions.EditPerson(person,
                                                        textBoxName.Text,
                                                        dateTimePickerBirthDate.Value,
                                                        comboBoxDocType.Text,
                                                        textBoxDocumentNum.Text,
                                                        textBoxAdress.Text,
                                                        comboBoxGender.Text,
                                                        textBoxInsurance.Text,
                                                        textBoxPassword.Text,
                                                        comboBoxBlood.Text,
                                                        textBoxEducation.Text);

                            this.Owner.Refresh();
                            e.Cancel = false;
                        }
                    }
                    else if (result == DialogResult.No)
                    {
                        e.Cancel = false;
                    }
                    else if (result == DialogResult.Cancel)
                    {
                        e.Cancel = true;
                    }
                    else
                    {
                        ;
                    }
                }
                else
                {
                    ;
                }
            }
            if (this.Owner is PatientMenu)
            {
                (this.Owner as PatientMenu).ReloadForm();
            }
            else
            if (this.Owner is DoctorMenu)
            {
                (this.Owner as DoctorMenu).ReloadForm();
            }
            else
            if (this.Owner is PatientDetails)
            {
                (this.Owner as PatientDetails).ReloadForm();
            }
            else
            {
                (this.Owner as DoctorDetails).ReloadForm();
            }
        }
예제 #22
0
        protected override void Seed(ModelMedContainer db)
        {
            Job jobNull = ControlFunctions.CreateJob("Нет должности");

            db.JobSet.Add(jobNull);
            Job jobA = ControlFunctions.CreateJob("Главврач");

            db.JobSet.Add(jobA);
            Job jobB = ControlFunctions.CreateJob("Терапевт");

            db.JobSet.Add(jobB);
            db.SaveChanges();

            Doctor docA = ControlFunctions.CreateDoctor("Александров Александр Иванович", DateTime.Parse("11.11.1990"), "Паспорт РФ", "0000000001", "Главврач", "Home,1", "Enough", "Мужской", "12345", "2");

            db.PersonSet.Add(docA);


            Doctor docB = ControlFunctions.CreateDoctor("Иванов Иван Иванович", DateTime.Parse("11.11.1980"), "Паспорт РФ", "0000000002", "Терапевт", "Home,2", "Enough", "Мужской", "12346", "2");

            db.PersonSet.Add(docB);


            db.SaveChanges();



            Doctor docC = ControlFunctions.CreateDoctor("Иванов Иван Иванович", DateTime.Parse("11.11.1955"), "Паспорт РФ", "0000000003", "Терапевт", "Home,2", "Enough", "Мужской", "123473", "2");

            ControlFunctions.AddPerson(docC);



            Patient patA  = ControlFunctions.CreatePatient("Иванов Иван Иванович", DateTime.Parse("11.12.1980"), "Паспорт РФ", "0000000004", "Home,3", "+1", "Мужской", "12347", "2");
            Corpus  corpA = ControlFunctions.CreateCorpus(3, "Корпус 1");

            db.CorpusSet.Add(corpA);
            db.SaveChanges();
            Cabinet cabA = ControlFunctions.CreateCabinet("Корпус 1", 1, 1);

            db.CabinetSet.Add(cabA);
            db.SaveChanges();

            TimeForVisit timeA = ControlFunctions.CreateTimeForVisit("Иванов Иван Иванович_11.11.1980", "Корпус 1", "1", "11.11.2000", "00:00:00");
            TimeForVisit timeB = ControlFunctions.CreateTimeForVisit("Иванов Иван Иванович_11.11.1980", "Корпус 1", "1", "11.11.2000", "12:13:17");

            db.TimeForVisitSet.Add(timeB);
            db.TimeForVisitSet.Add(timeA);
            patA.TimeForVisit.Add(timeA);
            timeA.Patient = patA;


            Illness illA  = ControlFunctions.CreateIllness("Что-то можно, что-то нельзя.", "Болезнь А");
            Illness illAA = ControlFunctions.CreateIllness("Что-то можно, что-то нельзя.", "Болезнь А");
            Illness illB  = ControlFunctions.CreateIllness("Что-то можно, что-то нельзя.", "Болезнь Б");

            db.IllnessSet.Add(illA);
            illA.MedCard.Add(patA.MedCard);
            patA.MedCard.Illness.Add(illA);

            db.IllnessSet.Add(illB);
            illB.MedCard.Add(patA.MedCard);
            patA.MedCard.Illness.Add(illB);


            db.PersonSet.Add(patA);



            Record recA = ControlFunctions.CreateRecord(DateTime.Now, docB, "111", patA.MedCard);
            Record recB = ControlFunctions.CreateRecord(DateTime.Parse("11.11.2000"), docB, "222", patA.MedCard);
            Record recC = ControlFunctions.CreateRecord(DateTime.Parse("11.11.2010"), docA, "333", patA.MedCard);

            db.RecordSet.Add(recA);
            db.RecordSet.Add(recB);
            db.RecordSet.Add(recC);

            db.JobSet.Add(ControlFunctions.CreateJob("testJob"));
            db.SaveChanges();
        }