Esempio n. 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (textBox3.Text == textBox5.Text)
                using (hc_dbEntities1 h = new hc_dbEntities1())
                {
                    try
                    {
                        if(h.user.Where(use => use.login == textBox4.Text).First().id_user > 0)
                            MessageBox.Show("Ошибка регистрации!\nПользователь с таким логином уже существует.");
                    }
                    catch(InvalidOperationException ex)
                    {
                        if (textBox4.Text != "" && textBox3.Text != "")
                        {
                            user u = new user();
                            u.id_user_type = 2;
                            u.login = textBox4.Text;
                            u.password = textBox3.Text;
                            h.user.AddObject(u);
                            h.SaveChanges();
                            int id = h.user.Where(use => use.login == textBox4.Text && use.password == textBox3.Text).First().id_user;
                            patient p = new patient();
                            p.id_user = id;
                            h.patient.AddObject(p);
                            h.SaveChanges();
                            MessageBox.Show("Регистрация завершена успешно!\nЗаполните информацию о себе во вкладке \"Профиль\".");
                        }
                        else
                            MessageBox.Show("Ошибка регистрации!\nЗаполните пустые поля.");

                    }
                }
            else
                MessageBox.Show("Ошибка регистрации!\nПароли не совпадают.");
        }
Esempio n. 2
0
        public FormPatient(int id)
        {
            InitializeComponent();
            patid = id;

            FillProfile();

            List<department> departmentlist = new List<department>();

            using (hc_dbEntities1 h = new hc_dbEntities1())
            {
                departmentlist = h.department.ToList();
            }

            for (int i = 0; i < departmentlist.Count; i++)
            {
                comboBox1.Items.Add(departmentlist[i].name);
            }

            label5.Text = "Новости нашей психушки:\nВсе вроде хорошо...";

            dataGridView1.RowCount = 7;
            dataGridView1[0, 0].Value = "Понедельник";
            dataGridView1[0, 1].Value = "Вторник";
            dataGridView1[0, 2].Value = "Среда";
            dataGridView1[0, 3].Value = "Четверг";
            dataGridView1[0, 4].Value = "Пятница";
            dataGridView1[0, 5].Value = "Суббота";
            dataGridView1[0, 6].Value = "Воскресенье";
            FillHistory();
        }
Esempio n. 3
0
 private void button1_Click(object sender, EventArgs e)
 {
     using (hc_dbEntities1 h = new hc_dbEntities1())
     {
         string log = textBox1.Text;
         string pas = textBox2.Text;
         int id;
         try
         {
             id = h.user.Where(use => use.login == log && use.password == pas).First().id_user;
         }
         catch(InvalidOperationException ex)
         {
             MessageBox.Show("Неверный логин или пароль");
             return;
         }
         this.Visible = false;
         if (h.user.Where(use => use.id_user == id).First().id_user_type == 2)
         {
             int patid = h.patient.Where(pat => pat.id_user == id).First().id_patient;
             FormPatient form = new FormPatient(patid);
             form.ShowDialog();
         }
         else
         {
             int docid = h.doctor.Where(doc => doc.id_user == id).First().id_doctor;
             FormDoctor form = new FormDoctor(docid);
             form.ShowDialog();
         }
         Application.Exit();
     }
 }
Esempio n. 4
0
 private void button1_Click(object sender, EventArgs e)
 {
     using (hc_dbEntities1 h = new hc_dbEntities1())
     {
         healing heal = h.healing.Where(hea => hea.id_healing == healid).First();
         heal.diagnosis = textBox1.Text;
         heal.drugs = textBox2.Text;
         h.SaveChanges();
     }
 }
Esempio n. 5
0
 private void button1_Click(object sender, EventArgs e)
 {
     using (hc_dbEntities1 h = new hc_dbEntities1())
     {
         patient p = h.patient.Where(pat => pat.id_patient == patid).First();
         p.FIO = textBox1.Text;
         p.Adress = textBox2.Text;
         p.tel = textBox3.Text;
         p.Safety_card = Convert.ToInt32(textBox4.Text);
         h.SaveChanges();
     }
     this.Close();
 }
Esempio n. 6
0
        public FormDoctor(int id)
        {
            InitializeComponent();
            docid = id;

            using (hc_dbEntities1 h = new hc_dbEntities1())
            {
                List<healing> heal = h.healing.Where(hea => hea.id_doctor == docid).ToList();
                for (int i = 0; i < heal.Count; i++)
                {
                    listView1.Items.Add("[" + heal[i].id_healing.ToString() + "] (" + heal[i].healing_time.ToString() + ") " + heal[i].patient.FIO);
                    healidlist.Add(heal[i].id_healing);
                }
            }
        }
