static bool checkLekarzData(PulaRecept pulaRecept, Doctor lekarz) { try { } catch (Exception e) { Console.WriteLine(e); return(false); } return(true); }
static bool insertToDb(PulaRecept pulaRecept, List <PrescriptionNumber> nrReceptyList) { try { Model1 model = new Model1(); model.PulaRecept.Add(pulaRecept); model.PrescriptionNumber.AddRange(nrReceptyList); model.SaveChanges(); } catch (Exception e) { Console.WriteLine(e); return(false); } return(true); }
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); }
public PrescriptionNumber(string number, PulaRecept prescriptionList) { Number = number; PrescriptionList = prescriptionList; Used = false; }
void prescriptionListImport() { string path = openFile("Pliki XMZ|*.xmz"); PulaRecept.importFromXML(path); }
private void policzNryReceptToolStripMenuItem_Click(object sender, EventArgs e) { string path = openFile("Pliki XML|*.xml"); MessageBox.Show(PulaRecept.countElements(path).ToString()); }
void getPrescriptionList() { tabControl1.SelectedTab = tabPage3; dataGridView3.DataSource = PulaRecept.getAll(); }