Ejemplo n.º 1
0
        private void Move(string command)
        {
            var index = IndexControl.Get();
            var count = CountControl.Get();

            switch (command)
            {
            case Navigate.Bck: if (index > 0)
                {
                    IndexControl.Set(--index);
                }
                break;

            case Navigate.Fwd: if (index < count - 1)
                {
                    IndexControl.Set(++index);
                }
                break;

            case Navigate.Go:
                int newIndex;
                if (!int.TryParse(txtIndexControl.Text, out newIndex))
                {
                    newIndex = index + 1;
                }
                if (newIndex > 0 && newIndex <= count)
                {
                    IndexControl.Set(newIndex - 1);
                }
                break;
            }
            SetView(Views.Control);
        }
Ejemplo n.º 2
0
        private void SetView(int view)
        {
            switch (view)
            {
            case Views.Vehiculos:
                ListControl.Set(null);
                gridVehiculos.DataSource = VehiculosPendientes;
                gridVehiculos.DataBind();
                IndexControl.Set(0);
                break;

            case Views.Control:
                if (!VehiculosSeleccionados.Any())
                {
                    ShowError(string.Format(CultureManager.GetError("MUST_SELECT_VALUE"), CultureManager.GetEntity("PARENTI03")));
                    SetView(Views.Vehiculos);
                    return;
                }
                if (ListControl.Get() == null)
                {
                    var viajes = GetDistribuciones(VehiculosSeleccionados).Where(x => !x.Controlado).Select(v => v.Id).ToList();
                    ListControl.Set(viajes);
                    CountControl.Set(viajes.Count);
                }
                var index = IndexControl.Get();
                var count = CountControl.Get();

                var viaje = GetDistribucionAControlar(index);
                BindViaje(viaje);

                txtIndexControl.Text = (index + 1).ToString("#0");
                lblCountControl.Text = count.ToString("#0");
                btSiguiente.Visible  = index < count - 1;
                btAnterior.Visible   = index > 0;

                break;

            case Views.Resumen:
                var distribuciones = GetDistribuciones(new[] { -1 });
                var controladas    = distribuciones.Where(d => d.Controlado).Select(d => new ViajeDistribucionVo(d)).ToList();
                //var noControladas = distribuciones.Where(d => !d.Controlado).ToList();

                gridResumen.GroupedColumns.Clear();
                gridResumen.GroupedColumns.Add(gridResumen.Columns[0] as C1Field);
                gridResumen.DataSource = controladas;
                gridResumen.DataBind();
                break;
            }

            tab.ActiveTabIndex  = view;
            updCompleto.Visible = true;
            updCompleto.Update();
        }