Beispiel #1
0
 public frmDespesaControlar(Usuario user)
 {
     InitializeComponent();
     this.user = user;
     desp = new Despesa();
     util = new Utils();
     cbbSituação.Text = "Todas";
     chkPeriodo.Checked = true;
     dtpInicio.Value = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
     dtpFim.Value = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 30);
     dtDesp = desp.consulta(dtpInicio.Value.ToShortDateString(), dtpFim.Value.ToShortDateString(), cbbSituação.Text, ttbDesc.Text, false);
     dtgvDesp.DataSource = dtDesp;
     getInfos();
 }
Beispiel #2
0
 public bool atualizar(Despesa desp)
 {
     sql = "UPDATE despesa SET desp_desc='@1', desp_valor='@2', desp_dtpg=@3, desp_dtvenc='@4', " +
         "desp_valorpg=@5 WHERE desp_id = @6";
     if (desp.DtPgmto == "")
     {
         sql = sql.Replace("@3", "null");
         sql = sql.Replace("@5", "null");
     }
     else
     {
         sql = sql.Replace("@3", "'"+desp.DtPgmto+"'");
         sql = sql.Replace("@5", "'"+desp.ValorPg+"'");
     }
     sql = sql.Replace("@1", desp.Desc);
     sql = sql.Replace("@2", desp.Valor);
     sql = sql.Replace("@4", desp.DtVcmto);
     sql = sql.Replace("@6", desp.Id);
     bco.conecta();
     result = bco.executeNonQuery(sql);
     bco.desconecta();
     return result;
 }
Beispiel #3
0
        public Despesa getById()
        {
            Despesa desp = new Despesa();
            DataTable aux = despBD.getById(id);
            if (aux.Rows.Count > 0)
            {
                desp.Id = aux.Rows[0]["desp_id"].ToString();
                desp.Desc = aux.Rows[0]["desp_desc"].ToString();
                desp.DtPgmto = aux.Rows[0]["desp_dtpg"].ToString();
                desp.DtVcmto = aux.Rows[0]["desp_dtvenc"].ToString();
                desp.Valor = aux.Rows[0]["desp_valor"].ToString();
                desp.ValorPg = aux.Rows[0]["desp_valorpg"].ToString();
            }

            return desp;
        }
Beispiel #4
0
 public bool nova(Despesa desp)
 {
     String sql2 = "";
     String paramAdd = "";
     if (desp.DtPgmto != "")
     {
         sql2 = ", desp_dtpg, desp_valorpg";
         paramAdd = ", '@4', '@5'";
     }
     sql = "INSERT INTO despesa(desp_desc, desp_valor, desp_dtvenc " + sql2 + ") " +
         "VALUES ('@1', '@2', '@3'" + paramAdd + ")";
     sql = sql.Replace("@1", desp.Desc);
     sql = sql.Replace("@2", desp.Valor);
     sql = sql.Replace("@3", desp.DtVcmto);
     sql = sql.Replace("@4", desp.DtPgmto);
     sql = sql.Replace("@5", desp.ValorPg);
     bco.conecta();
     result = bco.executeNonQuery(sql);
     bco.desconecta();
     return result;
 }
Beispiel #5
-1
 public frmDespesaNova(Usuario user, String despId)
 {
     InitializeComponent();
     this.user = user;
     desp = new Despesa();
     util = new Utils();
     util.moneyMaskFormata(ttbValorPgmto);
     util.moneyMaskFormata(ttbValor);
     if (despId != "")
     {
         this.Text = "Alterar Despesa";
         desp.Id = despId;
         desp = desp.getById();
         ttbDesc.Text = desp.Desc;
         ttbValor.Text = desp.Valor;
         if (desp.DtPgmto != "")
         {
             rbPaga.Checked = true;
             gpbPagamento.Enabled = true;
             ttbValorPgmto.Text = desp.ValorPg;
             dtpPagamento.Value = DateTime.Parse(desp.DtPgmto);
         }
         else
             rbApagar.Checked = true;
         dtpVcmto.Value = DateTime.Parse(desp.DtVcmto);
     }
     else
         rbApagar.Checked = true;
     util.setCamposObrigatorios(Controls);
 }