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(); } }
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(); }
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Пароли не совпадают."); }
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("Ошибка записи!"); }