Пример #1
0
        protected void UiVistaClienteConCambios_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
        {
            try
            {
                if (Session["UiVistaClienteConCambios"] == null)
                {
                    return;
                }

                if (e.VisibleIndex >= 0 && ((IList <ClienteConCambios>)Session["UiVistaClienteConCambios"]).Count != 0)
                {
                    switch (e.ButtonID)
                    {
                    case "Aceptar":
                        if (UiVistaClienteConCambios.GetRowValues(e.VisibleIndex, "STATUS").ToString() ==
                            Enums.GetStringValue(ScoutingEstado.Aceptado) ||
                            UiVistaClienteConCambios.GetRowValues(e.VisibleIndex, "STATUS").ToString() ==
                            Enums.GetStringValue(ScoutingEstado.Rechazado))
                        {
                            e.Visible = DefaultBoolean.False;
                        }

                        if (UiVistaClienteConCambios.GetRowValues(e.VisibleIndex, "STATUS").ToString() ==
                            Enums.GetStringValue(ScoutingEstado.Nuevo))
                        {
                            e.Visible = DefaultBoolean.True;
                        }
                        break;

                    case "Rechazar":
                        if (UiVistaClienteConCambios.GetRowValues(e.VisibleIndex, "STATUS").ToString() ==
                            Enums.GetStringValue(ScoutingEstado.Aceptado) ||
                            UiVistaClienteConCambios.GetRowValues(e.VisibleIndex, "STATUS").ToString() ==
                            Enums.GetStringValue(ScoutingEstado.Rechazado))
                        {
                            e.Visible = DefaultBoolean.False;
                        }

                        if (UiVistaClienteConCambios.GetRowValues(e.VisibleIndex, "STATUS").ToString() ==
                            Enums.GetStringValue(ScoutingEstado.Nuevo))
                        {
                            e.Visible = DefaultBoolean.True;
                        }
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                EstablecerError(ex.Message, UiVistaClienteConCambios.GetType());
            }
        }
Пример #2
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);
                return;
            }
            if (!IsPostBack)
            {
                UiFechaDeInicio.Value = DateTime.Today;
                UiFechaFinal.Value    = DateTime.Today;
            }

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

            UsuarioDeseaObtenerClientesConCambiosPorFecha?.Invoke(sender, new ClienteConCambiosArgumento {
                START_DATE = UiFechaDeInicio.Date, END_DATE = UiFechaFinal.Date
            });
        }
Пример #3
0
        protected void UiVistaClienteConCambios_CustomCallback(object sender, DevExpress.Web.ASPxGridViewCustomCallbackEventArgs e)
        {
            if (!ValidarConexionYUsuarioLogueado(sender))
            {
                return;
            }
            var customer = -100;

            switch (e.Parameters.Split('|')[0])
            {
            case "ObtenerClientesConCambios":
                var clienteConCambios = new ClienteConCambiosArgumento();

                clienteConCambios.START_DATE = DateTime.Parse(UiFechaDeInicio.Value.ToString());
                clienteConCambios.END_DATE   = DateTime.Parse(UiFechaFinal.Value.ToString());
                if (clienteConCambios.START_DATE > clienteConCambios.END_DATE)
                {
                    UiVistaClienteConCambios.JSProperties.Add("cpError", "La fecha inicio es mayor a la fecha final");
                }
                else
                {
                    UsuarioDeseaObtenerClientesConCambiosPorFecha?.Invoke(sender, new ClienteConCambiosArgumento {
                        START_DATE = UiFechaDeInicio.Date, END_DATE = UiFechaFinal.Date
                    });
                }
                break;

            case "CargarClienteConCambios":
                UsuarioDeseaObtenerClienteConCambios?.Invoke(sender,
                                                             new ClienteConCambiosArgumento
                {
                    Data = new ClienteConCambios {
                        CUSTOMER = Int32.Parse(e.Parameters.Split('|')[1])
                    }
                });

                break;

            case "AceptarScounting":
                customer = Int32.Parse(UiVistaClienteConCambios.GetRowValues(int.Parse(e.Parameters.Split('|')[1]), "CUSTOMER").ToString());
                UsuarioDeseaActualizarEstadoDeClienteConCambios?.Invoke(sender, new ClienteConCambiosArgumento
                {
                    Data = new ClienteConCambios {
                        CUSTOMER = customer, STATUS = "ACCEPTED"
                    },
                    LOGIN = Session["LOGIN"].ToString()
                });
                break;

            case "RechazarScouting":
                customer = Int32.Parse(UiVistaClienteConCambios.GetRowValues(int.Parse(e.Parameters.Split('|')[1]), "CUSTOMER").ToString());
                UsuarioDeseaActualizarEstadoDeClienteConCambios?.Invoke(sender, new ClienteConCambiosArgumento
                {
                    Data = new ClienteConCambios {
                        CUSTOMER = customer, STATUS = "REJECTED"
                    },
                    LOGIN = Session["LOGIN"].ToString()
                });
                break;

            case "UsuarioDeseaGuardar":
                customer = Int32.Parse(e.Parameters.Split('|')[1]);
                if (Session["UiVistaClienteConCambios"] == null)
                {
                    UiVistaClienteConCambios.JSProperties.Add("cpError", "El Cliente seleccionado no tiene Etiquetas asignadas, por favor agregue por lo menos una etiqueta.");
                }
                else
                {
                    GuardarDatosClienteConCambios(customer, sender);
                }
                break;
            }
        }