public static IList<clsTipoObjeciones> ListarTipoObjeciones(bool activo) { IList<clsTipoObjeciones> lista = new List<clsTipoObjeciones>(); clsTipoObjeciones objecion; SqlDataReader objReader = null; SqlParameter[] objParams; try { objParams = SqlHelperParameterCache.GetSpParameterSet(BaseDatos.GetConexion(), "SP_C_TIPO_OBJECIONES"); objParams[0].Value = activo; objReader = SqlHelper.ExecuteReader(BaseDatos.GetConexion(), "SP_C_TIPO_OBJECIONES", objParams); while (objReader.Read()) { objecion = new clsTipoObjeciones(); objecion.Id = Convert.ToInt64(objReader["Id"]); objecion.Nombre = objReader["Descripcion"].ToString(); objecion.Estado = Convert.ToBoolean(objReader["Estado"]); objecion.FechaCreacion = Convert.ToDateTime(objReader["FechaCreacion"]); lista.Add(objecion); } } catch (Exception ex) { Base.Log.Log.EscribirLog(ex.Message); return null; } finally { if (objReader != null) objReader.Close(); } return lista; }
public static ResultadoTransaccion AsignarObjecionesTargetAccount(Int64 IdTargetAccount, clsTipoObjeciones objecion, SqlConnection conn, SqlTransaction transaction) { ResultadoTransaccion res = new ResultadoTransaccion(); try { objParams = SqlHelperParameterCache.GetSpParameterSet(conn, "SP_N_CLIENTES_TARGET_ACCOUNT_OBJECIONES"); objParams[0].Value = IdTargetAccount; objParams[1].Value = objecion.Id; SqlCommand command4 = new SqlCommand("SP_N_CLIENTES_TARGET_ACCOUNT_OBJECIONES", conn); command4.Transaction = transaction; command4.Parameters.AddRange(objParams); command4.CommandType = CommandType.StoredProcedure; command4.ExecuteNonQuery(); res.Estado = Enums.EstadoTransaccion.Aceptada; } catch (Exception ex) { res.Estado = Enums.EstadoTransaccion.Rechazada; res.Descripcion = ex.Message; Log.EscribirLog(ex.Message); } return res; }
public static clsTipoObjeciones ObtenerObjecionPorId(Int16 IdObjecion) { clsTipoObjeciones objecion = null; SqlDataReader objReader = null; SqlParameter[] objParams; try { objParams = SqlHelperParameterCache.GetSpParameterSet(BaseDatos.GetConexion(), "SP_C_TIPO_OBJECIONES_PORID"); objParams[0].Value = IdObjecion; objReader = SqlHelper.ExecuteReader(BaseDatos.GetConexion(), "SP_C_TIPO_OBJECIONES_PORID", objParams); while (objReader.Read()) { objecion = new clsTipoObjeciones(); objecion.Id = Convert.ToInt64(objReader["Id"]); objecion.Nombre = objReader["Descripcion"].ToString(); objecion.Estado = Convert.ToBoolean(objReader["Estado"]); } } catch (Exception ex) { Base.Log.Log.EscribirLog(ex.Message); return null; } finally { if (objReader != null) objReader.Close(); } return objecion; }
public static IList<clsTipoObjeciones> ObtenerObjecionesTargetAccount(Int64 IdTargetAccount) { IList<clsTipoObjeciones> listado = new List<clsTipoObjeciones>(); clsTipoObjeciones objecion = null; try { objParams = SqlHelperParameterCache.GetSpParameterSet(BaseDatos.NuevaConexion(), "SP_C_CLIENTES_TARGET_ACCOUNT_OBJECIONES"); objParams[0].Value = IdTargetAccount; DataSet ds = SqlHelper.ExecuteDataset(BaseDatos.NuevaConexion(), CommandType.StoredProcedure, "SP_C_CLIENTES_TARGET_ACCOUNT_OBJECIONES", objParams); if (ds != null && ds.Tables.Count > 0) { foreach (DataRow item in ds.Tables[0].Rows) { objecion = new clsTipoObjeciones(); objecion.Id = Convert.ToInt64(item["IdTipoObjecion"]); objecion.Nombre = item["Descripcion"].ToString(); objecion.FechaCreacion = Convert.ToDateTime(item["FechaCreacion"]); listado.Add(objecion); } } } catch (Exception ex) { Base.Log.Log.EscribirLog(ex.Message); } finally { BaseDatos.CerrarNuevaCOnexion(); } return listado; }