public UserControlReceptionistAddPatient() { InitializeComponent(); hmsDataContext dbcon = new hmsDataContext(); Doctor_ p = new Doctor_(); metroComboBox4.DataSource = dbcon.Doctor_s; metroComboBox4.ValueMember = "DoctorName"; RoomAvailability(); }
private void metroTextButtonAddDoctorConfirm_Click(object sender, EventArgs e) { try { hmsDataContext dbcon = new hmsDataContext(); Doctor_ dc = new Doctor_(); Login_ lg = new Login_(); Salary_ sl = new Salary_(); Department dp = new Department(); dc.DoctorName = metroTextBox1.Text; dc.DoctorEmail = metroTextBox3.Text; dc.DoctorAddress = metroTextBox6.Text; dc.DoctorPhone = metroTextBox7.Text; dc.DoctorUsername = metroTextBox9.Text; dc.DoctorProfile = metroComboBox1.Text; dc.DoctorGender = metroComboBox2.Text; dc.DoctorAge = metroTextBox5.Text; dc.DoctorSalary = metroTextBox8.Text; lg.LoginPassword = metroTextBox10.Text; lg.LoginUserName = metroTextBox9.Text; lg.Profile = metroComboBox1.Text; sl.Name = metroTextBox1.Text; sl.Salary = metroTextBox8.Text; sl.Profile = metroComboBox1.Text; dc.DoctorDepartmentName = metroComboBox3.Text; dbcon.Doctor_s.InsertOnSubmit(dc); dbcon.Login_s.InsertOnSubmit(lg); dbcon.Salary_s.InsertOnSubmit(sl); dbcon.SubmitChanges(); // MessageBox.Show("Succesfully saved!!"); MetroMessageBox.Show(this, "Succesfully Saved.", "Congratulation!!!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); metroTextBox1.Clear(); metroTextBox3.Clear(); metroTextBox5.Clear(); metroTextBox6.Clear(); metroTextBox7.Clear(); metroTextBox8.Clear(); metroTextBox9.Clear(); metroTextBox10.Clear(); metroComboBox1.SelectedItem = null; metroComboBox2.SelectedItem = null; metroComboBox3.SelectedItem = null; } catch (Exception ex) { MetroMessageBox.Show(this, "Username already exist.", "Halt!!!", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); metroTextBox9.Clear(); // metroTextBox2.Clear(); } }
public UserControlDoctorProfile() { InitializeComponent(); metroPanelDoctorProfileChangePassword.Hide(); hmsDataContext dbcon = new hmsDataContext(); Doctor_ doc = dbcon.Doctor_s.SingleOrDefault(x => x.DoctorUsername == FormMain.user); metroLabel2.Text = doc.DoctorName; metroLabel7.Text = doc.DoctorAddress; metroLabel8.Text = doc.DoctorPhone; metroLabel10.Text = FormMain.user; }
void StartWorking() { #region bd подключение доктора //подключить try { if (connection.State == ConnectionState.Closed) { connection.Open(); } String query = "SELECT [DOCTOR_INFO].[ID], [DOCTOR_INFO].[Name], [DOCTOR_INFO].[Surname] FROM [DOCTOR_INFO]"; SqlCommand command = new SqlCommand(query, connection); command.CommandType = CommandType.Text; SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { int Id = reader.GetInt32(0); string Name = reader.GetString(1); string Surname = reader.GetString(2); Doctor_ doctor = new Doctor_(Id, Name + " " + Surname); doctors.Add(doctor); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { connection.Close(); } #endregion #region bd подключенеи юзера try { if (connection.State == ConnectionState.Closed) { connection.Open(); } String query = "SELECT [USER_INFO].[ID], [USER_INFO].[Name], [USER_INFO].[Surname], [USER_INFO].[Patronymic] FROM [USER_INFO]"; SqlCommand command = new SqlCommand(query, connection); command.CommandType = CommandType.Text; SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { int Id = reader.GetInt32(0); string Name = reader.GetString(1); string Surname = reader.GetString(2); string Patronymic = reader.GetString(3); User user = new User(Id, Surname + " " + Name + " " + Patronymic);//фио слияние в одну строку users.Add(user); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { connection.Close(); } #endregion //доделать поиск юзеров #region bd подключение процедур try { if (connection.State == ConnectionState.Closed) { connection.Open(); } String query = "SELECT [PROCEDURE_INFO].[Procedure], [PROCEDURE_INFO].[ID] FROM [PROCEDURE_INFO]"; SqlCommand command = new SqlCommand(query, connection); command.CommandType = CommandType.Text; SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { string Name = reader.GetString(0); int ID = reader.GetInt32(1); Procedure procedure = new Procedure(Name, ID); procedures.Add(procedure); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { connection.Close(); } #endregion }