public void deleteItem(object p) { iPatient patient = (iPatient)p; StreamReader tr = new StreamReader(path, Encoding.GetEncoding("iso-8859-1")); int lineNumber = 0; string line = tr.ReadLine(); string[] s = { "-1" }; while (line != null && int.Parse(s[0]) != patient.ID) { lineNumber++; s = line.Split(';'); line = tr.ReadLine(); } tr.Close(); if (lineNumber == 0 && s[0] == "-1") { throw new System.Exception(); } else { string stringPatient = ""; stringPatient += patient.ID + ";" + patient.Name + ";" + patient.MothersName + ";" + patient.Note + ";" + patient.isMyPatient.ToString() + ";1"; lineChanger(stringPatient, lineNumber); } getItemList(); }
public void addItem(iPatient patient) { string stringPatient = ""; stringPatient += this.lastDataItem++ + ";" + patient.Name + ";" + patient.MothersName + ";" + patient.Note + ";" + patient.isMyPatient.ToString().ToLower() + ";0"; File.AppendAllText(path, stringPatient + Environment.NewLine); getItemList(); }
public PatientWindow(iPatient patient) { InitializeComponent(); pVM = new PatientWindowViewModell(patient); this.DataContext = this.pVM; }