示例#1
0
        private void SaveReg()
        {
            GTI_Models.Models.Lancamento reg = new GTI_Models.Models.Lancamento {
                Descfull  = txtCompleto.Text,
                Descreduz = txtResumido.Text,
                Tipolivro = Convert.ToInt16(cmbLivro.SelectedValue)
            };
            Tributario_bll clsTributario = new Tributario_bll(_connection);
            Exception      ex;

            if (bAddNew)
            {
                ex = clsTributario.Insert_Lancamento(reg);
            }
            else
            {
                reg.Codlancamento = Convert.ToInt16(lstMain.SelectedValue);
                ex = clsTributario.Alterar_Lancamento(reg);
            }
            if (ex != null)
            {
                ErrorBox eBox = new ErrorBox("Atenção", ex.Message, ex);
                eBox.ShowDialog();
            }
            else
            {
                Carrega_Lista();
                ControlBehaviour(true);
            }
        }
示例#2
0
 private void BtDel_Click(object sender, EventArgs e)
 {
     if (lstMain.SelectedItem == null)
     {
         return;
     }
     if (MessageBox.Show("Excluir este lançamento?", "Confirmação", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         Tributario_bll clsTributario     = new Tributario_bll(_connection);
         GTI_Models.Models.Lancamento reg = new GTI_Models.Models.Lancamento {
             Codlancamento = Convert.ToInt16(lstMain.SelectedValue.ToString())
         };
         Exception ex = clsTributario.Excluir_Lancamento(reg);
         if (ex != null)
         {
             ErrorBox eBox = new ErrorBox("Atenção", ex.Message, ex);
             eBox.ShowDialog();
         }
         else
         {
             Carrega_Lista();
         }
     }
 }