private void SaveUser() { if (SelectedHealthInsurance.HealthInsuranceId != 0) { HealthInsurances.Update(SelectedHealthInsurance); } else { SelectedHealthInsurance.HealthInsuranceId = HealthInsurances.Insert(SelectedHealthInsurance); } }
private void DeleteHealthInsurance() { if (SelectedHealthInsurance == null) { return; } if (SelectedHealthInsurance.HealthInsuranceId == 0) { HealthInsuranceList.Remove(SelectedHealthInsurance); SelectedHealthInsurance = null; return; } HealthInsurances.Delete(SelectedHealthInsurance.HealthInsuranceId); HealthInsuranceList.Remove(SelectedHealthInsurance); SelectedHealthInsurance = null; }
public ExaminationPrice(HealthInsurances.HealthInsurance insurance, float price) { this.insurance = insurance; this.price = price; }
private static void CreateJson(Model model) { if (model.GetType() == typeof(Doctor)) { var list = JsonConvert.DeserializeObject <List <Doctor> >(File.ReadAllText($@"{SaveLocation}\Doctor.json")); Doctors = list ?? new List <Doctor>(); Doctors.Add((Doctor)model); var convertedJson = JsonConvert.SerializeObject(Doctors, Formatting.Indented); File.WriteAllText($@"{SaveLocation}\Doctor.json", convertedJson); } else if (model.GetType() == typeof(Patient)) { var list = JsonConvert.DeserializeObject <List <Doctor> >(File.ReadAllText($@"{SaveLocation}\Doctor.json")); Doctors = list ?? new List <Doctor>(); foreach (var doctor in Doctors) { // Search current logged in doctor if (doctor.Username != Doctor.Username) { continue; } if (doctor.Patients == null) { doctor.Patients = new List <Patient>(); } // Search if patient already exists foreach (var patient in doctor.Patients) { if (patient.Key == ((Patient)model).Key) { throw new PatientAlreadyExistsExcepetion(); } } // Add then doctor.Patients.Add((Patient)model); } var convertedJson = JsonConvert.SerializeObject(Doctors, Formatting.Indented); File.WriteAllText($@"{SaveLocation}\Doctor.json", convertedJson); } else if (model.GetType() == typeof(HealthInsurance)) { var list = JsonConvert.DeserializeObject <List <HealthInsurance> >(File.ReadAllText($@"{SaveLocation}\HealthInsurances.json")); HealthInsurances = list ?? new List <HealthInsurance>(); HealthInsurances.Add((HealthInsurance)model); var convertedJson = JsonConvert.SerializeObject(HealthInsurances, Formatting.Indented); File.WriteAllText($@"{SaveLocation}\HealthInsurances.json", convertedJson); } var json = JsonConvert.SerializeObject(model); Console.WriteLine(json); }
private SvenTechCollection <HealthInsurance> LoadAllHealthInsurances() { SvenTechCollection <HealthInsurance> allHealthInsurances = new SvenTechCollection <HealthInsurance>(); return(HealthInsurances.GetAll().ToSvenTechCollection()); }
private void LoadHealthInsurances() { HealthInsuranceList = HealthInsurances.GetAll().ToSvenTechCollection(); }