Ejemplo n.º 1
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            _priceLists.Clear();
            _treatMentLists.Clear();

            using (var db = new Db.PhisioDB())
            {
                _therapist.FullName   = textBoxName.Text;
                _therapist.Email      = textBoxEmail.Text;
                _therapist.FiscalCode = textBoxCf.Text;
                _therapist.Iban       = textBoxIban.Text;
                _therapist.TaxNumber  = textBoxPiva.Text;
                _therapist.Address    = textBoxAddress.Text;
                _therapist.AddressDe  = textBoxAddressDe.Text;
                _therapist.Aifi       = textBoxAifi.Text;
                _therapist.SaveToDB();

                foreach (var a in priceListBindingSource)
                {
                    var price = (PriceList)a;
                    price.TherapistId = _therapist.Id;
                    price.SaveToDB();
                    _priceLists.Add(price);
                }
                foreach (var t in treatmentBindingSource)
                {
                    var treatment = (Treatment)t;
                    treatment.TherapistId = _therapist.Id;
                    treatment.SaveToDB();
                    _treatMentLists.Add(treatment);
                }

                FillDataBindings();
            }
        }