public bool Delete(DBHelper pDBHelper, AreaBE pArea) { DBHelper.Parameters[] colParameters = null; try { colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@ID", pArea.Id == Constantes.INT_NULO ? (object)DBNull.Value : pArea.Id), new DBHelper.Parameters("@USUARIOMODIFICACION", string.IsNullOrEmpty(pArea.UsuarioModificacion) ? (object)DBNull.Value : pArea.UsuarioModificacion) }; pDBHelper.CreateDBParameters(colParameters); int lfilasAfectadas = pDBHelper.ExecuteNonQuery(pDBHelper.concatOwner("AreaDelete"), CommandType.StoredProcedure, Utility.ConnectionState.KeepOpen, ParameterError.notInclude, CleanParameters.preserve); return(lfilasAfectadas > 0); } catch (Exception ex) { throw ex; } finally { colParameters = null; if (pDBHelper != null && pDBHelper.Command.Transaction == null) { pDBHelper.Dispose(); } } }
public bool AdjuntoTemporalDeleteByIdCarga(DBHelper pDBHelper, AdjuntoBE AdjuntoBE) { DBHelper.Parameters[] colParameters = null; try { colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@IdCarga", string.IsNullOrEmpty(AdjuntoBE.IdCarga) ? (object)DBNull.Value : AdjuntoBE.IdCarga), new DBHelper.Parameters("@UsuarioModificacion", string.IsNullOrEmpty(AdjuntoBE.UsuarioModificacion) ? (object)DBNull.Value : AdjuntoBE.UsuarioModificacion) }; pDBHelper.CreateDBParameters(colParameters); int lfilasAfectadas = pDBHelper.ExecuteNonQuery(pDBHelper.concatOwner("AdjuntoTemporalDeleteByIdCarga"), CommandType.StoredProcedure, Utility.ConnectionState.KeepOpen, ParameterError.notInclude, CleanParameters.preserve); return(lfilasAfectadas > 0); } catch (Exception ex) { throw ex; } finally { colParameters = null; if (pDBHelper != null && pDBHelper.Command.Transaction == null) { pDBHelper.Dispose(); } } }
public bool Insert(DBHelper pDBHelper, AreaBE pArea) { DBHelper.Parameters[] colParameters = null; try { colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@IDDEPARTAMENTO", pArea.IdDepartamento == Constantes.INT_NULO ? (object)DBNull.Value : pArea.IdDepartamento), new DBHelper.Parameters("@DESCRIPCION", string.IsNullOrEmpty(pArea.Descripcion) ? (object)DBNull.Value : pArea.Descripcion), new DBHelper.Parameters("@SIGLA", string.IsNullOrEmpty(pArea.Sigla) ? (object)DBNull.Value : pArea.Sigla), new DBHelper.Parameters("@USUARIOCREACION", string.IsNullOrEmpty(pArea.UsuarioCreacion) ? (object)DBNull.Value : pArea.UsuarioCreacion) }; pDBHelper.CreateDBParameters(colParameters); int lfilasAfectadas = pDBHelper.ExecuteNonQuery(pDBHelper.concatOwner("AreaInsert"), CommandType.StoredProcedure, Utility.ConnectionState.KeepOpen, ParameterError.notInclude, CleanParameters.preserve); return(lfilasAfectadas > 0); } catch (Exception ex) { throw ex; } finally { colParameters = null; if (pDBHelper != null && pDBHelper.Command.Transaction == null) { pDBHelper.Dispose(); } } }
public bool UsuarioPerfilEmpresaDelete(DBHelper pDBHelper, UsuarioBE oUsuario) { DBHelper.Parameters[] colParameters = null; try { colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@IdUsuario", oUsuario.Id == Constantes.INT_NULO ? (object)DBNull.Value : oUsuario.Id), new DBHelper.Parameters("@IdEmpresa", oUsuario.IdEmpresa == Constantes.INT_NULO ? (object)DBNull.Value : oUsuario.IdEmpresa), new DBHelper.Parameters("@IdPerfil", oUsuario.IdPerfil == Constantes.INT_NULO ? (object)DBNull.Value : oUsuario.IdPerfil) }; pDBHelper.CreateDBParameters(colParameters); int lfilasAfectadas = pDBHelper.ExecuteNonQuery(pDBHelper.concatOwner("UsuarioPerfilEmpresaDelete"), CommandType.StoredProcedure, Utility.ConnectionState.KeepOpen, ParameterError.notInclude, CleanParameters.preserve); return(true); } catch (Exception ex) { throw ex; } finally { colParameters = null; if (pDBHelper != null && pDBHelper.Command.Transaction == null) { pDBHelper.Dispose(); } } }
public void AddSpoilToSync(Guid Id, string transactionRefNo, int stockRefNo, string stockDetails, int stockUnit, int?stockUnitLeft, bool isSyncReady, int syncStatus, string spoilDetails, string reasonSyncFailed, string reportedBy, DateTime?syncRefCreatedOn, DateTime?syncRefModifiedOn, string machineName, string syncRefNo, DateTime?syncDate, int syncFailedCount, DateTime?refCreatedDate, DateTime?refModifiedDate, double?cost, DateTime createdOnUtc, DateTime?modifiedOnUtc, bool isDeleted) { String tsql = @"[Sync].[Sp_AddSpoilToSync]"; var colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@Id", Id), new DBHelper.Parameters("@TransactionRefNo", transactionRefNo), new DBHelper.Parameters("@StockRefNo", stockRefNo), new DBHelper.Parameters("@StockDetails", stockDetails), new DBHelper.Parameters("@StockUnit", stockUnit), new DBHelper.Parameters("@StockUnitLeft", stockUnitLeft), new DBHelper.Parameters("@IsSyncReady", isSyncReady), new DBHelper.Parameters("@SyncStatus", syncStatus), new DBHelper.Parameters("@SpoilDetails", spoilDetails), new DBHelper.Parameters("@ReasonSyncFailed", reasonSyncFailed), new DBHelper.Parameters("@ReportedBy", reportedBy), new DBHelper.Parameters("@SyncRefCreatedOn", syncRefCreatedOn), new DBHelper.Parameters("@SyncRefModifiedOn", syncRefModifiedOn), new DBHelper.Parameters("@MachineName", machineName), new DBHelper.Parameters("@SyncRefNo", syncRefNo), new DBHelper.Parameters("@SyncDate", syncDate), new DBHelper.Parameters("@SyncFailedCount", syncFailedCount), new DBHelper.Parameters("@RefCreatedDate", refCreatedDate), new DBHelper.Parameters("@RefModifiedDate", refModifiedDate), new DBHelper.Parameters("@Cost", cost), new DBHelper.Parameters("@CreatedOnUtc", createdOnUtc), new DBHelper.Parameters("@ModifiedOnUtc", modifiedOnUtc), new DBHelper.Parameters("@IsDeleted", isDeleted), }; this.ExecuteNonQuery(CommandType.StoredProcedure, tsql, colParameters); }
public void UpdateSyncedSpoil(Int32 StockRefNo, String StockDetails, Int32 StockUnit, Int32?StockUnitLeft, bool IsSyncReady, Int32 SyncStatus, String SpoilDetails, String ReportedBy, String MachineName, DateTime?RefCreatedDate, DateTime?RefModifiedDate, Double?Cost, Guid Id) { String tsql = @"[Sync].[Sp_UpdateSyncSpoilByField]"; try { var colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@StockRefNo", StockRefNo), new DBHelper.Parameters("@StockDetails", StockDetails), new DBHelper.Parameters("@StockUnit", StockUnit), new DBHelper.Parameters("@StockUnitLeft", StockUnitLeft), new DBHelper.Parameters("@IsSyncReady", IsSyncReady), new DBHelper.Parameters("@SyncStatus", SyncStatus), new DBHelper.Parameters("@SpoilDetails", SpoilDetails), new DBHelper.Parameters("@ReportedBy", ReportedBy), new DBHelper.Parameters("@MachineName", MachineName), new DBHelper.Parameters("@RefCreatedDate", RefCreatedDate), new DBHelper.Parameters("@RefModifiedDate", RefModifiedDate), new DBHelper.Parameters("@Cost", Cost), new DBHelper.Parameters("@Id", Id) }; this.ExecuteNonQuery(CommandType.StoredProcedure, tsql, colParameters); } catch (DBConcurrencyException) { } }
public List <ReporteChildBE> ReporteUsoUsuGetDia(DBHelper pDBHelper, ReporteChildBE pReporteChild) { List <ReporteChildBE> oLista = new List <ReporteChildBE>(); ReporteChildBE obj = null; DBHelper.Parameters[] colParameters = null; try { // Parámetros colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@IdEmpresa", pReporteChild.idEmpresa == Constantes.INT_NULO ? (object)DBNull.Value : pReporteChild.idEmpresa), new DBHelper.Parameters("@IdUsuario", pReporteChild.idUsuario == Constantes.INT_NULO ? (object)DBNull.Value : pReporteChild.idUsuario), new DBHelper.Parameters("@Anho", pReporteChild.anho == Constantes.INT_NULO ? (object)DBNull.Value : pReporteChild.anho), new DBHelper.Parameters("@Semestre", pReporteChild.semestre == Constantes.INT_NULO ? (object)DBNull.Value : pReporteChild.semestre), new DBHelper.Parameters("@Trimestre", pReporteChild.trimestre == Constantes.INT_NULO ? (object)DBNull.Value : pReporteChild.trimestre), new DBHelper.Parameters("@Mes", pReporteChild.mes == Constantes.INT_NULO ? (object)DBNull.Value : pReporteChild.mes) }; pDBHelper.ClearParameter(); pDBHelper.CreateDBParameters(colParameters); using (IDataReader dr = pDBHelper.ExecuteReader(pDBHelper.concatOwner("ReporteUsoUsuGetDia"), CommandType.StoredProcedure, Utility.ConnectionState.CloseOnExit)) { // Leyendo reader while (dr.Read()) { obj = new ReporteChildBE(); StringBuilder sb = new StringBuilder(); sb.Append(dr["horas"].ToString().PadLeft(2, '0')); sb.Append(":"); sb.Append(dr["minutos"].ToString().PadLeft(2, '0')); obj.duration = sb.ToString(); obj.idEmpresa = int.Parse(dr["idEmpresa"].ToString()); obj.idUsuario = int.Parse(dr["idUsuario"].ToString()); obj.NombreUsuario = dr["NombreCompleto"].ToString(); obj.anho = int.Parse(dr["anho"].ToString()); obj.semestre = int.Parse(dr["Semestre"].ToString()); obj.trimestre = int.Parse(dr["Trimestre"].ToString()); obj.mes = int.Parse(dr["Mes"].ToString()); obj.dia = int.Parse(dr["Dia"].ToString()); oLista.Add(obj); } } return(oLista); } catch (Exception ex) { throw ex; } finally { colParameters = null; if (pDBHelper != null && pDBHelper.Command.Transaction == null) { pDBHelper.Dispose(); } } }
public bool Insert(DBHelper pDBHelper, VisitaBE pVisita) { DBHelper.Parameters[] colParameters = null; try { colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@USUARIOCREACION", string.IsNullOrEmpty(pVisita.UsuarioCreacion) ? (object)DBNull.Value : pVisita.UsuarioCreacion), new DBHelper.Parameters("@IDEMPRESA", pVisita.IdEmpresa == Constantes.INT_NULO ? (object)DBNull.Value : pVisita.IdEmpresa) }; pDBHelper.CreateDBParameters(colParameters); int lfilasAfectadas = pDBHelper.ExecuteNonQuery(pDBHelper.concatOwner("VisitaInsert"), CommandType.StoredProcedure, Utility.ConnectionState.KeepOpen, ParameterError.notInclude, CleanParameters.preserve); return(lfilasAfectadas > 0); } catch (Exception ex) { throw ex; } finally { colParameters = null; if (pDBHelper != null && pDBHelper.Command.Transaction == null) { pDBHelper.Dispose(); } } }
public bool Update(DBHelper pDBHelper, UsuarioBE oUsuario) { DBHelper.Parameters[] colParameters = null; try { colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@IdUsuario", oUsuario.Id == Constantes.INT_NULO ? (object)DBNull.Value : oUsuario.Id), new DBHelper.Parameters("@CuentaRed", string.IsNullOrEmpty(oUsuario.CuentaUsuario) ? (object)DBNull.Value : oUsuario.CuentaUsuario), new DBHelper.Parameters("@NombreCompleto", string.IsNullOrEmpty(oUsuario.NombreCompleto) ? (object)DBNull.Value : oUsuario.NombreCompleto), new DBHelper.Parameters("@Activo", oUsuario.Activo == Constantes.INT_NULO ? false : Convert.ToBoolean(oUsuario.Activo)), new DBHelper.Parameters("@IdEmpresa", oUsuario.IdEmpresa == Constantes.INT_NULO ? (object)DBNull.Value : oUsuario.IdEmpresa), new DBHelper.Parameters("@Email", string.IsNullOrEmpty(oUsuario.Email) ? (object)DBNull.Value : oUsuario.Email), new DBHelper.Parameters("@Confidencial", oUsuario.Confidencial == Constantes.INT_NULO ? (object)DBNull.Value : oUsuario.Confidencial) }; pDBHelper.CreateDBParameters(colParameters); int lfilasAfectadas = pDBHelper.ExecuteNonQuery(pDBHelper.concatOwner("UsuarioUpdate"), CommandType.StoredProcedure, Utility.ConnectionState.KeepOpen, ParameterError.notInclude, CleanParameters.preserve); return(lfilasAfectadas > 0); } catch (Exception ex) { throw ex; } finally { colParameters = null; if (pDBHelper != null && pDBHelper.Command.Transaction == null) { pDBHelper.Dispose(); } } }
public TransactionDto GetTransactionDetailBy(Guid?orderDetailUId, Guid?orderUId) { TransactionDto salesTransaction = null; DBHelper.Parameters[] colParameters = null; try { // Structure Parameter Array colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@OrderDetailUId", orderDetailUId), new DBHelper.Parameters("@OrderUId", orderUId), }; using (IDataReader drSalesTrans = this.ExecuteReader(CommandType.StoredProcedure, "[sync].[Sp_RetrieveSalesBy]", colParameters)) { //Reading the reader one by one and setting into requestTypeInfo. if (drSalesTrans.Read()) { salesTransaction = new TransactionDto(); salesTransaction.TransactionRefNo = drSalesTrans.IsDBNull(0) ? null : drSalesTrans.GetString(0); salesTransaction.StockRefNo = drSalesTrans.IsDBNull(1) ? null : drSalesTrans.GetString(1); salesTransaction.StockItemNo = drSalesTrans.IsDBNull(2) ? null : drSalesTrans.GetString(2); salesTransaction.StockDetails = drSalesTrans.IsDBNull(3) ? null : drSalesTrans.GetString(3); salesTransaction.StockCategoryRefNo = drSalesTrans.IsDBNull(4) ? null : drSalesTrans.GetString(4); salesTransaction.StockCategoryLine = drSalesTrans.IsDBNull(5) ? null : drSalesTrans.GetString(5); salesTransaction.StockUnitPurchased = drSalesTrans.IsDBNull(6) ? 0 : drSalesTrans.GetInt32(6); salesTransaction.StockUnitAmount = drSalesTrans.IsDBNull(7) ? 0 : drSalesTrans.GetDecimal(7); salesTransaction.StockCostAmount = drSalesTrans.IsDBNull(8) ? 0 : drSalesTrans.GetDecimal(8); salesTransaction.StockDiscountAmount = drSalesTrans.IsDBNull(9) ? 0 : drSalesTrans.GetDouble(9); salesTransaction.RefCreatedDate = drSalesTrans.IsDBNull(10) ? null : (DateTime?)drSalesTrans.GetDateTime(10); salesTransaction.CustomerName = drSalesTrans.IsDBNull(11) ? null : drSalesTrans.GetString(11); salesTransaction.CustomerEmail = drSalesTrans.IsDBNull(12) ? null : drSalesTrans.GetString(12); salesTransaction.CustomerAddress = drSalesTrans.IsDBNull(13) ? null : drSalesTrans.GetString(13); salesTransaction.CustomerTel = drSalesTrans.IsDBNull(14) ? null : drSalesTrans.GetString(14); salesTransaction.CustomerGender = drSalesTrans.IsDBNull(15) ? null : drSalesTrans.GetString(15); salesTransaction.Barcode = drSalesTrans.IsDBNull(16) ? null : drSalesTrans.GetString(16); salesTransaction.RefModifiedDate = drSalesTrans.IsDBNull(17) ? null : (DateTime?)drSalesTrans.GetDateTime(17); salesTransaction.StockUnitLeft = drSalesTrans.IsDBNull(18) ? null : (int?)drSalesTrans.GetInt32(18); salesTransaction.Cashier = drSalesTrans.GetString(19); salesTransaction.StockReorderUnit = drSalesTrans.IsDBNull(20) ? 0 : (int)drSalesTrans.GetInt32(20); } } return(salesTransaction); } catch (Exception ex) { throw ex; } finally { colParameters = null; } }
public List <SpoilDto> GetRangeUnsyncedSpoil(String count, int status, bool syncReady) { String tsql = $@"SELECT TOP {count} spl.* FROM [Sync].[Spoils] spl WHERE spl.SyncStatus = @p0 AND spl.IsSyncReady = @p1"; List <SpoilDto> txnSpoilList = new List <SpoilDto>(); try { // Structure Parameter Array var colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@p0", status), new DBHelper.Parameters("@p1", syncReady) }; using (IDataReader drSalesTrans = this.ExecuteReader(CommandType.Text, tsql, colParameters)) { while (drSalesTrans.Read()) { var spoiltDto = new SpoilDto(); spoiltDto.Id = drSalesTrans.GetGuid(0); spoiltDto.TransactionRefNo = drSalesTrans.GetString(1); spoiltDto.StockRefNo = drSalesTrans.GetInt32(2); spoiltDto.StockDetails = drSalesTrans.IsDBNull(3) ? null : drSalesTrans.GetString(3); spoiltDto.StockUnit = drSalesTrans.GetInt32(4); spoiltDto.StockUnitLeft = drSalesTrans.IsDBNull(5) ? null : (Int32?)drSalesTrans.GetInt32(5); spoiltDto.IsSyncReady = drSalesTrans.GetBoolean(6); spoiltDto.SyncStatus = drSalesTrans.GetInt32(7); spoiltDto.SpoilDetails = drSalesTrans.IsDBNull(8) ? null : drSalesTrans.GetString(8); spoiltDto.ReasonSyncFailed = drSalesTrans.IsDBNull(9) ? null : drSalesTrans.GetString(9); spoiltDto.ReportedBy = drSalesTrans.IsDBNull(10) ? null : drSalesTrans.GetString(10); spoiltDto.SyncRefCreatedOn = drSalesTrans.IsDBNull(11) ? null : (DateTime?)drSalesTrans.GetDateTime(11); spoiltDto.SyncRefModifiedOn = drSalesTrans.IsDBNull(12) ? null : (DateTime?)drSalesTrans.GetDateTime(12); spoiltDto.MachineName = drSalesTrans.IsDBNull(13) ? null : drSalesTrans.GetString(13); spoiltDto.SyncRefNo = drSalesTrans.IsDBNull(14) ? null : drSalesTrans.GetString(14); spoiltDto.SyncDate = drSalesTrans.IsDBNull(15) ? null : (DateTime?)drSalesTrans.GetDateTime(15); spoiltDto.SyncFailedCount = drSalesTrans.GetInt32(16); spoiltDto.RefCreatedDate = drSalesTrans.IsDBNull(17) ? null : (DateTime?)drSalesTrans.GetDateTime(17); spoiltDto.RefModifiedDate = drSalesTrans.IsDBNull(18) ? null : (DateTime?)drSalesTrans.GetDateTime(18); spoiltDto.Cost = drSalesTrans.IsDBNull(19) ? 0 : drSalesTrans.GetDouble(19); spoiltDto.CreatedOnUtc = drSalesTrans.GetDateTime(20); spoiltDto.ModifiedOnUtc = drSalesTrans.IsDBNull(21) ? null : (DateTime?)drSalesTrans.GetDateTime(21); //drSalesTrans.GetBytes(23, 0, spoiltDto.RowVersion, 0, 18); txnSpoilList.Add(spoiltDto); } } } catch (Exception ex) { throw ex; } return(txnSpoilList); }
public DbDataReader GetSpoiltBy(string transactionRefNo) { String tsql = @"SELECT TOP 1 spl.* FROM [Sync].[Spoils] spl WHERE spl.TransactionRefNo = @p0"; // Structure Parameter Array var colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@p0", transactionRefNo), }; return(this.ExecuteReader(CommandType.Text, tsql, colParameters)); }
public List <ReporteChildBE> ReporteUsoGetEmpresa(DBHelper pDBHelper) { List <ReporteChildBE> lst = null; ReporteChildBE obj = null; DBHelper.Parameters[] colParameters = null; lst = new List <ReporteChildBE>(); try { colParameters = new DBHelper.Parameters[] { }; pDBHelper.ClearParameter(); pDBHelper.CreateDBParameters(colParameters); using (IDataReader dr = pDBHelper.ExecuteReader(pDBHelper.concatOwner("ReporteUsoGetEmpresa"), CommandType.StoredProcedure, Utility.ConnectionState.CloseOnExit)) { // Leyendo reader while (dr.Read()) { obj = new ReporteChildBE(); obj.task = dr["Descripcion"].ToString(); StringBuilder sb = new StringBuilder(); sb.Append(dr["horas"].ToString().PadLeft(2, '0')); sb.Append(":"); sb.Append(dr["minutos"].ToString().PadLeft(2, '0')); obj.duration = sb.ToString(); obj.idEmpresa = int.Parse(dr["idEmpresa"].ToString()); lst.Add(obj); } } return(lst); } catch (Exception ex) { throw ex; } finally { //colParameters = null; if (pDBHelper != null && pDBHelper.Command.Transaction == null) { pDBHelper.Dispose(); } } }
public List <UsuarioBE> GetAll(DBHelper pDBHelper) { List <UsuarioBE> lst = null; UsuarioBE obj = null; DBHelper.Parameters[] colParameters = null; lst = new List <UsuarioBE>(); try { // Parámetros colParameters = new DBHelper.Parameters[] { }; pDBHelper.ClearParameter(); pDBHelper.CreateDBParameters(colParameters); using (IDataReader dr = pDBHelper.ExecuteReader(pDBHelper.concatOwner("UsuarioGetAll"), CommandType.StoredProcedure, Utility.ConnectionState.CloseOnExit)) { // Leyendo reader while (dr.Read()) { obj = new UsuarioBE(); obj.Id = int.Parse(dr["IdUsuario"].ToString()); obj.CuentaUsuario = dr["CuentaRed"].ToString(); obj.NombreCompleto = dr["NombreCompleto"].ToString(); obj.Activo = Convert.ToInt32(Convert.ToBoolean(dr["Activo"].ToString())); obj.IdEmpresa = int.Parse(dr["idEmpresa"].ToString()); obj.Email = dr["Email"].ToString(); obj.Confidencial = int.Parse(dr["Confidencial"].ToString()); lst.Add(obj); } } return(lst); } catch (Exception ex) { throw ex; } finally { colParameters = null; if (pDBHelper != null && pDBHelper.Command.Transaction == null) { pDBHelper.Dispose(); } } }
public List <DepartamentoBE> GetByIdEmpresa(DBHelper pDBHelper, DepartamentoBE pDepartamento) { List <DepartamentoBE> lst = null; DepartamentoBE obj = null; DBHelper.Parameters[] colParameters = null; lst = new List <DepartamentoBE>(); try { // Parámetros colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@IDEMPRESA", pDepartamento.IdEmpresa == Constantes.INT_NULO ? (object)DBNull.Value : pDepartamento.IdEmpresa) }; pDBHelper.ClearParameter(); pDBHelper.CreateDBParameters(colParameters); using (IDataReader dr = pDBHelper.ExecuteReader(pDBHelper.concatOwner("DepartamentoGetByIdEmpresa"), CommandType.StoredProcedure, Utility.ConnectionState.CloseOnExit)) { // Leyendo reader while (dr.Read()) { obj = new DepartamentoBE(); obj.Id = int.Parse(dr["IdDepartamento"].ToString()); obj.Descripcion = dr["Descripcion"].ToString(); obj.Sigla = dr["Sigla"].ToString(); lst.Add(obj); } } return(lst); } catch (Exception ex) { throw ex; } finally { colParameters = null; if (pDBHelper != null && pDBHelper.Command.Transaction == null) { pDBHelper.Dispose(); } } }
public IList <SpoilDto> RetrieveUnSyncedSpoils(string createdDate) { IList <SpoilDto> sList = null; SpoilDto spoilTransaction = null; DBHelper.Parameters[] colParameters = null; try { colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@EntryDate", createdDate), }; using (IDataReader spoilTrans = this.ExecuteReader(CommandType.StoredProcedure, "[Sync].[Sp_retrieveunsyncedspoils]", colParameters)) { sList = new List <SpoilDto>(); //Reading the reader one by one and setting into requestTypeInfo. while (spoilTrans.Read()) { spoilTransaction = new SpoilDto(); spoilTransaction.TransactionRefNo = spoilTrans.IsDBNull(0) ? null : spoilTrans.GetString(0); spoilTransaction.StockRefNo = spoilTrans.IsDBNull(1) ? 0 : (int)spoilTrans.GetInt32(1); spoilTransaction.SpoilDetails = spoilTrans.IsDBNull(2) ? null : spoilTrans.GetString(2); spoilTransaction.StockDetails = spoilTrans.IsDBNull(3) ? null : spoilTrans.GetString(3); spoilTransaction.ReportedBy = spoilTrans.IsDBNull(4) ? null : spoilTrans.GetString(4); spoilTransaction.StockUnit = spoilTrans.IsDBNull(5) ? 0 : (int)spoilTrans.GetInt32(5); spoilTransaction.IsDeleted = spoilTrans.IsDBNull(6) ? false : spoilTrans.GetBoolean(6); spoilTransaction.RefCreatedDate = spoilTrans.IsDBNull(7) ? null : (DateTime?)spoilTrans.GetDateTime(7); spoilTransaction.RefModifiedDate = spoilTrans.IsDBNull(8) ? null : (DateTime?)spoilTrans.GetDateTime(8); spoilTransaction.Cost = spoilTrans.IsDBNull(9) ? null : (Double?)spoilTrans.GetDecimal(9); sList.Add(spoilTransaction); } } return(sList); } catch (Exception ex) { throw ex; } finally { colParameters = null; } }
public MatrizEvaluacionBE MatricesEvaluacionGetByTablaVariableFilaColumna(DBHelper pDBHelper, string Tipo, string Variable, string Fila, string Columna) { MatrizEvaluacionBE MatrizEvaluacionBE = new MatrizEvaluacionBE(); DBHelper.Parameters[] colParameters = null; try { // Parámetros colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@Tipo", string.IsNullOrEmpty(Tipo) ? (object)DBNull.Value : Tipo), new DBHelper.Parameters("@Variable", string.IsNullOrEmpty(Variable) ? "" : Variable), new DBHelper.Parameters("@Fila", string.IsNullOrEmpty(Fila) ? "" : Fila), new DBHelper.Parameters("@Columna", string.IsNullOrEmpty(Columna) ? "" : Columna), }; pDBHelper.ClearParameter(); pDBHelper.CreateDBParameters(colParameters); using (IDataReader dataReader = pDBHelper.ExecuteReader(pDBHelper.concatOwner("MatricesEvaluacionGetByTablaVariableFilaColumna"), CommandType.StoredProcedure, Utility.ConnectionState.CloseOnExit)) { // Leyendo reader if (dataReader.Read()) { MatrizEvaluacionBE.Valor = dataReader["Valor"].ToString(); MatrizEvaluacionBE.Variable = dataReader["Variable"].ToString(); MatrizEvaluacionBE.Tabla = dataReader["Tipo"].ToString(); MatrizEvaluacionBE.Sumar = dataReader["Sumar"].ToString(); MatrizEvaluacionBE.Signo = dataReader["Signo"].ToString(); MatrizEvaluacionBE.Fila = dataReader["Fila"].ToString(); MatrizEvaluacionBE.Columna = dataReader["Columna"].ToString(); } } return(MatrizEvaluacionBE); } catch (Exception ex) { throw ex; } finally { colParameters = null; if (pDBHelper != null && pDBHelper.Command.Transaction == null) { pDBHelper.Dispose(); } } }
public void AddTransactionToSync(Guid Id, string reasonSyncFailed, string transactionRefNo, string currencyCode, string cashier, string machineName, DateTime?syncDate, int syncStatus, bool isSyncReady, string stockItemNo, string stockRefNo, string stockItemCode, string stockDetails, string stockCategoryRefNo, string stockCategoryLine, int?stockUnitLeft, int stockUnitPurchased, decimal stockUnitAmount, decimal stockCostAmount, double stockDiscountAmount, DateTime?refModifiedDate, DateTime?refCreatedDate, string customerName, string customerEmail, string customerAddress, string customerTel, int?customerGender, DateTime?customerDOB, string barcode, decimal taxAmount, DateTime createdOnUtc, DateTime?modifiedOnUtc, bool isDeleted, int syncFailedCount, string syncRefNo, DateTime?syncRefCreatedOn, DateTime?syncRefModifiedOn, int stockReorderUnit) { String tsql = @"[Sync].[Sp_AddTransactionToSync]"; var colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@Id", Id), new DBHelper.Parameters("@ReasonSyncFailed", reasonSyncFailed), new DBHelper.Parameters("@TransactionRefNo", transactionRefNo), new DBHelper.Parameters("@CurrencyCode", currencyCode), new DBHelper.Parameters("@Cashier", cashier), new DBHelper.Parameters("@MachineName", machineName), new DBHelper.Parameters("@SyncDate", syncDate), new DBHelper.Parameters("@SyncStatus", syncStatus), new DBHelper.Parameters("@IsSyncReady", isSyncReady), new DBHelper.Parameters("@StockItemNo", stockItemNo), new DBHelper.Parameters("@StockRefNo", stockRefNo), new DBHelper.Parameters("@StockDetails", stockDetails), new DBHelper.Parameters("@StockCategoryRefNo", stockCategoryRefNo), new DBHelper.Parameters("@StockCategoryLine", stockCategoryLine), new DBHelper.Parameters("@StockUnitPurchased", stockUnitPurchased), new DBHelper.Parameters("@StockUnitAmount", stockUnitAmount), new DBHelper.Parameters("@StockCostAmount", stockCostAmount), new DBHelper.Parameters("@StockDiscountAmount", stockDiscountAmount), new DBHelper.Parameters("@RefModifiedDate", refModifiedDate), new DBHelper.Parameters("@RefCreatedDate", refCreatedDate), new DBHelper.Parameters("@CustomerName", customerName), new DBHelper.Parameters("@CustomerAddress", customerAddress), new DBHelper.Parameters("@CustomerTel", customerTel), new DBHelper.Parameters("@CustomerGender", customerGender), new DBHelper.Parameters("@CustomerDOB", customerDOB), new DBHelper.Parameters("@Barcode", barcode), new DBHelper.Parameters("@TaxAmount", taxAmount), new DBHelper.Parameters("@CreatedOnUtc", createdOnUtc), new DBHelper.Parameters("@ModifiedOnUtc", modifiedOnUtc), new DBHelper.Parameters("@IsDeleted", isDeleted), new DBHelper.Parameters("@SyncFailedCount", syncFailedCount), new DBHelper.Parameters("@SyncRefNo", syncRefNo), new DBHelper.Parameters("@SyncRefCreatedOn", syncRefCreatedOn), new DBHelper.Parameters("@SyncRefModifiedOn", syncRefModifiedOn), new DBHelper.Parameters("@StockReorderUnit", stockReorderUnit) }; this.ExecuteNonQuery(CommandType.StoredProcedure, tsql, colParameters); }
public List <UsuarioBE> GetPermisosByIdUsuario(DBHelper pDBHelper, UsuarioBE oUsuario) { List <UsuarioBE> lst = null; UsuarioBE obj = null; DBHelper.Parameters[] colParameters = null; lst = new List <UsuarioBE>(); try { // Parámetros colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@IdUsuario", oUsuario.Id == Constantes.INT_NULO ? (object)DBNull.Value : oUsuario.Id) }; pDBHelper.ClearParameter(); pDBHelper.CreateDBParameters(colParameters); using (IDataReader dr = pDBHelper.ExecuteReader(pDBHelper.concatOwner("UsuarioGetPermisosByIdUsuario"), CommandType.StoredProcedure, Utility.ConnectionState.CloseOnExit)) { // Leyendo reader while (dr.Read()) { obj = new UsuarioBE(); obj.Id = int.Parse(dr["IdUsuario"].ToString()); obj.IdEmpresa = int.Parse(dr["IdEmpresa"].ToString()); obj.IdPerfil = int.Parse(dr["IdPerfil"].ToString()); lst.Add(obj); } } return(lst); } catch (Exception ex) { throw ex; } finally { colParameters = null; if (pDBHelper != null && pDBHelper.Command.Transaction == null) { pDBHelper.Dispose(); } } }
public AdjuntoBE GetByIdAdjunto(DBHelper pDBHelper, int IdAdjunto) { AdjuntoBE oAdjuntoBE = new AdjuntoBE(); DBHelper.Parameters[] colParameters = null; try { // Parámetros colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@IdAdjunto", IdAdjunto == Constantes.INT_NULO ? (object)DBNull.Value : IdAdjunto), }; pDBHelper.ClearParameter(); pDBHelper.CreateDBParameters(colParameters); using (IDataReader dataReader = pDBHelper.ExecuteReader(pDBHelper.concatOwner("AdjuntoGetById"), CommandType.StoredProcedure, Utility.ConnectionState.CloseOnExit)) { // Leyendo reader if (dataReader.Read()) { oAdjuntoBE.NombreAdjunto = dataReader["Nombre"].ToString(); oAdjuntoBE.AdjuntoFisico = (byte[])dataReader["Fisico"]; oAdjuntoBE.AdjuntoFileSize = Convert.ToInt32(dataReader["Tamano"]); oAdjuntoBE.AdjuntoFileType = dataReader["Tipo"].ToString(); oAdjuntoBE.IdAdjunto = Convert.ToInt32(dataReader["IdAdjunto"].ToString()); oAdjuntoBE.UsuarioCreacion = dataReader["UsuarioCreacion"].ToString(); oAdjuntoBE.FechaCreacion = Convert.ToDateTime(dataReader["FechaCreacion"]); oAdjuntoBE.UsuarioModificacion = dataReader["UsuarioModificacion"].ToString(); oAdjuntoBE.FechaModificacion = Convert.ToDateTime(dataReader["FechaModificacion"]); } } return(oAdjuntoBE); } catch (Exception ex) { throw ex; } finally { colParameters = null; if (pDBHelper != null && pDBHelper.Command.Transaction == null) { pDBHelper.Dispose(); } } }
public List <ValoresEvaluacionBE> ValoresEvaluacionGetAllByTipo(DBHelper pDBHelper, string Tipo) { List <ValoresEvaluacionBE> lst = null; ValoresEvaluacionBE obj = null; DBHelper.Parameters[] colParameters = null; lst = new List <ValoresEvaluacionBE>(); try { // Parámetros colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("Tipo", string.IsNullOrEmpty(Tipo) ? (object)DBNull.Value : Tipo), }; pDBHelper.ClearParameter(); pDBHelper.CreateDBParameters(colParameters); using (IDataReader dr = pDBHelper.ExecuteReader(pDBHelper.concatOwner("ValoresEvaluacionGetAllByTipo"), CommandType.StoredProcedure, Utility.ConnectionState.CloseOnExit)) { // Leyendo reader while (dr.Read()) { obj = new ValoresEvaluacionBE(); obj.Id = Convert.ToInt32(dr["IdValoresEvaluacion"].ToString()); obj.Valor = dr["Valor"].ToString(); lst.Add(obj); } } return(lst); } catch (Exception ex) { throw ex; } finally { colParameters = null; if (pDBHelper != null && pDBHelper.Command.Transaction == null) { pDBHelper.Dispose(); } } }
public void UpdateSyncTransaction(Guid Id, string barcode, string transactionRefNo, string cashier, string customerAddress, DateTime?customerDOB, string customerEmail, string customerName, int?customerGender, string customerTel, DateTime?refCreatedDate, DateTime?refModifiedDate, string stockCategoryLine, string stockCategoryRefNo, decimal stockCostAmount, string stockDetails, double stockDiscountAmount, string stockItemCode, string stockItemNo, string stockRefNo, decimal stockUnitAmount, int?stockUnitLeft, int stockUnitPurchased, decimal taxAmount, bool isDeleted, int stockReorderUnit, bool isSyncReady, int syncStatus) { String tsql = @"[Sync].[Sp_UpdateSyncTransactionByField]"; try { var colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@Id", Id), new DBHelper.Parameters("@TransactionRefNo", transactionRefNo), new DBHelper.Parameters("@Cashier", cashier), new DBHelper.Parameters("@SyncStatus", syncStatus), new DBHelper.Parameters("@IsSyncReady", isSyncReady), new DBHelper.Parameters("@StockItemNo", stockItemNo), new DBHelper.Parameters("@StockRefNo", stockRefNo), new DBHelper.Parameters("@StockItemCode", stockItemCode), new DBHelper.Parameters("@StockDetails", stockDetails), new DBHelper.Parameters("@StockCategoryRefNo", stockCategoryRefNo), new DBHelper.Parameters("@StockCategoryLine", stockCategoryLine), new DBHelper.Parameters("@StockUnitAmount", stockUnitAmount), new DBHelper.Parameters("@StockUnitLeft", stockUnitLeft), new DBHelper.Parameters("@StockUnitPurchased", stockUnitPurchased), new DBHelper.Parameters("@StockCostAmount", stockCostAmount), new DBHelper.Parameters("@StockDiscountAmount", stockDiscountAmount), new DBHelper.Parameters("@RefCreatedDate", refCreatedDate), new DBHelper.Parameters("@RefModifiedDate", refModifiedDate), new DBHelper.Parameters("@CustomerName", customerName), new DBHelper.Parameters("@CustomerEmail", customerEmail), new DBHelper.Parameters("@CustomerAddress", customerAddress), new DBHelper.Parameters("@CustomerTel", customerTel), new DBHelper.Parameters("@CustomerGender", customerGender), new DBHelper.Parameters("@CustomerDOB", customerDOB), new DBHelper.Parameters("@Barcode", barcode), new DBHelper.Parameters("@TaxAmount", taxAmount), new DBHelper.Parameters("@IsDeleted", isDeleted), new DBHelper.Parameters("@StockReorderUnit", stockReorderUnit), }; this.ExecuteNonQuery(CommandType.StoredProcedure, tsql, colParameters); } catch (DBConcurrencyException) { } }
public List <EstadoBE> GetByIdEstadoInicial(DBHelper pDBHelper, int IdEstadoInicial) { List <EstadoBE> oLista = new List <EstadoBE>(); DBHelper.Parameters[] colParameters = null; try { // Parámetros colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@IdEstado", IdEstadoInicial == Constantes.INT_NULO ? (object)DBNull.Value : IdEstadoInicial), }; pDBHelper.ClearParameter(); pDBHelper.CreateDBParameters(colParameters); using (IDataReader dataReader = pDBHelper.ExecuteReader(pDBHelper.concatOwner("EstadosGetByIdEstadoInicial"), CommandType.StoredProcedure, Utility.ConnectionState.CloseOnExit)) { // Leyendo reader while (dataReader.Read()) { EstadoBE oEstado = new EstadoBE(); oEstado.Id = Convert.ToInt32(dataReader["IdEstado"]); oEstado.Descripcion = dataReader["Descripcion"].ToString(); oLista.Add(oEstado); } } return(oLista); } catch (Exception ex) { throw ex; } finally { colParameters = null; if (pDBHelper != null && pDBHelper.Command.Transaction == null) { pDBHelper.Dispose(); } } }
public UsuarioBE GetPermisosByPuesto(DBHelper pDBHelper, string cuenta, int IdPuesto) { UsuarioBE Respuesta = new UsuarioBE(); DBHelper.Parameters[] colParameters = null; try { // Parámetros colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@IdPuesto", IdPuesto == Constantes.INT_NULO ? (object)DBNull.Value : IdPuesto), new DBHelper.Parameters("@CuentaRed", string.IsNullOrEmpty(cuenta) ? (object)DBNull.Value : cuenta) }; pDBHelper.ClearParameter(); pDBHelper.CreateDBParameters(colParameters); using (IDataReader dr = pDBHelper.ExecuteReader(pDBHelper.concatOwner("UsuarioGetPermisosByPuesto"), CommandType.StoredProcedure, Utility.ConnectionState.CloseOnExit)) { // Leyendo reader if (dr.Read()) { Respuesta.Id = Convert.ToInt32(dr["IdUsuario"].ToString()); Respuesta.CuentaUsuario = dr["CuentaRed"].ToString(); Respuesta.NombreCompleto = dr["NombreCompleto"].ToString(); Respuesta.IdPerfil = Convert.ToInt32(dr["IdPerfil"].ToString()); Respuesta.Perfil = dr["Perfil"].ToString(); } } return(Respuesta); } catch (Exception ex) { throw ex; } finally { colParameters = null; if (pDBHelper != null && pDBHelper.Command.Transaction == null) { pDBHelper.Dispose(); } } }
public GradeStructureBE GradeStructureGetByTotal(DBHelper pDBHelper, string Total) { GradeStructureBE GradeStructureBE = new GradeStructureBE(); DBHelper.Parameters[] colParameters = null; try { // Parámetros colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@Total", Convert.ToInt32(Total) == Constantes.INT_NULO ? (object)DBNull.Value : Convert.ToInt32(Total)), }; pDBHelper.ClearParameter(); pDBHelper.CreateDBParameters(colParameters); using (IDataReader dataReader = pDBHelper.ExecuteReader(pDBHelper.concatOwner("GradeStructureGetByTotal"), CommandType.StoredProcedure, Utility.ConnectionState.CloseOnExit)) { // Leyendo reader if (dataReader.Read()) { GradeStructureBE.IdGradeStructure = Convert.ToInt32(dataReader["IdGradeStructure"]); GradeStructureBE.Min = dataReader["Min"].ToString(); GradeStructureBE.Mid = dataReader["Mid"].ToString(); GradeStructureBE.Max = dataReader["Max"].ToString(); GradeStructureBE.Gs = dataReader["Gs"].ToString(); } } return(GradeStructureBE); } catch (Exception ex) { throw ex; } finally { colParameters = null; if (pDBHelper != null && pDBHelper.Command.Transaction == null) { pDBHelper.Dispose(); } } }
public List <AdjuntoBE> AdjuntoTemporalGetByIdCarga(DBHelper pDBHelper, string IdCarga) { List <AdjuntoBE> lst = new List <AdjuntoBE>(); DBHelper.Parameters[] colParameters = null; try { // Parámetros colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@IdCarga", string.IsNullOrEmpty(IdCarga) ? (object)DBNull.Value : IdCarga), }; pDBHelper.ClearParameter(); pDBHelper.CreateDBParameters(colParameters); using (IDataReader dr = pDBHelper.ExecuteReader(pDBHelper.concatOwner("AdjuntoTemporalGetByIdCarga"), CommandType.StoredProcedure, Utility.ConnectionState.CloseOnExit)) { // Leyendo reader while (dr.Read()) { AdjuntoBE AdjuntoBE = new BusinessEntities.AdjuntoBE(); AdjuntoBE.IdAdjunto = Convert.ToInt32(dr["IdAdjuntoTemporal"]); lst.Add(AdjuntoBE); } } return(lst); } catch (Exception ex) { throw ex; } finally { colParameters = null; if (pDBHelper != null && pDBHelper.Command.Transaction == null) { pDBHelper.Dispose(); } } }
public ValoresEvaluacionBE ValoresEvaluacionGetIdByDesc(DBHelper pDBHelper, string Descripcion, string Tipo) { ValoresEvaluacionBE ValoresEvaluacionBE = new ValoresEvaluacionBE(); DBHelper.Parameters[] colParameters = null; try { // Parámetros colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("descripcion", string.IsNullOrEmpty(Descripcion) ? (object)DBNull.Value :Descripcion), new DBHelper.Parameters("Tipo", string.IsNullOrEmpty(Tipo) ? (object)DBNull.Value : Tipo), }; pDBHelper.ClearParameter(); pDBHelper.CreateDBParameters(colParameters); using (IDataReader dataReader = pDBHelper.ExecuteReader(pDBHelper.concatOwner("ValoresEvaluacionGetIdByDesc"), CommandType.StoredProcedure, Utility.ConnectionState.CloseOnExit)) { // Leyendo reader if (dataReader.Read()) { ValoresEvaluacionBE.Id = Convert.ToInt32(dataReader["IdValoresEvaluacion"]); ValoresEvaluacionBE.Valor = dataReader["Valor"].ToString(); ValoresEvaluacionBE.Tipo = dataReader["Tipo"].ToString(); } } return(ValoresEvaluacionBE); } catch (Exception ex) { throw ex; } finally { colParameters = null; if (pDBHelper != null && pDBHelper.Command.Transaction == null) { pDBHelper.Dispose(); } } }
public int GetIdByDescSArAreDepEmp(DBHelper pDBHelper, string SubArea, string DescArea, string DescEmpresa, string DescDepartamento) { int Respuesta = -1; DBHelper.Parameters[] colParameters = null; try { // Parámetros colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@DescSubArea", string.IsNullOrEmpty(DescArea) ? (object)DBNull.Value : SubArea), new DBHelper.Parameters("@DescArea", string.IsNullOrEmpty(DescArea) ? (object)DBNull.Value : DescArea), new DBHelper.Parameters("@DescEmpresa", string.IsNullOrEmpty(DescEmpresa) ? (object)DBNull.Value : DescEmpresa), new DBHelper.Parameters("@DescDepartamento", string.IsNullOrEmpty(DescDepartamento) ? (object)DBNull.Value : DescDepartamento), }; pDBHelper.ClearParameter(); pDBHelper.CreateDBParameters(colParameters); using (IDataReader dr = pDBHelper.ExecuteReader(pDBHelper.concatOwner("SubAreaGetIdByDescSArAreDepEmp"), CommandType.StoredProcedure, Utility.ConnectionState.CloseOnExit)) { // Leyendo reader if (dr.Read()) { Respuesta = Convert.ToInt32(dr["IdSubArea"].ToString()); } } return(Respuesta); } catch (Exception ex) { throw ex; } finally { colParameters = null; if (pDBHelper != null && pDBHelper.Command.Transaction == null) { pDBHelper.Dispose(); } } }
public int GetIdByDesc(DBHelper pDBHelper, string descripcion) { int Respuesta = -1; DBHelper.Parameters[] colParameters = null; try { // Parámetros colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@descripcion", string.IsNullOrEmpty(descripcion) ? (object)DBNull.Value : descripcion) }; pDBHelper.ClearParameter(); pDBHelper.CreateDBParameters(colParameters); using (IDataReader dataReader = pDBHelper.ExecuteReader(pDBHelper.concatOwner("EstadosGetIdByDesc"), CommandType.StoredProcedure, Utility.ConnectionState.CloseOnExit)) { // Leyendo reader if (dataReader.Read()) { EstadoBE oEstado = new EstadoBE(); Respuesta = Convert.ToInt32(dataReader["IdEstado"]); } } return(Respuesta); } catch (Exception ex) { throw ex; } finally { colParameters = null; if (pDBHelper != null && pDBHelper.Command.Transaction == null) { pDBHelper.Dispose(); } } }
public DepartamentoBE GetByIdDepartamento(DBHelper pDBHelper, int IdDepartamento) { DepartamentoBE oDepartamento = new DepartamentoBE(); DBHelper.Parameters[] colParameters = null; try { // Parámetros colParameters = new DBHelper.Parameters[] { new DBHelper.Parameters("@IdDepartamento", IdDepartamento == Constantes.INT_NULO ? (object)DBNull.Value : IdDepartamento) }; pDBHelper.ClearParameter(); pDBHelper.CreateDBParameters(colParameters); using (IDataReader dr = pDBHelper.ExecuteReader(pDBHelper.concatOwner("DepartamentoGetByIdDep"), CommandType.StoredProcedure, Utility.ConnectionState.CloseOnExit)) { // Leyendo reader if (dr.Read()) { oDepartamento.Id = Convert.ToInt32(dr["IdDepartamento"].ToString()); oDepartamento.Descripcion = dr["Descripcion"].ToString(); oDepartamento.Sigla = dr["Sigla"].ToString(); } } return(oDepartamento); } catch (Exception ex) { throw ex; } finally { colParameters = null; if (pDBHelper != null && pDBHelper.Command.Transaction == null) { pDBHelper.Dispose(); } } }