예제 #1
0
        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();
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
 public VisitEconomicCtrl(DataModels.Visit visit)
 {
     InitializeComponent();
     this.Visit = visit;
 }
예제 #5
0
 public VisitMedicalCtrl(DataModels.Visit visit)
 {
     InitializeComponent();
     this.Visit = visit;
 }