public IzaberiLekara(List <BazaN.Zaposleni> lekari, BazaN.Uput uput, Uput up) { this.lekari = new List <BazaN.Zaposleni>(); this.uput = new BazaN.Uput(); this.lekari = lekari; this.lekar = new BazaN.Zaposleni(); this.uput = uput; this.up = up; InitializeComponent(); }
private void button1_Click(object sender, EventArgs e) { if (comboBox1.SelectedIndex == -1 || richTextBox1.Text == "") { MessageBox.Show("Popunite adekvatno sva polja!"); } else { var baza = new DataDataContext(); BazaN.Uput uput = new BazaN.Uput(); List <BazaN.Zaposleni> lekari = new List <BazaN.Zaposleni>(); lekari = baza.Zaposlenis.Where(x => ((x.Tip == (comboBox1.SelectedIndex + 3)) && x.Radi)).ToList(); if (lekari == null) { MessageBox.Show("Nije pronadjen zahtevan tip lekara u bazi podataka!", "Obavestenje", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } uput.Datum = dateTimePicker1.Value; uput.Id_Pacijenta = this.idPacijenta; uput.Opis = richTextBox1.Text; IzaberiLekara il = new IzaberiLekara(lekari, uput, this); il.Show(); } }
public void ucitajPacijente() { dataGridView2.DataSource = null; dataGridView1.DataSource = null; this.ListaPacijenata.Clear(); var baza = new DataDataContext(); int pacdanas = 0; List <BazaN.Uput> lu = new List <BazaN.Uput>(); lu = baza.Uputs.Where(x => (x.Id_Lekara == this.lekarId && x.Id_ZS == this.idZS)).ToList(); List <BazaN.Pregled> pg = new List <BazaN.Pregled>(); pg = baza.Pregleds.Where(x => (x.Id_Lekara == this.lekarId && x.Id_ZS == this.idZS)).ToList(); foreach (BazaN.Pregled pgd in pg) { BazaN.Uput upt = new BazaN.Uput(); upt.Id_Lekara = pgd.Id_Lekara; upt.Id_Pacijenta = pgd.Id_Pacijenta; upt.Opis = pgd.Opis; upt.Id_ZS = pgd.Id_ZS; upt.Datum = pgd.Datum; lu.Add(upt); } lu.Sort((a, b) => a.Datum.CompareTo(b.Datum)); foreach (BazaN.Uput up in lu) { if (up.Datum.Date >= this.dt.Date) { foreach (BazaN.Pacijent pc in baza.Pacijents.Where(x => x.Id == up.Id_Pacijenta)) { this.ListaPacijenata.Add(pc); if (up.Datum.Date == this.dt.Date) { pacdanas++; } } } } dataGridView1.DataSource = this.ListaPacijenata; for (int i = 0; i < pacdanas; i++) { dataGridView1.Rows[i].DefaultCellStyle.ForeColor = Color.Red; } foreach (DataGridViewColumn s in dataGridView1.Columns) { s.Visible = false; if (s.HeaderText == "Ime") { s.Visible = true; } if (s.HeaderText == "Prezime") { s.Visible = true; } if (s.HeaderText == "JMBG") { s.Visible = true; } if (s.HeaderText == "Dijagnoza") { s.Visible = true; } if (s.HeaderText == "Alergeni") { s.Visible = true; } } if (dataGridView1.SelectedRows.Count != 0) { dataGridView1.Rows[0].Cells[0].Selected = false; } }
public void promeniUredjenjePregleda() { var baza = new DataDataContext(); List <BazaN.Pregled> pregled = new List <BazaN.Pregled>(); List <BazaN.Uput> uput1 = new List <BazaN.Uput>(); List <BazaN.Uput> uput = new List <BazaN.Uput>(); DateTime datum = dateTimePicker1.Value; pregled = baza.Pregleds.Where(x => x.Id_Lekara == lekarId).ToList(); uput = baza.Uputs.Where(x => x.Id_Lekara == lekarId).ToList(); var novaListaP = pregled.OrderBy(x => x.Datum).ToList(); var novaListaU = uput.OrderBy(x => x.Datum).ToList(); foreach (var v in novaListaP) { BazaN.Uput u = new BazaN.Uput(); u.Id = v.Id; u.Id_Lekara = v.Id_Lekara; u.Id_Pacijenta = v.Id_Pacijenta; u.Id_ZS = v.Id_ZS; u.Opis = v.Opis; u.Datum = v.Datum; novaListaU.Add(u); } foreach (var v in novaListaU) { if (datum.Date <= v.Datum) { uput1.Add(v); } } var finalna = uput1.OrderBy(x => x.Datum).ToList(); dataGridView1.DataSource = finalna; foreach (DataGridViewColumn s in dataGridView1.Columns) { s.Visible = false; if (s.HeaderText == "Id") { s.Visible = true; s.Width = 40; } if (s.HeaderText == "Id_Lekara") { s.Visible = true; s.Width = 40; } if (s.HeaderText == "Id_Pacijenta") { s.Visible = true; s.Width = 40; } if (s.HeaderText == "Opis") { s.Visible = true; } if (s.HeaderText == "Id_ZS") { s.Visible = true; s.Width = 40; } if (s.HeaderText == "Datum") { s.Visible = true; } } }