private void SetupAssemblyDbCommands() { _assemblySelect = new FbCommand { CommandText = @"select ""id"" from ""dbkeepernet_assembly"" where ""assembly"" = @assembly", CommandType = CommandType.Text }; var assemblySelect = _assemblySelect.CreateParameter(); assemblySelect.ParameterName = "@assembly"; _assemblySelect.Parameters.Add(assemblySelect); _assemblyInsert = new FbCommand { CommandText = @"insert into ""dbkeepernet_assembly"" (""assembly"", ""created"") values(@assembly, current_timestamp) returning ""id""", CommandType = CommandType.Text }; var assembly = _assemblySelect.CreateParameter(); assembly.ParameterName = "@assembly"; _assemblyInsert.Parameters.Add(assembly); }
private static void CreateParameter(FbCommand cmd, DataColumn col, string par_name) { FbParameter par = cmd.CreateParameter() as FbParameter; par.ParameterName = "@" + par_name; par.DbType = Func.TypeToDbType(col.DataType); par.Direction = ParameterDirection.Input; par.IsNullable = col.AllowDBNull; cmd.Parameters.Add(par); }
private void SetupVersionDbCommands() { _versionSelect = new FbCommand { CommandText = @"select ""id"" from ""dbkeepernet_version"" where ""dbkeepernet_assembly_id"" = @assemblyId and ""version"" = @version", CommandType = CommandType.Text }; var assemblyIdSelect = _assemblySelect.CreateParameter(); assemblyIdSelect.ParameterName = "@assemblyId"; var versionSelect = _assemblySelect.CreateParameter(); versionSelect.ParameterName = "@version"; _versionSelect.Parameters.Add(assemblyIdSelect); _versionSelect.Parameters.Add(versionSelect); _versionInsert = new FbCommand { CommandText = @"insert into ""dbkeepernet_version"" (""dbkeepernet_assembly_id"", ""version"", ""created"") values(@assemblyId, @version, current_timestamp) returning ""id""", CommandType = CommandType.Text }; var assemblyId = _assemblySelect.CreateParameter(); assemblyId.ParameterName = "@assemblyId"; var version = _assemblySelect.CreateParameter(); version.ParameterName = "@version"; _versionInsert.Parameters.Add(assemblyId); _versionInsert.Parameters.Add(version); }
public int Save(PRODUTOSFASTEntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("SAV_PRODUTOFAST", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("SAV_PRODUTOFAST", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; if (Entity.CODIGO_PRODUTO != -1) { dbCommand.Parameters.AddWithValue("@CODIGO_PRODUTO", Entity.CODIGO_PRODUTO); //PrimaryKey } else { dbCommand.Parameters.AddWithValue("@CODIGO_PRODUTO", DBNull.Value); //PrimaryKey } dbCommand.Parameters.AddWithValue("@REFERENCIA_PRODUTO", Entity.REFERENCIA_PRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@CODIGO_FABRICANTE", Entity.CODIGO_FABRICANTE); //Coluna dbCommand.Parameters.AddWithValue("@NOME_PRODUTO", Entity.NOME_PRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@S_DESCRICAO_PRODUTO", Entity.S_DESCRICAO_PRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@DESCRICAO_PRODUTO", Entity.DESCRICAO_PRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@TIPO_PRODUTO", Entity.TIPO_PRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@UNIDADE_PRODUTO", Entity.UNIDADE_PRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@ACS_VALORPRODUTO", Entity.ACS_VALORPRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@AGR_PRODUTOVENDA", Entity.AGR_PRODUTOVENDA); //Coluna dbCommand.Parameters.AddWithValue("@ACS_QTDPRODUTO", Entity.ACS_QTDPRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@IMAGEM_PRODUTO", Entity.IMAGEM_PRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@TESTE", Entity.TESTE); //Coluna dbCommand.Parameters.AddWithValue("@CODIGO_TIPOTRIBUTACAO", Entity.CODIGO_TIPOTRIBUTACAO); //Coluna dbCommand.Parameters.AddWithValue("@PERCTRIBUT_PRODUTO", Entity.PERCTRIBUT_PRODUT); //Coluna dbCommand.Parameters.AddWithValue("@CODIGO_CATEGORIA", Entity.CODIGO_CATEGORIA); //Coluna dbCommand.Parameters.AddWithValue("@MARCA_PRODUTO", Entity.MARCA_PRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@LOCALIZACAO_PRODUTO", Entity.LOCALIZACAO_PRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@ATIVO_PRODUTO", Entity.ATIVO_PRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@ID_NCM", Entity.ID_NCM); //Coluna dbCommand.Parameters.AddWithValue("@CODIGO_NCM", Entity.CODIGO_NCM); //Coluna dbCommand.Parameters.AddWithValue("@DESCRICAO_NCM", Entity.DESCRICAO_NCM); //Coluna dbCommand.Parameters.AddWithValue("@PERCIPI_PRODUTO", Entity.PERCIPI_PRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@COFINS_PRODUTO", Entity.COFINS_PRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@PERCPIS_PRODUTO", Entity.PERCPIS_PRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@PESOBRUTO_PRODUTO", Entity.PESOBRUTO_PRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@PESOLIQUIDO_PRODUTO", Entity.PESOLIQUIDO_PRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@PERCSBRVENDA_PRODUTO", Entity.PERCSBRVENDA_PRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@STAPERCSBRVDA_PRODUTO", Entity.STAPERCSBRVDA_PRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@REPLICAR_PRODUTO", Entity.REPLICAR_PRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@CODIGO_EMPRESA", Entity.CODIGO_EMPRESA); //Coluna dbCommand.Parameters.AddWithValue("@LERPESO_PRODUTO", Entity.LERPESO_PRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@CODIGO_FORNECEDOR", Entity.CODIGO_FORNECEDOR); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@CODIGO_PRODUTO"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@CODIGO_PRODUTO"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(ENDENTREGARCLIENTEEntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_ENDENTREGARCLIENTE", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_ENDENTREGARCLIENTE", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; //PrimaryKey com valor igual a null, indica um novo registro, //o valor da chave será fornecido pelo banco. Qualquer outro valor indicará edição do registro. if (Entity.IDENDENTREGARCLIENTE == -1) { dbCommand.Parameters.AddWithValue("@IDENDENTREGARCLIENTE", DBNull.Value); } else { dbCommand.Parameters.AddWithValue("@IDENDENTREGARCLIENTE", Entity.IDENDENTREGARCLIENTE); } if (Entity.IDCLIENTE != null) { dbCommand.Parameters.AddWithValue("@IDCLIENTE", Entity.IDCLIENTE); //ForeignKey } else { dbCommand.Parameters.AddWithValue("@IDCLIENTE", DBNull.Value); //ForeignKey 5 } dbCommand.Parameters.AddWithValue("@NOME", Entity.NOME); //Coluna dbCommand.Parameters.AddWithValue("@ENDERECO", Entity.ENDERECO); //Coluna dbCommand.Parameters.AddWithValue("@NUMERO", Entity.NUMERO); //Coluna dbCommand.Parameters.AddWithValue("@COMPLEMENTO", Entity.COMPLEMENTO); //Coluna dbCommand.Parameters.AddWithValue("@BAIRRO", Entity.BAIRRO); //Coluna dbCommand.Parameters.AddWithValue("@CEP", Entity.CEP); //Coluna dbCommand.Parameters.AddWithValue("@CIDADE", Entity.CIDADE); //Coluna dbCommand.Parameters.AddWithValue("@UF", Entity.UF); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@IDENDENTREGARCLIENTE"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@IDENDENTREGARCLIENTE"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(STATUSDUPLICATAEntity Entity ) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) dbCnn.Open(); dbCommand = new FbCommand("Sav_STATUSDUPLICATA", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) dbCnn = ((FbConnection)GetConnectionDB()); if (dbCnn.State == ConnectionState.Closed) dbCnn.Open(); dbCommand = new FbCommand("Sav_STATUSDUPLICATA", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; if(Entity.IDSTATUSDUPLICATA!= -1) dbCommand.Parameters.AddWithValue("@IDSTATUSDUPLICATA",Entity.IDSTATUSDUPLICATA); //PrimaryKey else dbCommand.Parameters.AddWithValue("@IDSTATUSDUPLICATA", DBNull.Value); //PrimaryKey dbCommand.Parameters.AddWithValue("@NOMESTATUS", Entity.NOMESTATUS); //Coluna dbCommand.Parameters.AddWithValue("@OBSERVACAO", Entity.OBSERVACAO); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@IDSTATUSDUPLICATA"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@IDSTATUSDUPLICATA"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) this.RollbackTransaction(); else { if (dbCommand.Transaction != null) dbCommand.Transaction.Rollback(); if (dbCnn.State == ConnectionState.Open) dbCnn.Close(); } throw ex; } return result; }
public int Save(PROCESSO1Entity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_PROCESSO1", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_PROCESSO1", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; if (Entity.IDPROCESSO != -1) { dbCommand.Parameters.AddWithValue("@IDPROCESSO", Entity.IDPROCESSO); //PrimaryKey } else { dbCommand.Parameters.AddWithValue("@IDPROCESSO", DBNull.Value); //PrimaryKey } dbCommand.Parameters.AddWithValue("@NUMERO", Entity.NUMERO); //Coluna dbCommand.Parameters.AddWithValue("@DATAPUBLICACAO", Entity.DATAPUBLICACAO); //Coluna dbCommand.Parameters.AddWithValue("@DATAPREVISAO", Entity.DATAPREVISAO); //Coluna dbCommand.Parameters.AddWithValue("@DATAFINAL", Entity.DATAFINAL); //Coluna dbCommand.Parameters.AddWithValue("@PROCESSO", Entity.PROCESSO); //Coluna dbCommand.Parameters.AddWithValue("@IDSTATUS", Entity.IDSTATUS); //Coluna dbCommand.Parameters.AddWithValue("@IDTRIBUNAL", Entity.IDTRIBUNAL); //Coluna dbCommand.Parameters.AddWithValue("@IDJORNAL", Entity.IDJORNAL); //Coluna dbCommand.Parameters.AddWithValue("@IDSECRETARIA", Entity.IDSECRETARIA); //Coluna dbCommand.Parameters.AddWithValue("@IDFUNCIONARIO", Entity.IDFUNCIONARIO); //Coluna dbCommand.Parameters.AddWithValue("@IDAUTOR", Entity.IDAUTOR); //Coluna dbCommand.Parameters.AddWithValue("@IDREU", Entity.IDREU); //Coluna dbCommand.Parameters.AddWithValue("@OBSERVACAO", Entity.OBSERVACAO); //Coluna dbCommand.Parameters.AddWithValue("@CODIGO", Entity.CODIGO); //Coluna dbCommand.Parameters.AddWithValue("@IDFUNCCAD", Entity.IDFUNCCAD); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@IDPROCESSO"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@IDPROCESSO"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(MANUTESQUIPAMENTOEntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_MANUTESQUIPAMENTO", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_MANUTESQUIPAMENTO", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; //PrimaryKey com valor igual a null, indica um novo registro, //o valor da chave será fornecido pelo banco. Qualquer outro valor indicará edição do registro. if (Entity.IDMANUTEESQUIPAMENTO == -1) { dbCommand.Parameters.AddWithValue("@IDMANUTEESQUIPAMENTO", DBNull.Value); } else { dbCommand.Parameters.AddWithValue("@IDMANUTEESQUIPAMENTO", Entity.IDMANUTEESQUIPAMENTO); } dbCommand.Parameters.AddWithValue("@DATAMANUT", Entity.DATAMANUT); //Coluna dbCommand.Parameters.AddWithValue("@DATAPROXIMAMANUT", Entity.DATAPROXIMAMANUT); //Coluna if (Entity.IDTIPOMANUTENCAO != null) { dbCommand.Parameters.AddWithValue("@IDTIPOMANUTENCAO", Entity.IDTIPOMANUTENCAO); //ForeignKey } else { dbCommand.Parameters.AddWithValue("@IDTIPOMANUTENCAO", DBNull.Value); //ForeignKey 5 } if (Entity.IDSITUACAO != null) { dbCommand.Parameters.AddWithValue("@IDSITUACAO", Entity.IDSITUACAO); //ForeignKey } else { dbCommand.Parameters.AddWithValue("@IDSITUACAO", DBNull.Value); //ForeignKey 5 } if (Entity.IDFUNCSOLICITANTE != null) { dbCommand.Parameters.AddWithValue("@IDFUNCSOLICITANTE", Entity.IDFUNCSOLICITANTE); //ForeignKey } else { dbCommand.Parameters.AddWithValue("@IDFUNCSOLICITANTE", DBNull.Value); //ForeignKey 5 } if (Entity.IDFUNCEXECUTOR != null) { dbCommand.Parameters.AddWithValue("@IDFUNCEXECUTOR", Entity.IDFUNCEXECUTOR); //ForeignKey } else { dbCommand.Parameters.AddWithValue("@IDFUNCEXECUTOR", DBNull.Value); //ForeignKey 5 } if (Entity.IDFORNECEDOR != null) { dbCommand.Parameters.AddWithValue("@IDFORNECEDOR", Entity.IDFORNECEDOR); //ForeignKey } else { dbCommand.Parameters.AddWithValue("@IDFORNECEDOR", DBNull.Value); //ForeignKey 5 } dbCommand.Parameters.AddWithValue("@VALORMANUTENCAO", Entity.VALORMANUTENCAO); //Coluna dbCommand.Parameters.AddWithValue("@KMMANUTENCAO", Entity.KMMANUTENCAO); //Coluna dbCommand.Parameters.AddWithValue("@KMPROXMANUT", Entity.KMPROXMANUT); //Coluna dbCommand.Parameters.AddWithValue("@OBSERVACAO", Entity.OBSERVACAO); //Coluna if (Entity.IDEQUIPAMENTO != null) { dbCommand.Parameters.AddWithValue("@IDEQUIPAMENTO", Entity.IDEQUIPAMENTO); //ForeignKey } else { dbCommand.Parameters.AddWithValue("@IDEQUIPAMENTO", DBNull.Value); //ForeignKey 5 } if (Entity.IDCENTROCUSTO != null) { dbCommand.Parameters.AddWithValue("@IDCENTROCUSTO", Entity.IDCENTROCUSTO); //ForeignKey } else { dbCommand.Parameters.AddWithValue("@IDCENTROCUSTO", DBNull.Value); //ForeignKey 5 } dbCommand.Parameters.AddWithValue("@CODREFERENCIA", Entity.CODREFERENCIA); //Coluna dbCommand.Parameters.AddWithValue("@KMATUAL", Entity.KMATUAL); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@IDMANUTEESQUIPAMENTO"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@IDMANUTEESQUIPAMENTO"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(FECHOSERVICOEntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_FECHOSERVICO", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_FECHOSERVICO", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; if (Entity.IDFECHOSERVICO != -1) { dbCommand.Parameters.AddWithValue("@IDFECHOSERVICO", Entity.IDFECHOSERVICO); //PrimaryKey } else { dbCommand.Parameters.AddWithValue("@IDFECHOSERVICO", DBNull.Value); //PrimaryKey } dbCommand.Parameters.AddWithValue("@DATAEMISSAO", Entity.DATAEMISSAO); //Coluna dbCommand.Parameters.AddWithValue("@IDORDEMSERVICO", Entity.IDORDEMSERVICO); //Coluna dbCommand.Parameters.AddWithValue("@VALORORCAMENTO", Entity.VALORORCAMENTO); //Coluna dbCommand.Parameters.AddWithValue("@PRAZOENTREGA", Entity.PRAZOENTREGA); //Coluna dbCommand.Parameters.AddWithValue("@IDSTATUS", Entity.IDSTATUS); //Coluna dbCommand.Parameters.AddWithValue("@IDFUNCIONARIO", Entity.IDFUNCIONARIO); //Coluna dbCommand.Parameters.AddWithValue("@OBSERVACAO", Entity.OBSERVACAO); //Coluna dbCommand.Parameters.AddWithValue("@TOTALITEMSERVICO", Entity.TOTALITEMSERVICO); //Coluna dbCommand.Parameters.AddWithValue("@TOTALITEMPECA", Entity.TOTALITEMPECA); //Coluna dbCommand.Parameters.AddWithValue("@MAOOBRA", Entity.MAOOBRA); //Coluna dbCommand.Parameters.AddWithValue("@OUTROVALOR", Entity.OUTROVALOR); //Coluna dbCommand.Parameters.AddWithValue("@TOTALFECHOS", Entity.TOTALFECHOS); //Coluna dbCommand.Parameters.AddWithValue("@GARANTIAVECTO", Entity.GARANTIAVECTO); //Coluna dbCommand.Parameters.AddWithValue("@IDFORMAPAGAMENTO", Entity.IDFORMAPAGAMENTO); //Coluna dbCommand.Parameters.AddWithValue("@IDCLIENTE", Entity.IDCLIENTE); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@IDFECHOSERVICO"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@IDFECHOSERVICO"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(PRODUTONFCEEntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_PRODUTONFCE", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_PRODUTONFCE", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; //PrimaryKey com valor igual a null, indica um novo registro, //o valor da chave será fornecido pelo banco. Qualquer outro valor indicará edição do registro. if (Entity.PRODUTONFCEID == -1) { dbCommand.Parameters.AddWithValue("@PRODUTONFCEID", DBNull.Value); } else { dbCommand.Parameters.AddWithValue("@PRODUTONFCEID", Entity.PRODUTONFCEID); } dbCommand.Parameters.AddWithValue("@CUPOMELETRONICOID", Entity.CUPOMELETRONICOID); //Coluna if (Entity.IDPRODUTO != null) { dbCommand.Parameters.AddWithValue("@IDPRODUTO", Entity.IDPRODUTO); //ForeignKey } else { dbCommand.Parameters.AddWithValue("@IDPRODUTO", DBNull.Value); //ForeignKey 5 } dbCommand.Parameters.AddWithValue("@QUANTIDADE", Entity.QUANTIDADE); //Coluna dbCommand.Parameters.AddWithValue("@VALORUNITARIO", Entity.VALORUNITARIO); //Coluna dbCommand.Parameters.AddWithValue("@VALORTOTAL", Entity.VALORTOTAL); //Coluna dbCommand.Parameters.AddWithValue("@ALICMS", Entity.ALICMS); //Coluna dbCommand.Parameters.AddWithValue("@BASEICMS", Entity.BASEICMS); //Coluna dbCommand.Parameters.AddWithValue("@REDICMS", Entity.REDICMS); //Coluna dbCommand.Parameters.AddWithValue("@VALORICMS", Entity.VALORICMS); //Coluna dbCommand.Parameters.AddWithValue("@ALIPI", Entity.ALIPI); //Coluna dbCommand.Parameters.AddWithValue("@VALORIPI", Entity.VALORIPI); //Coluna if (Entity.IDUNIDADE != null) { dbCommand.Parameters.AddWithValue("@IDUNIDADE", Entity.IDUNIDADE); //ForeignKey } else { dbCommand.Parameters.AddWithValue("@IDUNIDADE", DBNull.Value); //ForeignKey 5 } if (Entity.IDCFOP != null) { dbCommand.Parameters.AddWithValue("@IDCFOP", Entity.IDCFOP); //ForeignKey } else { dbCommand.Parameters.AddWithValue("@IDCFOP", DBNull.Value); //ForeignKey 5 } dbCommand.Parameters.AddWithValue("@ALIQPIS", Entity.ALIQPIS); //Coluna dbCommand.Parameters.AddWithValue("@VALORPIS", Entity.VALORPIS); //Coluna dbCommand.Parameters.AddWithValue("@ALIQCOFINS", Entity.ALIQCOFINS); //Coluna dbCommand.Parameters.AddWithValue("@VALORCOFINS", Entity.VALORCOFINS); //Coluna dbCommand.Parameters.AddWithValue("@VLBASEST", Entity.VLBASEST); //Coluna dbCommand.Parameters.AddWithValue("@VLICMSST", Entity.VLICMSST); //Coluna dbCommand.Parameters.AddWithValue("@VLALIQST", Entity.VLALIQST); //Coluna dbCommand.Parameters.AddWithValue("@VLOUTROS", Entity.VLOUTROS); //Coluna dbCommand.Parameters.AddWithValue("@VLTRIBUTOAPROX", Entity.VLTRIBUTOAPROX); //Coluna dbCommand.Parameters.AddWithValue("@ITEM", Entity.ITEM); //Coluna dbCommand.Parameters.AddWithValue("@IDCST", Entity.IDCST); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@PRODUTONFCEID"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@PRODUTONFCEID"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(IMPRGRIDEntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_IMPRGRID", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_IMPRGRID", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; if (Entity.IDIMPRGRID != -1) { dbCommand.Parameters.AddWithValue("@IDIMPRGRID", Entity.IDIMPRGRID); //PrimaryKey } else { dbCommand.Parameters.AddWithValue("@IDIMPRGRID", DBNull.Value); //PrimaryKey } dbCommand.Parameters.AddWithValue("@NOMETELA", Entity.NOMETELA); //Coluna dbCommand.Parameters.AddWithValue("@NOMEGRID", Entity.NOMEGRID); //Coluna dbCommand.Parameters.AddWithValue("@CAMPOSSELECIONADOS", Entity.CAMPOSSELECIONADOS); //Coluna dbCommand.Parameters.AddWithValue("@FLAGAJUSTA", Entity.FLAGAJUSTA); //Coluna dbCommand.Parameters.AddWithValue("@FLAGMODOPAISAGEM", Entity.FLAGMODOPAISAGEM); //Coluna dbCommand.Parameters.AddWithValue("@FLAGEXIBIRDATA", Entity.FLAGEXIBIRDATA); //Coluna dbCommand.Parameters.AddWithValue("@IDFUNCIONARIO", Entity.IDFUNCIONARIO); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@IDIMPRGRID"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@IDIMPRGRID"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(RECURSOSPLANOEntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_RECURSOSPLANO", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_RECURSOSPLANO", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; if (Entity.IDRECURSOSPLANO != -1) { dbCommand.Parameters.AddWithValue("@IDRECURSOSPLANO", Entity.IDRECURSOSPLANO); //PrimaryKey } else { dbCommand.Parameters.AddWithValue("@IDRECURSOSPLANO", DBNull.Value); //PrimaryKey } if (Entity.IDPLANO != null) { dbCommand.Parameters.AddWithValue("@IDPLANO", Entity.IDPLANO); //ForeignKey } else { dbCommand.Parameters.AddWithValue("@IDPLANO", DBNull.Value); //ForeignKey 5 } dbCommand.Parameters.AddWithValue("@CLIENTES", Entity.CLIENTES); //Coluna dbCommand.Parameters.AddWithValue("@PRODUTOS", Entity.PRODUTOS); //Coluna dbCommand.Parameters.AddWithValue("@NOTAFISCAL", Entity.NOTAFISCAL); //Coluna dbCommand.Parameters.AddWithValue("@USUARIOS", Entity.USUARIOS); //Coluna dbCommand.Parameters.AddWithValue("@BOLETOBANCARIOS", Entity.BOLETOBANCARIOS); //Coluna dbCommand.Parameters.AddWithValue("@SPEDSINTEGRA", Entity.SPEDSINTEGRA); //Coluna dbCommand.Parameters.AddWithValue("@ORDEMSERVICO", Entity.ORDEMSERVICO); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@IDRECURSOSPLANO"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@IDRECURSOSPLANO"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(CONHECIMENTOTRANSPEntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_CONHECIMENTOTRANSP", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_CONHECIMENTOTRANSP", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; //PrimaryKey com valor igual a null, indica um novo registro, //o valor da chave será fornecido pelo banco. Qualquer outro valor indicará edição do registro. if (Entity.IDCONHECIMENTOTRANSP == -1) { dbCommand.Parameters.AddWithValue("@IDCONHECIMENTOTRANSP", DBNull.Value); } else { dbCommand.Parameters.AddWithValue("@IDCONHECIMENTOTRANSP", Entity.IDCONHECIMENTOTRANSP); } dbCommand.Parameters.AddWithValue("@DATA", Entity.DATA); //Coluna dbCommand.Parameters.AddWithValue("@NDOCUMENTO", Entity.NDOCUMENTO); //Coluna dbCommand.Parameters.AddWithValue("@MODELO", Entity.MODELO); //Coluna dbCommand.Parameters.AddWithValue("@SERIE", Entity.SERIE); //Coluna if (Entity.IDTRANSPORTADORA != null) { dbCommand.Parameters.AddWithValue("@IDTRANSPORTADORA", Entity.IDTRANSPORTADORA); //ForeignKey } else { dbCommand.Parameters.AddWithValue("@IDTRANSPORTADORA", DBNull.Value); //ForeignKey 5 } if (Entity.IDCFOP != null) { dbCommand.Parameters.AddWithValue("@IDCFOP", Entity.IDCFOP); //ForeignKey } else { dbCommand.Parameters.AddWithValue("@IDCFOP", DBNull.Value); //ForeignKey 5 } dbCommand.Parameters.AddWithValue("@VLTOTAL", Entity.VLTOTAL); //Coluna dbCommand.Parameters.AddWithValue("@VLBASEICMS", Entity.VLBASEICMS); //Coluna dbCommand.Parameters.AddWithValue("@VLICMS", Entity.VLICMS); //Coluna dbCommand.Parameters.AddWithValue("@OUTRAS", Entity.OUTRAS); //Coluna dbCommand.Parameters.AddWithValue("@OBSERVACAO", Entity.OBSERVACAO); //Coluna dbCommand.Parameters.AddWithValue("@MODALIDADE", Entity.MODALIDADE); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@IDCONHECIMENTOTRANSP"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@IDCONHECIMENTOTRANSP"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(PRODUTOSPEDIDOMTEntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_PRODUTOSPEDIDOMT", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_PRODUTOSPEDIDOMT", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; if (Entity.IDPRODUTOSPEDIDOMT != -1) { dbCommand.Parameters.AddWithValue("@IDPRODUTOSPEDIDOMT", Entity.IDPRODUTOSPEDIDOMT); //PrimaryKey } else { dbCommand.Parameters.AddWithValue("@IDPRODUTOSPEDIDOMT", DBNull.Value); //PrimaryKey } dbCommand.Parameters.AddWithValue("@IDPEDIDO", Entity.IDPEDIDO); //Coluna dbCommand.Parameters.AddWithValue("@IDMATERIAL", Entity.IDMATERIAL); //Coluna dbCommand.Parameters.AddWithValue("@QUANTIDADE", Entity.QUANTIDADE); //Coluna dbCommand.Parameters.AddWithValue("@ALTURA", Entity.ALTURA); //Coluna dbCommand.Parameters.AddWithValue("@LARGURA", Entity.LARGURA); //Coluna dbCommand.Parameters.AddWithValue("@MT2", Entity.MT2); //Coluna dbCommand.Parameters.AddWithValue("@VALORMETRO", Entity.VALORMETRO); //Coluna dbCommand.Parameters.AddWithValue("@VALORUNITARIO", Entity.VALORUNITARIO); //Coluna dbCommand.Parameters.AddWithValue("@VALORTOTAL", Entity.VALORTOTAL); //Coluna dbCommand.Parameters.AddWithValue("@COMISSAO", Entity.COMISSAO); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@IDPRODUTOSPEDIDOMT"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@IDPRODUTOSPEDIDOMT"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(MOVCONTACORRENTEEntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_MOVCONTACORRENTE", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_MOVCONTACORRENTE", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; if (Entity.IDMOVCTCORRENTE != -1) { dbCommand.Parameters.AddWithValue("@IDMOVCTCORRENTE", Entity.IDMOVCTCORRENTE); //PrimaryKey } else { dbCommand.Parameters.AddWithValue("@IDMOVCTCORRENTE", DBNull.Value); //PrimaryKey } dbCommand.Parameters.AddWithValue("@NUMMOVIMENTACAO", Entity.NUMMOVIMENTACAO); //Coluna dbCommand.Parameters.AddWithValue("@IDCONTACORRENTE", Entity.IDCONTACORRENTE); //Coluna dbCommand.Parameters.AddWithValue("@IDMOVIMENTACAO", Entity.IDMOVIMENTACAO); //Coluna dbCommand.Parameters.AddWithValue("@IDTIPOMOVCAIXA", Entity.IDTIPOMOVCAIXA); //Coluna dbCommand.Parameters.AddWithValue("@OBSERVACAO", Entity.OBSERVACAO); //Coluna dbCommand.Parameters.AddWithValue("@VALOR", Entity.VALOR); //Coluna dbCommand.Parameters.AddWithValue("@DATAMOVIMENTACAO", Entity.DATAMOVIMENTACAO); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@IDMOVCTCORRENTE"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@IDMOVCTCORRENTE"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(PRODUTOPEDMARC2Entity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_PRODUTOPEDMARC2", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_PRODUTOPEDMARC2", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; //PrimaryKey com valor igual a null, indica um novo registro, //o valor da chave será fornecido pelo banco. Qualquer outro valor indicará edição do registro. if (Entity.IDPRODUTOPEDMARC2 == -1) { dbCommand.Parameters.AddWithValue("@IDPRODUTOPEDMARC2", DBNull.Value); } else { dbCommand.Parameters.AddWithValue("@IDPRODUTOPEDMARC2", Entity.IDPRODUTOPEDMARC2); } if (Entity.PEDIDOMARC != null) { dbCommand.Parameters.AddWithValue("@PEDIDOMARC", Entity.PEDIDOMARC); //ForeignKey } else { dbCommand.Parameters.AddWithValue("@PEDIDOMARC", DBNull.Value); //ForeignKey 5 } dbCommand.Parameters.AddWithValue("@QUANT", Entity.QUANT); //Coluna dbCommand.Parameters.AddWithValue("@ALTURA", Entity.ALTURA); //Coluna dbCommand.Parameters.AddWithValue("@LARGURA", Entity.LARGURA); //Coluna dbCommand.Parameters.AddWithValue("@COMPRIMENTO", Entity.COMPRIMENTO); //Coluna dbCommand.Parameters.AddWithValue("@TOTALMT3", Entity.TOTALMT3); //Coluna dbCommand.Parameters.AddWithValue("@VLUNITARIO", Entity.VLUNITARIO); //Coluna dbCommand.Parameters.AddWithValue("@VLTOTAL", Entity.VLTOTAL); //Coluna dbCommand.Parameters.AddWithValue("@DADOSADICIONAIS", Entity.DADOSADICIONAIS); //Coluna if (Entity.IDPRODUTO != null) { dbCommand.Parameters.AddWithValue("@IDPRODUTO", Entity.IDPRODUTO); //ForeignKey } else { dbCommand.Parameters.AddWithValue("@IDPRODUTO", DBNull.Value); //ForeignKey 5 } //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@IDPRODUTOPEDMARC2"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@IDPRODUTOPEDMARC2"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(ORDEMSERVICOEntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_ORDEMSERVICO", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_ORDEMSERVICO", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; if (Entity.IDORDEMSERVICO != -1) { dbCommand.Parameters.AddWithValue("@IDORDEMSERVICO", Entity.IDORDEMSERVICO); //PrimaryKey } else { dbCommand.Parameters.AddWithValue("@IDORDEMSERVICO", DBNull.Value); //PrimaryKey } dbCommand.Parameters.AddWithValue("@DATAEMISSAO", Entity.DATAEMISSAO); //Coluna dbCommand.Parameters.AddWithValue("@IDCLIENTE", Entity.IDCLIENTE); //Coluna dbCommand.Parameters.AddWithValue("@CONTATO", Entity.CONTATO); //Coluna dbCommand.Parameters.AddWithValue("@IDSTATUS", Entity.IDSTATUS); //Coluna dbCommand.Parameters.AddWithValue("@IDFUNCIONARIO", Entity.IDFUNCIONARIO); //Coluna dbCommand.Parameters.AddWithValue("@IDTIPOATENDIMENTO", Entity.IDTIPOATENDIMENTO); //Coluna dbCommand.Parameters.AddWithValue("@NUMSERIE", Entity.NUMSERIE); //Coluna dbCommand.Parameters.AddWithValue("@IDEQUIPAMENTO", Entity.IDEQUIPAMENTO); //Coluna dbCommand.Parameters.AddWithValue("@IDMARCA", Entity.IDMARCA); //Coluna dbCommand.Parameters.AddWithValue("@MODELO", Entity.MODELO); //Coluna dbCommand.Parameters.AddWithValue("@VECTOGARANTIA", Entity.VECTOGARANTIA); //Coluna dbCommand.Parameters.AddWithValue("@DATACOMPRA", Entity.DATACOMPRA); //Coluna dbCommand.Parameters.AddWithValue("@NOTAFISCAL", Entity.NOTAFISCAL); //Coluna dbCommand.Parameters.AddWithValue("@PROBLEMA", Entity.PROBLEMA); //Coluna dbCommand.Parameters.AddWithValue("@OBSERVACAO", Entity.OBSERVACAO); //Coluna dbCommand.Parameters.AddWithValue("@DESCRICAO", Entity.DESCRICAO); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@IDORDEMSERVICO"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@IDORDEMSERVICO"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(PRODUTOSPEDIDOEntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_PRODUTOSPEDIDO", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_PRODUTOSPEDIDO", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; //PrimaryKey com valor igual a null, indica um novo registro, //o valor da chave será fornecido pelo banco. Qualquer outro valor indicará edição do registro. if (Entity.IDPRODPEDIDO == -1) { dbCommand.Parameters.AddWithValue("@IDPRODPEDIDO", DBNull.Value); } else { dbCommand.Parameters.AddWithValue("@IDPRODPEDIDO", Entity.IDPRODPEDIDO); } if (Entity.IDPEDIDO != null) { dbCommand.Parameters.AddWithValue("@IDPEDIDO", Entity.IDPEDIDO); //ForeignKey } else { dbCommand.Parameters.AddWithValue("@IDPEDIDO", DBNull.Value); //ForeignKey 5 } if (Entity.IDPRODUTO != null) { dbCommand.Parameters.AddWithValue("@IDPRODUTO", Entity.IDPRODUTO); //ForeignKey } else { dbCommand.Parameters.AddWithValue("@IDPRODUTO", DBNull.Value); //ForeignKey 5 } dbCommand.Parameters.AddWithValue("@QUANTIDADE", Entity.QUANTIDADE); //Coluna dbCommand.Parameters.AddWithValue("@VALORUNITARIO", Entity.VALORUNITARIO); //Coluna dbCommand.Parameters.AddWithValue("@VALORTOTAL", Entity.VALORTOTAL); //Coluna dbCommand.Parameters.AddWithValue("@COMISSAO", Entity.COMISSAO); //Coluna if (Entity.IDCOR != null) { dbCommand.Parameters.AddWithValue("@IDCOR", Entity.IDCOR); //ForeignKey } else { dbCommand.Parameters.AddWithValue("@IDCOR", DBNull.Value); //ForeignKey 5 } dbCommand.Parameters.AddWithValue("@TOTALMT", Entity.TOTALMT); //Coluna dbCommand.Parameters.AddWithValue("@FLAGEXIBIR", Entity.FLAGEXIBIR); //Coluna dbCommand.Parameters.AddWithValue("@DADOSADICIONAIS", Entity.DADOSADICIONAIS); //Coluna dbCommand.Parameters.AddWithValue("@ALTURA", Entity.ALTURA); //Coluna dbCommand.Parameters.AddWithValue("@LARGURA", Entity.LARGURA); //Coluna if (Entity.IDAMBIENTE != null) { dbCommand.Parameters.AddWithValue("@IDAMBIENTE", Entity.IDAMBIENTE); //ForeignKey } else { dbCommand.Parameters.AddWithValue("@IDAMBIENTE", DBNull.Value); //ForeignKey 5 } if (Entity.IDPRODUTOMASTER != null) { dbCommand.Parameters.AddWithValue("@IDPRODUTOMASTER", Entity.IDPRODUTOMASTER); //ForeignKey } else { dbCommand.Parameters.AddWithValue("@IDPRODUTOMASTER", DBNull.Value); //ForeignKey 5 } dbCommand.Parameters.AddWithValue("@PORCPERDAMT", Entity.PORCPERDAMT); //Coluna dbCommand.Parameters.AddWithValue("@TOTALPERDAMT", Entity.TOTALPERDAMT); //Coluna dbCommand.Parameters.AddWithValue("@BUSTO", Entity.BUSTO); //Coluna dbCommand.Parameters.AddWithValue("@QUADRIL", Entity.QUADRIL); //Coluna dbCommand.Parameters.AddWithValue("@COLARINHO", Entity.COLARINHO); //Coluna dbCommand.Parameters.AddWithValue("@MANGA", Entity.MANGA); //Coluna dbCommand.Parameters.AddWithValue("@BARRA", Entity.BARRA); //Coluna dbCommand.Parameters.AddWithValue("@CINTURA", Entity.CINTURA); //Coluna dbCommand.Parameters.AddWithValue("@IDTAMANHO", Entity.IDTAMANHO); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@IDPRODPEDIDO"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@IDPRODPEDIDO"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(FORNECEDOREntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_FORNECEDOR", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_FORNECEDOR", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; if (Entity.IDFORNECEDOR != -1) { dbCommand.Parameters.AddWithValue("@IDFORNECEDOR", Entity.IDFORNECEDOR); //PrimaryKey } else { dbCommand.Parameters.AddWithValue("@IDFORNECEDOR", DBNull.Value); //PrimaryKey } dbCommand.Parameters.AddWithValue("@NOME", Entity.NOME); //Coluna dbCommand.Parameters.AddWithValue("@NOMEFANTASIA", Entity.NOMEFANTASIA); //Coluna dbCommand.Parameters.AddWithValue("@DATACADASTRO", Entity.DATACADASTRO); //Coluna dbCommand.Parameters.AddWithValue("@TELEFONE1", Entity.TELEFONE1); //Coluna dbCommand.Parameters.AddWithValue("@TELEFONE2", Entity.TELEFONE2); //Coluna dbCommand.Parameters.AddWithValue("@CNPJ", Entity.CNPJ); //Coluna dbCommand.Parameters.AddWithValue("@IE", Entity.IE); //Coluna dbCommand.Parameters.AddWithValue("@ENDERECO", Entity.ENDERECO); //Coluna dbCommand.Parameters.AddWithValue("@BAIRRO", Entity.BAIRRO); //Coluna dbCommand.Parameters.AddWithValue("@CIDADE", Entity.CIDADE); //Coluna dbCommand.Parameters.AddWithValue("@UF", Entity.UF); //Coluna dbCommand.Parameters.AddWithValue("@CEP", Entity.CEP); //Coluna dbCommand.Parameters.AddWithValue("@EMAILFORNECEDOR", Entity.EMAILFORNECEDOR); //Coluna dbCommand.Parameters.AddWithValue("@OBSERVACAO", Entity.OBSERVACAO); //Coluna dbCommand.Parameters.AddWithValue("@IDTRANSPORTADORA", Entity.IDTRANSPORTADORA); //Coluna dbCommand.Parameters.AddWithValue("@CONTATOTRANPORTADORA", Entity.CONTATOTRANPORTADORA); //Coluna dbCommand.Parameters.AddWithValue("@EMAILTRANSPORTADORA", Entity.EMAILTRANSPORTADORA); //Coluna dbCommand.Parameters.AddWithValue("@NUMERO", Entity.NUMERO); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@IDFORNECEDOR"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@IDFORNECEDOR"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(MEDICOEntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_MEDICO", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_MEDICO", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; if (Entity.IDMEDICO != -1) { dbCommand.Parameters.AddWithValue("@IDMEDICO", Entity.IDMEDICO); //PrimaryKey } else { dbCommand.Parameters.AddWithValue("@IDMEDICO", DBNull.Value); //PrimaryKey } dbCommand.Parameters.AddWithValue("@NOME", Entity.NOME); //Coluna dbCommand.Parameters.AddWithValue("@COMISSAO", Entity.COMISSAO); //Coluna dbCommand.Parameters.AddWithValue("@DATAADMISSAO", Entity.DATAADMISSAO); //Coluna dbCommand.Parameters.AddWithValue("@CRM", Entity.CRM); //Coluna dbCommand.Parameters.AddWithValue("@CODSTATUS", Entity.CODSTATUS); //Coluna dbCommand.Parameters.AddWithValue("@FUNCAO", Entity.FUNCAO); //Coluna dbCommand.Parameters.AddWithValue("@DEPARTAMENTO", Entity.DEPARTAMENTO); //Coluna dbCommand.Parameters.AddWithValue("@SETOR", Entity.SETOR); //Coluna dbCommand.Parameters.AddWithValue("@CARTEIRATRABALHO", Entity.CARTEIRATRABALHO); //Coluna dbCommand.Parameters.AddWithValue("@CARTEIRAMOTORISTA", Entity.CARTEIRAMOTORISTA); //Coluna dbCommand.Parameters.AddWithValue("@CPF", Entity.CPF); //Coluna dbCommand.Parameters.AddWithValue("@RG", Entity.RG); //Coluna dbCommand.Parameters.AddWithValue("@ENDERECO", Entity.ENDERECO); //Coluna dbCommand.Parameters.AddWithValue("@BAIRRO", Entity.BAIRRO); //Coluna dbCommand.Parameters.AddWithValue("@CIDADE", Entity.CIDADE); //Coluna dbCommand.Parameters.AddWithValue("@CEP", Entity.CEP); //Coluna dbCommand.Parameters.AddWithValue("@UF", Entity.UF); //Coluna dbCommand.Parameters.AddWithValue("@TELEFONE1", Entity.TELEFONE1); //Coluna dbCommand.Parameters.AddWithValue("@TELEFONE2", Entity.TELEFONE2); //Coluna dbCommand.Parameters.AddWithValue("@EMAIL", Entity.EMAIL); //Coluna dbCommand.Parameters.AddWithValue("@OBSERVACAO", Entity.OBSERVACAO); //Coluna dbCommand.Parameters.AddWithValue("@DTANIVERSARIO", Entity.DTANIVERSARIO); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@IDMEDICO"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@IDMEDICO"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(STATUSTLMKEntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_STATUSTLMK", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_STATUSTLMK", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; //PrimaryKey com valor igual a null, indica um novo registro, //o valor da chave será fornecido pelo banco. Qualquer outro valor indicará edição do registro. if (Entity.IDSTATUSTLMK == -1) { dbCommand.Parameters.AddWithValue("@IDSTATUSTLMK", DBNull.Value); } else { dbCommand.Parameters.AddWithValue("@IDSTATUSTLMK", Entity.IDSTATUSTLMK); } dbCommand.Parameters.AddWithValue("@NOME", Entity.NOME); //Coluna dbCommand.Parameters.AddWithValue("@OBSERVACAO", Entity.OBSERVACAO); //Coluna dbCommand.Parameters.AddWithValue("@FLAGEXIBIR", Entity.FLAGEXIBIR); //Coluna dbCommand.Parameters.AddWithValue("@COLORA", Entity.COLORA); //Coluna dbCommand.Parameters.AddWithValue("@COLOR", Entity.COLOR); //Coluna dbCommand.Parameters.AddWithValue("@COLORG", Entity.COLORG); //Coluna dbCommand.Parameters.AddWithValue("@COLORB", Entity.COLORB); //Coluna dbCommand.Parameters.AddWithValue("@FLAGDATACONTATO", Entity.FLAGDATACONTATO); //Coluna dbCommand.Parameters.AddWithValue("@FLAGHORACONTATO", Entity.FLAGHORACONTATO); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@IDSTATUSTLMK"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@IDSTATUSTLMK"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(FRENTE_MAPAEntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_FRENTE_MAPA", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_FRENTE_MAPA", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; dbCommand.Parameters.AddWithValue("@N_SERIE", Entity.N_SERIE); //Coluna dbCommand.Parameters.AddWithValue("@N_CAIXA", Entity.N_CAIXA); //Coluna dbCommand.Parameters.AddWithValue("@CONTADOR_REDUCAO", Entity.CONTADOR_REDUCAO); //Coluna dbCommand.Parameters.AddWithValue("@CONTADOR_REINICIO", Entity.CONTADOR_REINICIO); //Coluna dbCommand.Parameters.AddWithValue("@DATA", Entity.DATA); //Coluna dbCommand.Parameters.AddWithValue("@PRIMEIRO_CUPOM", Entity.PRIMEIRO_CUPOM); //Coluna dbCommand.Parameters.AddWithValue("@ULTIMO_CUPOM", Entity.ULTIMO_CUPOM); //Coluna dbCommand.Parameters.AddWithValue("@VENDA_BRUTA", Entity.VENDA_BRUTA); //Coluna dbCommand.Parameters.AddWithValue("@VALOR_INICIO_DIA", Entity.VALOR_INICIO_DIA); //Coluna dbCommand.Parameters.AddWithValue("@VALOR_FINAL_DIA", Entity.VALOR_FINAL_DIA); //Coluna dbCommand.Parameters.AddWithValue("@TRIBF", Entity.TRIBF); //Coluna dbCommand.Parameters.AddWithValue("@TRIBI", Entity.TRIBI); //Coluna dbCommand.Parameters.AddWithValue("@TRIBN", Entity.TRIBN); //Coluna dbCommand.Parameters.AddWithValue("@TRIBA", Entity.TRIBA); //Coluna dbCommand.Parameters.AddWithValue("@TRIBD", Entity.TRIBD); //Coluna dbCommand.Parameters.AddWithValue("@TRIBC", Entity.TRIBC); //Coluna dbCommand.Parameters.AddWithValue("@TRIBS", Entity.TRIBS); //Coluna dbCommand.Parameters.AddWithValue("@T0700", Entity.T0700); //Coluna dbCommand.Parameters.AddWithValue("@T1200", Entity.T1200); //Coluna dbCommand.Parameters.AddWithValue("@T1800", Entity.T1800); //Coluna dbCommand.Parameters.AddWithValue("@T2500", Entity.T2500); //Coluna dbCommand.Parameters.AddWithValue("@TRICS", Entity.TRICS); //Coluna dbCommand.Parameters.AddWithValue("@TRIAS", Entity.TRIAS); //Coluna dbCommand.Parameters.AddWithValue("@TRIDS", Entity.TRIDS); //Coluna dbCommand.Parameters.AddWithValue("@SINCRONIZADO", Entity.SINCRONIZADO); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters[""].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters[""].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(VENDEDOREntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("SAV_VENDEDORFAST", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("SAV_VENDEDORFAST", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; if (Entity.CODIGO_VENDEDOR != -1) { dbCommand.Parameters.AddWithValue("@CODIGO_VENDEDOR", Entity.CODIGO_VENDEDOR); //PrimaryKey } else { dbCommand.Parameters.AddWithValue("@CODIGO_VENDEDOR", DBNull.Value); //PrimaryKey } if (Entity.NOME_VENDEDOR != null) { dbCommand.Parameters.AddWithValue("@NOME_VENDEDOR", Entity.NOME_VENDEDOR); //Coluna } else { dbCommand.Parameters.AddWithValue("@NOME_VENDEDOR", DBNull.Value); //Coluna 3 } //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@CODIGO_VENDEDOR"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@CODIGO_VENDEDOR"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(CONSIGNACAOEntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_CONSIGNACAO", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_CONSIGNACAO", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; if (Entity.IDCONSIGNACAO != -1) { dbCommand.Parameters.AddWithValue("@IDCONSIGNACAO", Entity.IDCONSIGNACAO); //PrimaryKey } else { dbCommand.Parameters.AddWithValue("@IDCONSIGNACAO", DBNull.Value); //PrimaryKey } dbCommand.Parameters.AddWithValue("@IDCLIENTE", Entity.IDCLIENTE); //Coluna dbCommand.Parameters.AddWithValue("@DTEMISSAO", Entity.DTEMISSAO); //Coluna dbCommand.Parameters.AddWithValue("@DTVALIDADE", Entity.DTVALIDADE); //Coluna dbCommand.Parameters.AddWithValue("@IDSTATUS", Entity.IDSTATUS); //Coluna dbCommand.Parameters.AddWithValue("@PRAZOENTREGA", Entity.PRAZOENTREGA); //Coluna dbCommand.Parameters.AddWithValue("@IDFORMAPAGTO", Entity.IDFORMAPAGTO); //Coluna dbCommand.Parameters.AddWithValue("@IDFUNCIONARIO", Entity.IDFUNCIONARIO); //Coluna dbCommand.Parameters.AddWithValue("@IDTRANSPORTES", Entity.IDTRANSPORTES); //Coluna dbCommand.Parameters.AddWithValue("@OBSERVACAO", Entity.OBSERVACAO); //Coluna dbCommand.Parameters.AddWithValue("@TOTALIPI", Entity.TOTALIPI); //Coluna dbCommand.Parameters.AddWithValue("@PORCDESCONTO", Entity.PORCDESCONTO); //Coluna dbCommand.Parameters.AddWithValue("@TOTALDESCONTO", Entity.TOTALDESCONTO); //Coluna dbCommand.Parameters.AddWithValue("@PORCACRESCIMO", Entity.PORCACRESCIMO); //Coluna dbCommand.Parameters.AddWithValue("@TOTALACRESCIMO", Entity.TOTALACRESCIMO); //Coluna dbCommand.Parameters.AddWithValue("@TOTAORCAMENTO", Entity.TOTAORCAMENTO); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@IDCONSIGNACAO"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@IDCONSIGNACAO"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(PRODUTOS2NFEEntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_PRODUTOS", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_PRODUTOS", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; if (Entity.IDPRODUTO != -1) { dbCommand.Parameters.AddWithValue("@IDPRODUTO", Entity.IDPRODUTO); //PrimaryKey } else { dbCommand.Parameters.AddWithValue("@IDPRODUTO", DBNull.Value); //PrimaryKey } dbCommand.Parameters.AddWithValue("@NOMEPRODUTO", Entity.NOMEPRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@CODPRODUTOFORNECEDOR", Entity.CODPRODUTOFORNECEDOR); //Coluna dbCommand.Parameters.AddWithValue("@CODBARRA", Entity.CODBARRA); //Coluna dbCommand.Parameters.AddWithValue("@LOCALIZACAO", Entity.LOCALIZACAO); //Coluna dbCommand.Parameters.AddWithValue("@DATACADASTRO", Entity.DATACADASTRO); //Coluna dbCommand.Parameters.AddWithValue("@IDUNIDADE", Entity.IDUNIDADE); //Coluna dbCommand.Parameters.AddWithValue("@IDMARCA", Entity.IDMARCA); //Coluna dbCommand.Parameters.AddWithValue("@IDMOEDA", Entity.IDMOEDA); //Coluna dbCommand.Parameters.AddWithValue("@VALORCUSTOINICIAL", Entity.VALORCUSTOINICIAL); //Coluna dbCommand.Parameters.AddWithValue("@FRETEPRODUTO", Entity.FRETEPRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@ENCARGOSPRODUTOS", Entity.ENCARGOSPRODUTOS); //Coluna dbCommand.Parameters.AddWithValue("@VALORCUSTOFINAL", Entity.VALORCUSTOFINAL); //Coluna dbCommand.Parameters.AddWithValue("@MARGEMLUCRO", Entity.MARGEMLUCRO); //Coluna dbCommand.Parameters.AddWithValue("@VALORVENDA1", Entity.VALORVENDA1); //Coluna dbCommand.Parameters.AddWithValue("@VALORVENDA2", Entity.VALORVENDA2); //Coluna dbCommand.Parameters.AddWithValue("@VALORVENDA3", Entity.VALORVENDA3); //Coluna dbCommand.Parameters.AddWithValue("@COMISSAO", Entity.COMISSAO); //Coluna dbCommand.Parameters.AddWithValue("@IPI", Entity.IPI); //Coluna dbCommand.Parameters.AddWithValue("@ICMS", Entity.ICMS); //Coluna dbCommand.Parameters.AddWithValue("@QUANTIDADEMINIMA", Entity.QUANTIDADEMINIMA); //Coluna dbCommand.Parameters.AddWithValue("@ESTOQUEATUAL", Entity.ESTOQUEATUAL); //Coluna dbCommand.Parameters.AddWithValue("@IDGRUPOCATEGORIA", Entity.IDGRUPOCATEGORIA); //Coluna dbCommand.Parameters.AddWithValue("@IDSTATUS", Entity.IDSTATUS); //Coluna dbCommand.Parameters.AddWithValue("@OBSERVACAO", Entity.OBSERVACAO); //Coluna dbCommand.Parameters.AddWithValue("@PORCFRETE", Entity.PORCFRETE); //Coluna dbCommand.Parameters.AddWithValue("@PORCENCARGOS", Entity.PORCENCARGOS); //Coluna dbCommand.Parameters.AddWithValue("@PORCMARGEMLUCRO", Entity.PORCMARGEMLUCRO); //Coluna dbCommand.Parameters.AddWithValue("@PORCVENDA2", Entity.PORCVENDA2); //Coluna dbCommand.Parameters.AddWithValue("@PORCVENDA3", Entity.PORCVENDA3); //Coluna dbCommand.Parameters.AddWithValue("@PESO", Entity.PESO); //Coluna dbCommand.Parameters.AddWithValue("@IDCLASSIFICACAO", Entity.IDCLASSIFICACAO); //Coluna dbCommand.Parameters.AddWithValue("@IDCST", Entity.IDCST); //Coluna dbCommand.Parameters.AddWithValue("@NCMSH", Entity.NCMSH); //Coluna dbCommand.Parameters.AddWithValue("@EXTIPI", Entity.EXTIPI); //Coluna dbCommand.Parameters.AddWithValue("@ALIQPIS", Entity.ALIQPIS); //Coluna dbCommand.Parameters.AddWithValue("@ALIQCOFINS", Entity.ALIQCOFINS); //Coluna dbCommand.Parameters.AddWithValue("@CSTPISCONFIS", Entity.CSTPISCONFIS); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@IDPRODUTO"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@IDPRODUTO"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(PRODUTOCOTACAOFORNECEDOREntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_PRODUTOCOTACAOFORNECEDOR", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_PRODUTOCOTACAOFORNECEDOR", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; if (Entity.IDPRODUTOCOTACAOFORNECEDOR != -1) { dbCommand.Parameters.AddWithValue("@IDPRODUTOCOTACAOFORNECEDOR", Entity.IDPRODUTOCOTACAOFORNECEDOR); //PrimaryKey } else { dbCommand.Parameters.AddWithValue("@IDPRODUTOCOTACAOFORNECEDOR", DBNull.Value); //PrimaryKey } dbCommand.Parameters.AddWithValue("@IDPRODUTO", Entity.IDPRODUTO); //Coluna dbCommand.Parameters.AddWithValue("@IDFORNECEDOR", Entity.IDFORNECEDOR); //Coluna dbCommand.Parameters.AddWithValue("@TELEFONEFORNECEDOR", Entity.TELEFONEFORNECEDOR); //Coluna dbCommand.Parameters.AddWithValue("@PRAZOENTREGA", Entity.PRAZOENTREGA); //Coluna dbCommand.Parameters.AddWithValue("@CONTATOFORNECEDOR", Entity.CONTATOFORNECEDOR); //Coluna dbCommand.Parameters.AddWithValue("@VALORCOMPRA", Entity.VALORCOMPRA); //Coluna dbCommand.Parameters.AddWithValue("@CONDPAGTO", Entity.CONDPAGTO); //Coluna dbCommand.Parameters.AddWithValue("@DATACOTACAO", Entity.DATACOTACAO); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@IDPRODUTOCOTACAOFORNECEDOR"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@IDPRODUTOCOTACAOFORNECEDOR"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(EMPRESAEntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_EMPRESA", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_EMPRESA", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; if (Entity.IDEMPRESA != -1) { dbCommand.Parameters.AddWithValue("@IDEMPRESA", Entity.IDEMPRESA); //PrimaryKey } else { dbCommand.Parameters.AddWithValue("@IDEMPRESA", DBNull.Value); //PrimaryKey } dbCommand.Parameters.AddWithValue("@NOMECLIENTE", Entity.NOMECLIENTE); //Coluna dbCommand.Parameters.AddWithValue("@ENDERECO", Entity.ENDERECO); //Coluna dbCommand.Parameters.AddWithValue("@BAIRRO", Entity.BAIRRO); //Coluna dbCommand.Parameters.AddWithValue("@CEP", Entity.CEP); //Coluna dbCommand.Parameters.AddWithValue("@CIDADE", Entity.CIDADE); //Coluna dbCommand.Parameters.AddWithValue("@UF", Entity.UF); //Coluna dbCommand.Parameters.AddWithValue("@TELEFONE", Entity.TELEFONE); //Coluna dbCommand.Parameters.AddWithValue("@FAX", Entity.FAX); //Coluna dbCommand.Parameters.AddWithValue("@CNPJCPF", Entity.CNPJCPF); //Coluna dbCommand.Parameters.AddWithValue("@IE", Entity.IE); //Coluna dbCommand.Parameters.AddWithValue("@EMAIL", Entity.EMAIL); //Coluna dbCommand.Parameters.AddWithValue("@REGISTRO", Entity.REGISTRO); //Coluna dbCommand.Parameters.AddWithValue("@NUMERO", Entity.NUMERO); //Coluna dbCommand.Parameters.AddWithValue("@COMPLEMENTO", Entity.COMPLEMENTO); //Coluna dbCommand.Parameters.AddWithValue("@NOMEFANTASIA", Entity.NOMEFANTASIA); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@IDEMPRESA"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@IDEMPRESA"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(PEDIDOMARCEntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_PEDIDOMARC", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_PEDIDOMARC", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; //PrimaryKey com valor igual a null, indica um novo registro, //o valor da chave será fornecido pelo banco. Qualquer outro valor indicará edição do registro. if (Entity.IDPEDIDOMARC == -1) { dbCommand.Parameters.AddWithValue("@IDPEDIDOMARC", DBNull.Value); } else { dbCommand.Parameters.AddWithValue("@IDPEDIDOMARC", Entity.IDPEDIDOMARC); } dbCommand.Parameters.AddWithValue("@IDCLIENTE", Entity.IDCLIENTE); //Coluna dbCommand.Parameters.AddWithValue("@DTEMISSAO", Entity.DTEMISSAO); //Coluna dbCommand.Parameters.AddWithValue("@IDSTATUS", Entity.IDSTATUS); //Coluna dbCommand.Parameters.AddWithValue("@PRAZOENTREGA", Entity.PRAZOENTREGA); //Coluna dbCommand.Parameters.AddWithValue("@IDTRANSPORTES", Entity.IDTRANSPORTES); //Coluna dbCommand.Parameters.AddWithValue("@IDVENDEDOR", Entity.IDVENDEDOR); //Coluna dbCommand.Parameters.AddWithValue("@VALORCOMISSAO", Entity.VALORCOMISSAO); //Coluna dbCommand.Parameters.AddWithValue("@OBSERVACAO", Entity.OBSERVACAO); //Coluna dbCommand.Parameters.AddWithValue("@TOTALPRODUTOS", Entity.TOTALPRODUTOS); //Coluna dbCommand.Parameters.AddWithValue("@TOTALIMPOSTOS", Entity.TOTALIMPOSTOS); //Coluna dbCommand.Parameters.AddWithValue("@PORCDESCONTO", Entity.PORCDESCONTO); //Coluna dbCommand.Parameters.AddWithValue("@VALORDESCONTO", Entity.VALORDESCONTO); //Coluna dbCommand.Parameters.AddWithValue("@PORCACRESCIMO", Entity.PORCACRESCIMO); //Coluna dbCommand.Parameters.AddWithValue("@VALORACRESCIMO", Entity.VALORACRESCIMO); //Coluna dbCommand.Parameters.AddWithValue("@TOTALPEDIDO", Entity.TOTALPEDIDO); //Coluna dbCommand.Parameters.AddWithValue("@IDFORMAPAGAMENTO", Entity.IDFORMAPAGAMENTO); //Coluna dbCommand.Parameters.AddWithValue("@VALORPAGO", Entity.VALORPAGO); //Coluna dbCommand.Parameters.AddWithValue("@VALORDEVEDOR", Entity.VALORDEVEDOR); //Coluna dbCommand.Parameters.AddWithValue("@IDLOCALCOBRANCA", Entity.IDLOCALCOBRANCA); //Coluna dbCommand.Parameters.AddWithValue("@IDCENTROCUSTOS", Entity.IDCENTROCUSTOS); //Coluna dbCommand.Parameters.AddWithValue("@TOTALMATERIAL", Entity.TOTALMATERIAL); //Coluna dbCommand.Parameters.AddWithValue("@FLAGORCAMENTO", Entity.FLAGORCAMENTO); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@IDPEDIDOMARC"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@IDPEDIDOMARC"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(ABERTURACAIXAEntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_ABERTURACAIXA", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_ABERTURACAIXA", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; //PrimaryKey com valor igual a null, indica um novo registro, //o valor da chave será fornecido pelo banco. Qualquer outro valor indicará edição do registro. if (Entity.IDABERTURACAIXA == -1) { dbCommand.Parameters.AddWithValue("@IDABERTURACAIXA", DBNull.Value); } else { dbCommand.Parameters.AddWithValue("@IDABERTURACAIXA", Entity.IDABERTURACAIXA); } dbCommand.Parameters.AddWithValue("@DATA", Entity.DATA); //Coluna if (Entity.IDFUNCIONARIO != null) { dbCommand.Parameters.AddWithValue("@IDFUNCIONARIO", Entity.IDFUNCIONARIO); //ForeignKey } else { dbCommand.Parameters.AddWithValue("@IDFUNCIONARIO", DBNull.Value); //ForeignKey 5 } dbCommand.Parameters.AddWithValue("@VALOR", Entity.VALOR); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@IDABERTURACAIXA"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@IDABERTURACAIXA"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }
public int Save(ITENSFORMAPAGTOEntity Entity) { int result = 0; try { //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_ITENSFORMAPAGTO", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("Sav_ITENSFORMAPAGTO", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } dbCommand.CommandType = CommandType.StoredProcedure; if (Entity.IDITENSFORMAPAGTO != -1) { dbCommand.Parameters.AddWithValue("@IDITENSFORMAPAGTO", Entity.IDITENSFORMAPAGTO); //PrimaryKey } else { dbCommand.Parameters.AddWithValue("@IDITENSFORMAPAGTO", DBNull.Value); //PrimaryKey } dbCommand.Parameters.AddWithValue("@IDFORMAPAGAMENTO", Entity.IDFORMAPAGAMENTO); //Coluna dbCommand.Parameters.AddWithValue("@DIAS", Entity.DIAS); //Coluna dbCommand.Parameters.AddWithValue("@PORCPAGTO", Entity.PORCPAGTO); //Coluna dbCommand.Parameters.AddWithValue("@PORCJUROS", Entity.PORCJUROS); //Coluna //Retorno da Procedure FbParameter returnValue; returnValue = dbCommand.CreateParameter(); dbCommand.Parameters["@IDITENSFORMAPAGTO"].Direction = ParameterDirection.InputOutput; //Executando consulta dbCommand.ExecuteNonQuery(); result = int.Parse(dbCommand.Parameters["@IDITENSFORMAPAGTO"].Value.ToString()); if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } } catch (Exception ex) { if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } return(result); }