Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!ValidarConexionYUsuarioLogueado(sender))
            {
                return;
            }
            if (Session["connectionString"] == null || Session["USER"] == null)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "Logoff", "LogOff();", true);
                UiVistaReubicacion.JSProperties.Add("cpLocation", "Enable");
                return;
            }

            if (!IsPostBack)
            {
                UiFechaInicio.Value = DateTime.Today;
                UiFechaFinal.Value  = DateTime.Now;
                UsuarioDesesaObtenerReporte?.Invoke(sender, new InventarioArgumento {
                    Data = new Inventario {
                        START_DATE = DateTime.Today, END_DATE = DateTime.Now
                    }
                });
            }

            if (Session["UiVistaReubicacion"] != null)
            {
                UiVistaReubicacion.DataSource = Session["UiVistaReubicacion"];
                UiVistaReubicacion.DataBind();
                GenerarReporte();
            }

            VistaTerminoDeCargar?.Invoke(this, null);
        }
Ejemplo n.º 2
0
        protected void UiVistaReubicacion_CustomCallback(object sender, DevExpress.Web.ASPxGridViewCustomCallbackEventArgs e)
        {
            if (!ValidarConexionYUsuarioLogueado(sender))
            {
                return;
            }
            switch (e.Parameters.Split('-')[0])
            {
            case "ObtenerReporte":
                Inventario inventario = new Inventario();
                inventario.START_DATE = DateTime.Parse(UiFechaInicio.Value.ToString());
                inventario.END_DATE   = DateTime.Parse(UiFechaFinal.Value.ToString());

                if (inventario.START_DATE > inventario.END_DATE)
                {
                    UiVistaReubicacion.JSProperties.Add("cpError", "La fecha inicio es mayor a la fecha final");
                }
                else
                {
                    UsuarioDesesaObtenerReporte?.Invoke(sender, new InventarioArgumento {
                        Data = inventario
                    });
                }
                break;
            }
        }