Exemplo n.º 1
0
        private void txtAnticipo_Leave(object sender, EventArgs e)
        {
            decimal valore;

            HelpForm.ExtLeaveDecTextBox(txtAnticipo, "x.y");
            string strvalore = txtAnticipo.Text.Trim();

            if (strvalore == "")
            {
                importo = 0;
                return;
            }
            try {
                valore = (decimal)HelpForm.GetObjectFromString(
                    typeof(decimal), txtAnticipo.Text
                    , "x.y");
                txtAnticipo.Text = valore.ToString("c");
                if ((valore < 0))
                {
                    MessageBox.Show("L'importo non può essere negativo");
                    txtAnticipo.Focus();
                    return;
                }
                importo = valore;
            }
            catch {
                MessageBox.Show("E' necessario inserire un importo valido");
                txtAnticipo.Focus();
                importo = 0;
                return;
            }
        }
Exemplo n.º 2
0
        private void txtRedditoComplessivo_Leave(object sender, EventArgs e)
        {
            if (inChiusura)
            {
                return;
            }
            HelpForm.ExtLeaveDecTextBox(txtRedditoComplessivo, "x.y");
            int     esercizio = CfgFn.GetNoNullInt32(Conn.GetSys("esercizio"));
            decimal rc        = CfgFn.GetNoNullDecimal(HelpForm.GetObjectFromString(typeof(decimal), txtRedditoComplessivo.Text, "x.y"));
            string  errMess;
            decimal acconto = CalcoliCococo.calcolaAccontoAddCom(Conn, esercizio, idcity, idser, rc, out errMess);

            if (errMess == null)
            {
                txtAcconto.Text = acconto.ToString("c");
            }
            else
            {
                MessageBox.Show("Non è stato possibile calcolare l'acconto perché si è verificato il seguente errore\r\n" + errMess);
            }
        }