Esempio n. 1
0
        /// <summary>
        ///     Obtiene un TipoCostoInfo por Id
        /// </summary>
        /// <param name="infoId"></param>
        /// <returns></returns>
        internal TipoCostoInfo ObtenerPorID(int infoId)
        {
            TipoCostoInfo result = null;

            try
            {
                Logger.Info();
                Dictionary <string, object> parameters = AuxTipoCostoDAL.ObtenerParametroPorID(infoId);
                DataSet ds = Retrieve("[dbo].[TipoCosto_ObtenerPorID]", parameters);
                if (ValidateDataSet(ds))
                {
                    result = MapTipoCostoDAL.ObtenerPorID(ds);
                }
            }
            catch (SqlException ex)
            {
                Logger.Error(ex);
                throw new ExcepcionServicio(MethodBase.GetCurrentMethod(), ex);
            }
            catch (DataException ex)
            {
                Logger.Error(ex);
                throw new ExcepcionServicio(MethodBase.GetCurrentMethod(), ex);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex);
            }
            return(result);
        }
Esempio n. 2
0
        /// <summary>
        ///  Obtiene una lista de TipoCosto filtrando por el estatus Activo = 1, Inactivo = 0
        /// </summary>
        /// <returns></returns>
        internal List <TipoCostoInfo> ObtenerTodos(EstatusEnum estatus)
        {
            List <TipoCostoInfo> result = null;

            try
            {
                Logger.Info();
                Dictionary <string, object> parameters = AuxTipoCostoDAL.ObtenerTodos(estatus);
                DataSet ds = Retrieve("TipoCosto_ObtenerTodos", parameters);
                if (ValidateDataSet(ds))
                {
                    result = MapTipoCostoDAL.ObtenerTodos(ds);
                }

                return(result);
            }
            catch (SqlException ex)
            {
                Logger.Error(ex);
                throw new ExcepcionServicio(MethodBase.GetCurrentMethod(), ex);
            }
            catch (DataException ex)
            {
                Logger.Error(ex);
                throw new ExcepcionServicio(MethodBase.GetCurrentMethod(), ex);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex);
            }
        }
Esempio n. 3
0
        /// <summary>
        ///     Obtiene un lista paginada
        /// </summary>
        /// <param name="pagina"></param>
        /// <param name="filtro"></param>
        /// <returns></returns>
        internal ResultadoInfo <TipoCostoInfo> ObtenerPorPagina(PaginacionInfo pagina, TipoCostoInfo filtro)
        {
            ResultadoInfo <TipoCostoInfo> costoLista = null;

            try
            {
                Dictionary <string, object> parameters = AuxTipoCostoDAL.ObtenerParametrosPorPagina(pagina, filtro);
                DataSet ds = Retrieve("TipoCosto_ObtenerPorPagina", parameters);
                if (ValidateDataSet(ds))
                {
                    costoLista = MapTipoCostoDAL.ObtenerPorPagina(ds);
                }
            }
            catch (SqlException ex)
            {
                Logger.Error(ex);
                throw new ExcepcionServicio(MethodBase.GetCurrentMethod(), ex);
            }
            catch (DataException ex)
            {
                Logger.Error(ex);
                throw new ExcepcionServicio(MethodBase.GetCurrentMethod(), ex);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex);
            }
            return(costoLista);
        }
Esempio n. 4
0
        /// <summary>
        ///     Metodo que crear un Tipo Costo
        /// </summary>
        /// <param name="info"></param>
        internal int Crear(TipoCostoInfo info)
        {
            int infoId;

            try
            {
                Logger.Info();
                Dictionary <string, object> parameters = AuxTipoCostoDAL.ObtenerParametrosGuardado(info);
                infoId = Create("[dbo].[TipoCosto_Crear]", parameters);
            }
            catch (SqlException ex)
            {
                Logger.Error(ex);
                throw new ExcepcionServicio(MethodBase.GetCurrentMethod(), ex);
            }
            catch (DataException ex)
            {
                Logger.Error(ex);
                throw new ExcepcionServicio(MethodBase.GetCurrentMethod(), ex);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex);
            }

            return(infoId);
        }
Esempio n. 5
0
 /// <summary>
 ///     Metodo que actualiza un Tipo Costo
 /// </summary>
 /// <param name="info"></param>
 internal void Actualizar(TipoCostoInfo info)
 {
     try
     {
         Dictionary <string, object> parameters = AuxTipoCostoDAL.ObtenerParametrosActualizar(info);
         Update("[dbo].[TipoCosto_Actualizar]", parameters);
     }
     catch (SqlException ex)
     {
         Logger.Error(ex);
         throw new ExcepcionServicio(MethodBase.GetCurrentMethod(), ex);
     }
     catch (DataException ex)
     {
         Logger.Error(ex);
         throw new ExcepcionServicio(MethodBase.GetCurrentMethod(), ex);
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex);
     }
 }