コード例 #1
0
 /// <summary>
 /// Obtiene la lista de cuenta de gastos de ganado
 /// </summary>
 /// <param name="inicio"></param>
 /// <param name="limite"></param>
 private void ObtenerListaPrecioProducto(int inicio, int limite)
 {
     try
     {
         var precioProductoPL       = new PrecioProductoPL();
         PrecioProductoInfo filtros = Contexto;
         var pagina = new PaginacionInfo {
             Inicio = inicio, Limite = limite
         };
         ResultadoInfo <PrecioProductoInfo> resultadoInfo = precioProductoPL.ObtenerPorPagina(pagina, filtros);
         if (resultadoInfo != null && resultadoInfo.Lista != null &&
             resultadoInfo.Lista.Count > 0)
         {
             gridDatos.ItemsSource       = resultadoInfo.Lista;
             ucPaginacion.TotalRegistros = resultadoInfo.TotalRegistros;
         }
         else
         {
             ucPaginacion.TotalRegistros = 0;
             ucPaginacion.AsignarValoresIniciales();
             gridDatos.ItemsSource = new List <PrecioProductoInfo>();
         }
     }
     catch (ExcepcionGenerica)
     {
         SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.PrecioProducto_ErrorBuscar, MessageBoxButton.OK, MessageImage.Error);
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.PrecioProducto_ErrorBuscar, MessageBoxButton.OK, MessageImage.Error);
     }
 }
コード例 #2
0
 public PrecioProductoEdicion(PrecioProductoInfo precioProductoInfoSelecionado)
 {
     InitializeComponent();
     precioProductoInfoSelecionado.UsuarioModificaID = AuxConfiguracion.ObtenerUsuarioLogueado();
     Contexto = precioProductoInfoSelecionado;
     skAyudaOrganizacion.ObjetoNegocio = new OrganizacionPL();
     skAyudaProducto.ObjetoNegocio     = new ProductoPL();
     skAyudaProducto.IsEnabled         = false;
     skAyudaOrganizacion.IsEnabled     = false;
 }
コード例 #3
0
 /// <summary>
 /// Inicializa el Contexto
 /// </summary>
 private void InicializaContexto()
 {
     Contexto = new PrecioProductoInfo
     {
         UsuarioCreacionID = AuxConfiguracion.ObtenerUsuarioLogueado(),
         Organizacion      = new OrganizacionInfo(),
         PrecioMaximo      = 0,
         Producto          = new ProductoInfo()
     };
     skAyudaOrganizacion.ObjetoNegocio = new OrganizacionPL();
     skAyudaProducto.ObjetoNegocio     = new ProductoPL();
 }
コード例 #4
0
 /// <summary>
 /// Evento que se ejecuta mientras se esta cerrando la ventana
 /// </summary>
 /// <param name="e"></param>
 protected override void OnClosing(CancelEventArgs e)
 {
     if (confirmaSalir)
     {
         MessageBoxResult result = SkMessageBox.Show(this, Properties.Resources.Msg_CerrarSinGuardar, MessageBoxButton.YesNo,
                                                     MessageImage.Question);
         if (result == MessageBoxResult.Yes)
         {
             Contexto = null;
         }
         else
         {
             e.Cancel = true;
         }
     }
 }
コード例 #5
0
 public void Guardar(PrecioProductoInfo info)
 {
     try
     {
         Logger.Info();
         var precioProductoBL = new PrecioProductoBL();
         precioProductoBL.Guardar(info);
     }
     catch (ExcepcionGenerica)
     {
         throw;
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex);
     }
 }
コード例 #6
0
        internal static Dictionary <string, object> ObtenerParametrosGuardar(PrecioProductoInfo info)
        {
            Dictionary <string, object> parametros;

            try
            {
                Logger.Info();
                parametros = new Dictionary <string, object>
                {
                    { "@ProductoID", info.Producto.ProductoId },
                    { "@PrecioMaximo", info.PrecioMaximo },
                    { "@OrganizacionID", info.Organizacion.OrganizacionID },
                    { "@Activo", (int)info.Activo },
                    { "@UsuarioCreacionID", info.UsuarioCreacionID }
                };
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex);
            }
            return(parametros);
        }
コード例 #7
0
 internal void Guardar(PrecioProductoInfo info)
 {
     try
     {
         Dictionary <string, object> parameters = AuxPrecioProductoDAL.ObtenerParametrosGuardar(info);
         Create("[dbo].[PrecioProducto_Guardar]", 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);
     }
 }
コード例 #8
0
        /// <summary>
        /// Obtener por pagina
        /// </summary>
        /// <param name="pagina"></param>
        /// <param name="filtros"></param>
        /// <returns></returns>
        public ResultadoInfo <PrecioProductoInfo> ObtenerPorPagina(PaginacionInfo pagina, PrecioProductoInfo filtros)
        {
            try
            {
                Logger.Info();
                var precioProductoBL = new PrecioProductoBL();
                ResultadoInfo <PrecioProductoInfo> result = precioProductoBL.ObtenerPorPagina(pagina, filtros);

                return(result);
            }
            catch (ExcepcionGenerica)
            {
                throw;
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex);
            }
        }
コード例 #9
0
 internal static Dictionary <string, object> ObtenerParametrosPorPagina(PaginacionInfo pagina, PrecioProductoInfo filtros)
 {
     try
     {
         Logger.Info();
         var parametros =
             new Dictionary <string, object>
         {
             { "@OrganizacionID", filtros.Organizacion.OrganizacionID },
             { "@ProductoDescripcion", filtros.Producto.ProductoDescripcion },
             { "@Activo", filtros.Activo.GetHashCode() },
             { "@Inicio", pagina.Inicio },
             { "@Limite", pagina.Limite }
         };
         return(parametros);
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex);
     }
 }
コード例 #10
0
 internal ResultadoInfo <PrecioProductoInfo> ObtenerPorPagina(PaginacionInfo pagina, PrecioProductoInfo filtros)
 {
     try
     {
         Dictionary <string, object> parameters = AuxPrecioProductoDAL.ObtenerParametrosPorPagina(pagina, filtros);
         DataSet ds = Retrieve("[dbo].[PrecioProducto_ObtenerPorPagina]", parameters);
         ResultadoInfo <PrecioProductoInfo> result = null;
         if (ValidateDataSet(ds))
         {
             result = MapPrecioProductoDAL.ObtenerPorPagina(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);
     }
 }