public Prescription(PrescriptionNumber prescriptionNumber, Patient patient, Doctor doctor, Lek[] leki) { PrescriptionNumberId = prescriptionNumber.PrescriptionNumberId; PatientId = patient.PatientId; DoctorId = doctor.DoctorId; DateOfIssue = DateTime.Now; Leki = leki; }
private void button3_Click(object sender, EventArgs e) { Model1 model = new Model1(); Doctor doctor = model.Doctor.FirstOrDefault(); Lek[] drugList = DrugView.convertDrugViewToDrug(list); Prescription prescription = new Prescription(PrescriptionNumber.getUnusedNumber("Rp"), patient, doctor, drugList); //FrmPrescriptionPreview frmPrescriptionPreview = new FrmPrescriptionPreview(prescription); //frmPrescriptionPreview.Show(); }
public static PrescriptionNumber getUnusedNumber(string category) { try { Model1 model = new Model1(); PrescriptionNumber prescriptionNumber = model.PrescriptionNumber.Where(p => p.Used == false && p.PrescriptionList.Kategoria == category).FirstOrDefault(); setNumberUsed(prescriptionNumber); return(prescriptionNumber); } catch (Exception e) { return(null); } }
public static bool setNumberUsed(PrescriptionNumber prescriptionNumber) { try { Model1 model = new Model1(); prescriptionNumber.Used = true; model.Entry(prescriptionNumber).State = EntityState.Modified; model.SaveChanges(); return(true); } catch (Exception e) { Diagnostics.insertToDb(new Diagnostics("PrescriptionNumber.setNumberUsed()", e.ToString())); return(false); } }
void createPrescription() { Model1 model = new Model1(); Doctor doctor = model.Doctor.FirstOrDefault(); Lek[] drugList = DrugView.convertDrugViewToDrug(list); PrescriptionNumber prescriptionNumber = PrescriptionNumber.getUnusedNumber("Rp"); if (prescriptionNumber != null) { Prescription prescription = new Prescription(prescriptionNumber, patient, doctor, drugList); prescription.insertToDb(); } else { MessageBox.Show("Brak wolnych numerów recept!"); } }
public static bool importFromXML(string path) { try { string filename = unzip(path); string tempDir = "temp"; XDocument doc = XDocument.Load(tempDir + @"\" + filename); List <PrescriptionNumber> nrReceptyList = new List <PrescriptionNumber>(); XElement elemRec = doc.Element("recepty"); XElement elemLek = doc.Element("recepty").Element("lekarz"); string typ = elemRec.Attribute("typ").Value; string kategoria = elemRec.Attribute("kat").Value; string imieNazwisko = elemLek.Attribute("imie_nazw").Value; string pesel = elemLek.Attribute("pesel").Value; string nrPrawa = elemLek.Attribute("pr_zawod").Value; int iloscRecept = Int32.Parse(elemLek.Attribute("il_rec").Value); PulaRecept pulaRecept = new PulaRecept(typ, kategoria, nrPrawa, pesel, imieNazwisko, iloscRecept); //int count=countElements(path); //int i = 0; foreach (XElement elem in elemLek.Elements("n")) { string numer = elem.Value; PrescriptionNumber nrRecepty = new PrescriptionNumber(numer, pulaRecept); nrReceptyList.Add(nrRecepty); //Console.WriteLine(i.ToString()+@"/"+count.ToString()); } insertToDb(pulaRecept, nrReceptyList); deleteTemporaryFiles(); } catch (Exception e) { return(false); } return(true); }
private void oznaczNrJakoWykorzystanyToolStripMenuItem_Click(object sender, EventArgs e) { PrescriptionNumber.setNumberUsed(PrescriptionNumber.getUnusedNumber("Rp")); }
private void getPrescriptionNumbers() { tabControl1.SelectedTab = tabPage3; dataGridView3.DataSource = PrescriptionNumber.getAll(); }