public VisitCtrl(DataModels.Customer customer, DataModels.Visit visit) { InitializeComponent(); _visit = visit; _customer = customer; if (_visit == null || _visit.Id == null || _visit.Id == Guid.Empty) { button1.Visible = false; } else { button1.Visible = true; } using (var db = new Db.PhisioDB()) { _therapist = db.Therapists.FirstOrDefault(); _treatments = db.Treatments.ToList(); foreach (var treatment in _treatments) { this.checkedListBox1.DisplayMember = "DescriptionIt"; if (_customer.Language == "german") { this.checkedListBox1.DisplayMember = "DescriptionDe"; } this.checkedListBox1.Items.Add(treatment, false); } } FillVisitFields(); }
private void buttonSave_Click(object sender, EventArgs e) { double tot = _visitNr == 0 ? 0.0 : (_visitTot / _visitNr); if (tot == 0) { MessageBox.Show("Non è possiblie salvare visite a costo 0", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } for (int i = 0; i < _visitNr; i++) { var visit = new DataModels.Visit(); visit.Date = new NpgsqlTypes.NpgsqlDate(2060, 1, 1); visit.Customer = _customer; visit.CustomerId = _customer.Id; visit.Price = tot; visit.StartTime = "08:00"; visit.Future = true; visit.TherapistId = _therapist.Id; visit.SaveToDB(); visit = ManageChecking(visit); visit.SaveToDB(); } MessageBox.Show($"Sono state create {_visitNr} visite future", "Terminato", MessageBoxButtons.OK, MessageBoxIcon.Information); VisitCreated?.Invoke(this, e); }
private DataModels.Visit ManageChecking(DataModels.Visit visit) { var items = checkedListBox1.CheckedItems; visit.Treatmentsvisitidfkeys = Enumerable.Empty <DataModels.VisitsTreatment>(); List <DataModels.VisitsTreatment> a = new List <DataModels.VisitsTreatment>(); foreach (var item in items) { a.Add(new DataModels.VisitsTreatment { Treatment = (DataModels.Treatment)item, TreatmentId = ((DataModels.Treatment)item).Id, Visit = visit, VisitId = visit.Id }); } visit.Treatmentsvisitidfkeys = a; return(visit); }
public VisitEconomicCtrl(DataModels.Visit visit) { InitializeComponent(); this.Visit = visit; }
public VisitMedicalCtrl(DataModels.Visit visit) { InitializeComponent(); this.Visit = visit; }