Esempio n. 1
0
        private void checkBox2_CheckedChanged(object sender, EventArgs e)
        {
            if (!_loaded)
            {
                return;
            }

            if (_autoClick)
            {
                _autoClick = false;
                return;
            }

            if ((bool)Visit.Invoiced)
            {
                _autoClick = true;
                MessageBox.Show("La visita può essere pagata solo attraverso il pagamento della fattura", "Fatturazione", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                checkBox2.Checked = !checkBox2.Checked;
                return;
            }
            using (var db = new Db.PhisioDB())
            {
                if (Visit.Id != null)
                {
                    Visit.Payed = checkBox2.Checked;
                    db.Update(Visit);
                    ChangePayed?.Invoke(this, e);
                }
            }
        }
Esempio n. 2
0
        private void checkBox2_CheckedChanged(object sender, EventArgs e)
        {
            if (!_loaded)
            {
                return;
            }

            using (var db = new Db.PhisioDB())
            {
                if (ProformaInvoice.Id != null)
                {
                    ProformaInvoice.Payed = checkBox2.Checked;
                    foreach (var visit in ProformaInvoice.Visitsproformainvoiceidfkeys)
                    {
                        visit.Payed = checkBox2.Checked;
                        db.Update(visit);
                    }

                    db.Update(ProformaInvoice);
                    ChangePayed?.Invoke(this, e);
                }
            }
        }