Exemple #1
0
        /// <summary>
        /// Obtiene una lista de ingredientes
        /// Activo - Solo activos
        /// Inactivo - Solo inactivos
        /// Todos - Ambos
        /// </summary>
        /// <param name="ingrediente"></param>
        /// <param name="estatus"></param>
        /// <returns>Lista de IngredienteInfo</returns>
        internal List <IngredienteInfo> ObtenerPorFormula(IngredienteInfo ingrediente, EstatusEnum estatus)
        {
            List <IngredienteInfo> listaIngredientes = null;

            try
            {
                Logger.Info();
                Dictionary <string, object> parameters = AuxIngredienteDAL.ObtenerParametrosPorFormula(ingrediente, estatus);
                DataSet ds = Retrieve("Ingrediente_ObtenerPorFormula", parameters);
                if (ValidateDataSet(ds))
                {
                    listaIngredientes = MapIngredienteDAL.ObtenerPorFormula(ds);
                }
            }
            catch (ExcepcionDesconocida)
            {
                throw;
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }

            return(listaIngredientes);
        }
Exemple #2
0
 /// <summary>
 /// Metodo para Crear un registro de Ingrediente
 /// </summary>
 /// <param name="info">Valores de la entidad que será creada</param>
 internal int Crear(IngredienteInfo info)
 {
     try
     {
         Logger.Info();
         Dictionary <string, object> parameters = AuxIngredienteDAL.ObtenerParametrosCrear(info);
         int result = Create("Ingrediente_Crear", parameters);
         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);
     }
 }
Exemple #3
0
 /// <summary>
 /// Obtiene un lista paginada
 /// </summary>
 /// <param name="pagina"></param>
 /// <param name="filtro"></param>
 /// <returns></returns>
 internal ResultadoInfo <FormulaInfo> ObtenerPorPaginaFormula(PaginacionInfo pagina, IngredienteInfo filtro)
 {
     try
     {
         Dictionary <string, object> parameters = AuxIngredienteDAL.ObtenerParametrosPorPaginaFormula(pagina, filtro);
         DataSet ds = Retrieve("Ingrediente_ObtenerPorPaginaFormula", parameters);
         ResultadoInfo <FormulaInfo> result = null;
         if (ValidateDataSet(ds))
         {
             result = MapIngredienteDAL.ObtenerPorPaginaFormula(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);
     }
 }
Exemple #4
0
 /// <summary>
 /// Metodo para Crear un registro de Ingrediente
 /// </summary>
 /// <param name="listaIngredientes">Valores de la entidad que será creada</param>
 internal int GuardarIngredientesXML(List <IngredienteInfo> listaIngredientes)
 {
     try
     {
         Logger.Info();
         Dictionary <string, object> parameters = AuxIngredienteDAL.ObtenerParametrosGuardarIngredientesXML(listaIngredientes);
         int result = Create("Ingrediente_GuardarXML", parameters);
         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);
     }
 }
Exemple #5
0
 /// <summary>
 /// Obtiene un registro de Ingrediente
 /// </summary>
 /// <param name="descripcion">Descripción de la Ingrediente</param>
 /// <returns></returns>
 internal IngredienteInfo ObtenerPorDescripcion(string descripcion)
 {
     try
     {
         Logger.Info();
         Dictionary <string, object> parameters = AuxIngredienteDAL.ObtenerParametrosPorDescripcion(descripcion);
         DataSet         ds     = Retrieve("Ingrediente_ObtenerPorDescripcion", parameters);
         IngredienteInfo result = null;
         if (ValidateDataSet(ds))
         {
             result = MapIngredienteDAL.ObtenerPorDescripcion(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);
     }
 }
Exemple #6
0
 /// <summary>
 /// Obtiene un registro de Ingrediente
 /// </summary>
 /// <param name="ingredienteID">Identificador de la Ingrediente</param>
 /// <returns></returns>
 internal IngredienteInfo ObtenerPorIdOrganizacionFormulaProducto(int formula, int ProductoId, int OrganizacionID)
 {
     try
     {
         Logger.Info();
         Dictionary <string, object> parameters = AuxIngredienteDAL.ObtenerPorIdOrganizacionFormulaProducto(formula, ProductoId, OrganizacionID);
         DataSet         ds     = Retrieve("Ingrediente_ObtenerPorIdOrganizacionFormulaProducto", parameters);
         IngredienteInfo result = null;
         if (ValidateDataSet(ds))
         {
             result = MapIngredienteDAL.ObtenerPorIDOrganizacionFormulaProducto(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);
     }
 }
Exemple #7
0
 /// <summary>
 /// Obtiene una lista filtrando por el estatus Activo = 1, Inactivo = 0
 /// </summary>
 /// <returns></returns>
 internal IList <IngredienteInfo> ObtenerTodos(EstatusEnum estatus)
 {
     try
     {
         Logger.Info();
         Dictionary <string, object> parameters = AuxIngredienteDAL.ObtenerTodos(estatus);
         DataSet ds = Retrieve("Ingrediente_ObtenerTodos", parameters);
         IList <IngredienteInfo> result = null;
         if (ValidateDataSet(ds))
         {
             result = MapIngredienteDAL.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);
     }
 }
Exemple #8
0
        /// <summary>
        /// Obtiene un ingrediente por id
        /// Activo - Solo activos
        /// Inactivo - Solo inactivos
        /// Todos - Ambos
        /// </summary>
        /// <param name="ingrediente"></param>
        /// <param name="estatus"></param>
        /// <returns></returns>
        internal IngredienteInfo ObtenerPorId(IngredienteInfo ingrediente, EstatusEnum estatus)
        {
            try
            {
                Logger.Info();
                Dictionary <string, object> parameters = AuxIngredienteDAL.ObtenerParametrosPorId(ingrediente, estatus);
                DataSet ds = Retrieve("Ingrediente_ObtenerPorID", parameters);
                if (ValidateDataSet(ds))
                {
                    ingrediente = MapIngredienteDAL.ObtenerPorId(ds);
                }
            }
            catch (ExcepcionDesconocida)
            {
                throw;
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }

            return(ingrediente);
        }
Exemple #9
0
 /// <summary>
 /// Metodo para actualizar un registro de Ingrediente
 /// </summary>
 /// <param name="info">Valores de la entidad que se actualizarán</param>
 internal void Actualizar(IngredienteInfo info)
 {
     try
     {
         Logger.Info();
         Dictionary <string, object> parameters = AuxIngredienteDAL.ObtenerParametrosActualizar(info);
         Update("Ingrediente_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);
     }
 }