Esempio n. 7
0
        public FormEdit(int id)
        {
            InitializeComponent();
            patid = id;

            patient p;
            using (hc_dbEntities1 h = new hc_dbEntities1())
            {
                p = h.patient.Where(pat => pat.id_patient == patid).First();
            }

            textBox1.Text = p.FIO;
            textBox2.Text = p.Adress;
            textBox3.Text = p.tel;
            textBox4.Text = p.Safety_card.ToString();
        }
Esempio n. 8
0
 private void listView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listView1.SelectedIndices.Count != 0)
     {
         healid = healidlist[listView1.SelectedIndices[0]];
         using (hc_dbEntities1 h = new hc_dbEntities1())
         {
             textBox1.Text = h.healing.Where(hea => hea.id_healing == healid).First().diagnosis;
             textBox2.Text = h.healing.Where(hea => hea.id_healing == healid).First().drugs;
         }
     }
     else
     {
         textBox1.Text = "";
         textBox2.Text = "";
     }
 }
Esempio n. 9
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedCells[0].Style.BackColor != System.Drawing.Color.LightPink && docid != 0 && dataGridView1.SelectedCells[0].ColumnIndex != 0)
         using (hc_dbEntities1 h = new hc_dbEntities1())
         {
             healing heal = new healing();
             heal.id_doctor = docid;
             heal.id_patient = patid;
             heal.comments = richTextBox1.Text;
             heal.healing_time = GetGridDate();
             h.AddTohealing(heal);
             h.SaveChanges();
             dataGridView1.SelectedCells[0].Style.BackColor = System.Drawing.Color.LightPink;
             FillHistory();
             MessageBox.Show("Заявка подана");
         }
     else
         MessageBox.Show("Ошибка записи!");
 }
Esempio n. 10
0
 private string GetDocByID(int id)
 {
     string name;
     using (hc_dbEntities1 h = new hc_dbEntities1())
     {
         name = h.doctor.Where(doc => doc.id_doctor == id).First().FIO;
     }
     return name;
 }
Esempio n. 11
0
        private void FillProfile()
        {
            patient p;
            using (hc_dbEntities1 h = new hc_dbEntities1())
            {
                p = h.patient.Where(pat => pat.id_patient == patid).First();
            }

            label1.Text = p.FIO;
            label8.Text = p.Adress;
            label9.Text = p.tel;
            label11.Text = p.Safety_card.ToString();
        }
Esempio n. 12
0
 private void FillHistory()
 {
     dataGridView2.Rows.Clear();
     List<healing> heal;
     using (hc_dbEntities1 h = new hc_dbEntities1())
     {
         heal = h.healing.Where(hea => hea.id_patient == patid).ToList();
     }
     for (int i = 0; i < heal.Count; i++)
     {
         dataGridView2.Rows.Add();
         dataGridView2[0, i].Value = heal[i].healing_time.ToString();
         dataGridView2[0, i].ToolTipText = heal[i].healing_time.ToString();
         dataGridView2[1, i].Value = GetDocByID(heal[i].id_doctor);
         dataGridView2[1, i].ToolTipText = GetDocByID(heal[i].id_doctor);
         dataGridView2[2, i].Value = heal[i].diagnosis;
         dataGridView2[2, i].ToolTipText = heal[i].diagnosis;
         dataGridView2[3, i].Value = heal[i].drugs;
         dataGridView2[3, i].ToolTipText = heal[i].drugs;
         dataGridView2[4, i].Value = heal[i].comments;
         dataGridView2[4, i].ToolTipText = heal[i].comments;
     }
 }
Esempio n. 13
0
        private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {
            List<healing> healinglist = new List<healing>();
            docid = doctorlist[comboBox3.SelectedIndex].id_doctor;

            using (hc_dbEntities1 h = new hc_dbEntities1())
            {
                healinglist = h.healing.Where(hea => hea.id_doctor == docid).ToList();
            }

            SetGrid(healinglist);

            dataGridView1.Enabled = true;
        }
Esempio n. 14
0
        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            doctorlist = new List<doctor>();
            specid = specidlist[comboBox2.SelectedIndex];

            using (hc_dbEntities1 h = new hc_dbEntities1())
            {
                doctorlist = h.doctor.Where(doc=>doc.id_spec == specid).ToList();
            }

            comboBox3.Items.Clear();

            for (int i = 0; i < doctorlist.Count; i++)
            {
                comboBox3.Items.Add(doctorlist[i].FIO);
            }

            comboBox3.Enabled = true;
        }
Esempio n. 15
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            List<spec> speclist = new List<spec>();
            depid = comboBox1.SelectedIndex;

            using (hc_dbEntities1 h = new hc_dbEntities1())
            {
                speclist = h.spec.Where(spe=>spe.id_department == depid).ToList();
            }

            comboBox2.Items.Clear();
            specid = 0;
            comboBox3.Items.Clear();
            docid = 0;

            for (int i = 0; i < speclist.Count; i++)
            {
                comboBox2.Items.Add(speclist[i].name);
                specidlist.Add(speclist[i].id_spec);
            }

            comboBox2.Enabled = true;
        }