Esempio n. 1
0
 public string CadastroPc(DataEntrada Entrada)
 {
     using (var connection = GetConnection())
     {
         connection.Open();
         string rpta = "";
         try
         {
             command.Connection  = connection;
             command.CommandText = "CadastroPc";
             command.CommandType = CommandType.StoredProcedure;
             command.Parameters.AddWithValue("@data_entrada", Entrada.Data);
             command.Parameters.AddWithValue("@valor", Entrada.Valor);
             command.Parameters.AddWithValue("@observacao", Entrada.Observacao);
             command.Parameters.AddWithValue("@id_tipo_entrada", Entrada.IdEntrada);
             command.Parameters.AddWithValue("@id_forma_pagamento", Entrada.IdPagamento);
             rpta = command.ExecuteNonQuery() == 1 ? "OK" : "Erro ao cadastrar";
         }
         catch (Exception ex)
         {
             rpta = ex.Message;
         }
         return(rpta);
     }
 }
Esempio n. 2
0
 public string Entrada_Delete(DataEntrada ENTRADA)
 {
     using (var connection = GetConnection())
     {
         connection.Open();
         string rpta = "";
         try
         {
             command.Connection  = connection;
             command.CommandText = "delete from tb_entrada Where id=@id_entrada";
             command.CommandType = CommandType.Text;
             command.Parameters.AddWithValue("@id_entrada", ENTRADA.IdEntrada);
             rpta = command.ExecuteNonQuery() == 1 ? "OK" : "Erro ao deletar";
         }
         catch (Exception ex)
         {
             rpta = ex.Message;
         }
         return(rpta);
     }
 }
Esempio n. 3
0
 public string UpdateSaldo(DataEntrada SALDO)
 {
     using (var connection = GetConnection())
     {
         connection.Open();
         string rpta = "";
         try
         {
             command.Connection  = connection;
             command.CommandText = "UPDATE tb_saldo_inicial SET saldo_final=@saldo_final WHERE data_entrada=@data";
             command.CommandType = CommandType.Text;
             command.Parameters.AddWithValue("@saldo_final", SALDO.SaldoFinal);
             command.Parameters.AddWithValue("@data", SALDO.Data);
             rpta = command.ExecuteNonQuery() == 1 ? "OK" : "Error";
         }
         catch (Exception ex)
         {
             rpta = ex.Message;
         }
         return(rpta);
     }
 }