private void populateReport(string UID) { PatientReport report = new PatientReport(); using (BDISAppMedicalConditions db = new BDISAppMedicalConditions()) { var data = from patient in db.MedicalConditions where patient.Patient_UID == UID select patient; report.SetDataSource(data.ToList()); reportViewer.ReportSource = report; reportViewer.RefreshReport(); } }
private void modAddAfec_Click(object sender, EventArgs e) { using (BDISAppMedicalConditions db = new BDISAppMedicalConditions()) { MedicalConditions mC = new MedicalConditions(); mC.Afectiune = modTxtAfec.Text; mC.Data = afecDate.Value; mC.Patient_UID = patientUID.ToString(); mC.Entry_UID = Guid.NewGuid(); db.MedicalConditions.Add(mC); if (db.SaveChanges() > 0) { MetroFramework.MetroMessageBox.Show(this, "Inregistrarea a fost adaugata.", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MetroFramework.MetroMessageBox.Show(this, "Inregistrarea nu s-a putut adauga in baza de date.", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnDeletePatient_Click(object sender, EventArgs e) { var CNP = long.Parse(patientSearchBox.Text); using (BDISPatients db = new BDISPatients()) { var patientToRemove = db.Patients.SingleOrDefault(x => x.CNP == CNP); user_UID = patientToRemove.UID.ToString(); if (patientToRemove != null) { db.Patients.Remove(patientToRemove); db.SaveChanges(); patientSearchGrid.Hide(); MetroFramework.MetroMessageBox.Show(this, "Pacientul a fost sters.", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } } using (BDISAppMedicalConditions db = new BDISAppMedicalConditions()) { db.MedicalConditions.RemoveRange(db.MedicalConditions.Where(x => x.Patient_UID == user_UID)); db.SaveChanges(); } }