public ConsultationForm(int testid, DateTime date, int sel_type, mode _m) { InitializeComponent(); ctx = new TubDataBaseEntities(); m = _m; ctx.ConsultationType.Load(); consultationTypeBindingSource.DataSource = ctx.ConsultationType.Local.ToBindingList(); test = testid; typeCB.SelectedValue = sel_type; typeCB.Enabled = false; con = (from c in ctx.Consultation where (c.cons_id == testid) select c).FirstOrDefault(); if (m == mode.Redact) { this.StatusL.Text = "Завершено " + date.ToShortDateString(); LoadTest(testid); } else if (m == mode.Create) { this.StatusL.Text = "Закінчити тест за " + date.ToShortDateString(); } else if (m == mode.Losed) { this.StatusL.Text = "Пропущений тест за " + date.ToShortDateString(); } }
private void DeletePatientBut_Click(object sender, EventArgs e) { ctx.Dispose(); ctx = new TubDataBaseEntities(); ctx.Patients.Load(); DialogResult d = MessageBox.Show("Ви впевнені, що бажаєте видалити цього пацієнта?", "Видалення", MessageBoxButtons.YesNo); if (d == DialogResult.Yes) { var p = (from c in ctx.Patients where (c.p_id == patient.p_id) select c).FirstOrDefault(); int a = (from c in ctx.BlTest___Patient where (c.bltp_patid == patient.p_id) select c).Count() + (from c in ctx.UrTest__Patient where (c.utp_patid == patient.p_id) select c).Count() + (from c in ctx.HepTest___Patient where (c.htp_patid == patient.p_id) select c).Count() + (from c in ctx.SputumTest___Patient where (c.sptp_patid == patient.p_id) select c).Count() + (from c in ctx.Consult___Patient where (c.cp_patid == patient.p_id) select c).Count(); if (a == 0) { ctx.Patients.Remove(p); ctx.SaveChanges(); MessageBox.Show("Пацієнта видалено"); this.DialogResult = DialogResult.OK; } else { MessageBox.Show("До пацієнта прив'язані аналізи, видаляти заборонено"); } } }
public AnalysisViewer(DataLibrary.TubDataBaseEntities _ctx, Patients _pat) { InitializeComponent(); ctx = _ctx; pat = _pat; ctx.ConsultationType.Load(); docCB.DataSource = ctx.ConsultationType.Local.ToBindingList(); blood = new Blood(pat, BloodDGV, StateFCB); urina = new Urina(pat, UrinaDGV, StateFCB); hepatic = new Hepatic(pat, HepaticDGV, StateFCB); sputum = new Sputum(pat, SputumDGV, StateFCB); cons = new Consultations(pat, ConsDGV, StateFCB, docCB); StateFCB.SelectedIndex = 0; PlanBloodDT.MinDate = DateTime.Today; PlanUrDT.MinDate = DateTime.Today; PlanHepatDT.MinDate = DateTime.Today; PlanSputDT.MinDate = DateTime.Today; PlanConsDT.MinDate = DateTime.Today; this.BloodDGV.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.BloodDGV_CellContentClick); this.UrinaDGV.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.UrinaDGV_CellContentClick); this.HepaticDGV.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.HepaticDGV_CellContentClick); this.SputumDGV.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.SputumDGV_CellContentClick); this.ConsDGV.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.ConsDGV_CellContentClick); Renew(); }
public void ClearFilter() { foreach (Control c in this.Controls) { if (c is TextBox) { c.Text = ""; c.Enabled = false; } else if (c is ComboBox) { ((ComboBox)c).SelectedIndex = 0; c.Enabled = false; } else if (c is DateTimePicker) { ((DateTimePicker)c).Value = DateTime.Today.Date; c.Enabled = false; } } ctx.Dispose(); ctx = new TubDataBaseEntities(); ctx.Patients.Load(); bind.DataSource = ctx.Patients.Local.ToBindingList(); }
private void Search() { ctx.Dispose(); ctx = new TubDataBaseEntities(); var query = (from c in ctx.Patients select c); if (SurnameTB.Enabled == true) { query = query.Where(c => c.p_surname.Contains(SurnameTB.Text)); } if (NameTB.Enabled == true) { query = query.Where(c => c.p_name.Contains(NameTB.Text)); } if (GenderCB.Enabled == true) { query = query.Where(c => c.p_genderId == (int)GenderCB.SelectedValue); } if (BirthDT.Enabled == true) { query = query.Where(c => c.p_birthday == (DateTime)BirthDT.Value.Date); } if (DiagnosisCB.Enabled == true) { query = query.Where(c => c.p_diagnosisId == (int)DiagnosisCB.SelectedValue); } if (TypeCB.Enabled == true) { query = query.Where(c => c.p_typeId == (int)TypeCB.SelectedValue); } if (BKCB.Enabled == true) { query = query.Where(c => c.p_bkID == (int)BKCB.SelectedValue); } if (DestructionCB.Enabled == true) { query = query.Where(c => c.p_destructionId == (int)DestructionCB.SelectedValue); } if (BegDT.Enabled == true) { query = query.Where(c => c.p_firstVisit == (DateTime)BegDT.Value.Date); } if (EndDT.Enabled == true) { query = query.Where(c => c.p_firstVisit == (DateTime)EndDT.Value.Date); } if (ResultDT.Enabled == true) { query = query.Where(c => c.p_result == ResultDT.Text); } query.Load(); bind.DataSource = ctx.Patients.Local.ToBindingList(); if (xmlChB.Checked == true) { FormXml(query.ToList()); } }
public PatientForm(DataLibrary.Patients _patient, DataLibrary.TubDataBaseEntities _ctx) { InitializeComponent(); m = mode.View; patient = _patient; ctx = _ctx; }
public AbstractTest(Patients _pat, DataGridView d, ComboBox c) { ctx = new DataLibrary.TubDataBaseEntities(); pat = _pat; dgv = d; box = c; data = (BindingSource)dgv.DataSource; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); //settings this.PatientsListDGV.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.PatientsListDGV_CellContentClick); ctx = new DataLibrary.TubDataBaseEntities(); ctx.Gender.Load(); this.genderBindingSource.DataSource = ctx.Gender.Local.ToBindingList(); filter.Init(PatientsListDGV); SetLosed(); }
private void LoadCtx() { ctx = new TubDataBaseEntities(); ctx.Gender.Load(); this.genderBindingSource.DataSource = ctx.Gender.Local.ToBindingList(); ctx.Diagnosis.Load(); this.diagnosisBindingSource.DataSource = ctx.Diagnosis.Local.ToBindingList(); ctx.Type.Load(); this.typeBindingSource.DataSource = ctx.Type.Local.ToBindingList(); ctx.BK.Load(); this.bKBindingSource.DataSource = ctx.BK.Local.ToBindingList(); ctx.Destruction.Load(); this.destructionBindingSource.DataSource = ctx.Destruction.Local.ToBindingList(); }
public UrinaTestForm(int testid, DateTime date, mode _m) { InitializeComponent(); ctx = new TubDataBaseEntities(); m = _m; test = testid; ur = (from c in ctx.UrineTest where (c.urtest_id == testid) select c).FirstOrDefault(); if (m == mode.Redact) { this.StatusL.Text = "Завершено " + date.ToShortDateString(); LoadTest(testid); } else if (m == mode.Create) { this.StatusL.Text = "Закінчити тест за " + date.ToShortDateString(); } else if (m == mode.Losed) { this.StatusL.Text = "Пропущений тест за " + date.ToShortDateString(); } }
public PatientForm(DataLibrary.TubDataBaseEntities _ctx) { InitializeComponent(); m = mode.Create; ctx = _ctx; }