Exemple #1
0
        public EditPatientForm()
        {
            InitializeComponent();
            DeklaracjeTableAdapter deklaracjeTableAdapter = new DeklaracjeTableAdapter();
            WizytyTableAdapter     wizytyTableAdapter     = new WizytyTableAdapter();

            dataGridView2.DataSource = deklaracjeTableAdapter.GetDataByJoin();
            dataGridView3.DataSource = wizytyTableAdapter.GetDataByJoin();

            dataGridView2.Columns["ID"].Visible         = false;
            dataGridView2.Columns["IdPacjenta"].Visible = false;
            dataGridView2.Columns["IdLekarza"].Visible  = false;

            dataGridView3.Columns["ID"].Visible         = false;
            dataGridView3.Columns["IdLekarza"].Visible  = false;
            dataGridView3.Columns["IdPacjenta"].Visible = false;
            dataGridView3.Columns["KodICD"].Visible     = false;


            comboBox1.DataSource    = this.pacjenciTableAdapter.GetDataByCombo();
            comboBox1.DisplayMember = "Pacjent";
            comboBox1.ValueMember   = "ID";
            comboBox2.DataSource    = this.lekarzeTableAdapter.GetDataByCombo();
            comboBox2.DisplayMember = "Lekarz";
            comboBox2.ValueMember   = "ID";
            comboBox3.DataSource    = this.pacjenciTableAdapter.GetDataByCombo();
            comboBox3.DisplayMember = "Pacjent";
            comboBox3.ValueMember   = "ID";
            comboBox4.DataSource    = this.lekarzeTableAdapter.GetDataByCombo();
            comboBox4.DisplayMember = "Lekarz";
            comboBox4.ValueMember   = "ID";
            comboBox5.DataSource    = this.iCDTableAdapter.GetData();
            comboBox5.DisplayMember = "Nazwa";
            comboBox5.ValueMember   = "ID";
        }
Exemple #2
0
        private void insertWButton_Click(object sender, EventArgs e)
        {
            WizytyTableAdapter wizytyTableAdapter = new WizytyTableAdapter();

            try
            {
                wizytyTableAdapter.InsertQuery(dateTimePicker3.Value.Date, Convert.ToInt32(comboBox3.SelectedValue), Convert.ToInt32(comboBox4.SelectedValue), Convert.ToInt32(comboBox5.SelectedValue), textBox10.Text);
                comboBox3.SelectedIndex = -1;
                comboBox4.SelectedIndex = -1;
                comboBox5.SelectedIndex = -1;
                dateTimePicker3.Text    = DateTime.Now.ToShortDateString();
                MessageBox.Show("Wizyta została pomyślne dodana do bazy danych.");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Błąd podczas zapisywania wizyty do bazy danych.");
            }
            dataGridView3.DataSource = wizytyTableAdapter.GetDataByJoin();
            dataGridView3.Refresh();
        }