Exemplo n.º 1
0
        /// <summary>
        /// Called when the Binary Search Button is clicked.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button_Search_Click(object sender, EventArgs e)
        {
            //Get the input from the search bar.
            Student student = new Student(Input_Search.Text);

            //Search the Binary tree for the student.
            Node node = tree.Search(student);

            //If the search was successful.
            if (node != null)
            {
                //Set the student to slected in the table.
                StudentData.Rows[node.index].Selected = true;

                //Select the search box.
                Input_Search.SelectAll();
            }
            //The search was unsuccessful.
            else
            {
                //Alert the user that there was no match in the tree.
                MessageBox.Show("Couldn't Find '" + Input_Search.Text + "'");

                //Select the search box.
                Input_Search.SelectAll();
            }
        }
Exemplo n.º 2
0
 public void LoadDataLocal()
 {
     // Obtenemos las ordenes de la BD local
     listPlanillaItems = App.OrdenCargueDatabase.GetAllOrdenes(true, userId: Constants.CurrentUser.IdSolex);
     // Agregamos la lista al ListView
     ListView1.ItemsSource = listPlanillaItems;
     // Verificamos el número de registros
     if (listPlanillaItems.Count == 0)
     {
         Lbl_ListHistoricalPickups.Text = "Este dispositivo no registra tareas realizadas.";
         // Mostramos el mensaje de cero registros
         Lbl_ListHistoricalPickups.IsVisible = true;
     }
     // Ocultamos el spinner de carga
     ActivitySpinner.IsVisible = false;
     // Posicionamos el cursor en el buscador
     Input_Search.Focus();
 }
Exemplo n.º 3
0
 public void LoadDataLocal()
 {
     // Obtenemos las ordenes de cargue de la BD local
     listOrdenesItems = App.OrdenCargueDatabase.GetAllOrdenes(delivereds: false, userId: Constants.CurrentUser.IdSolex);
     // Agregamos la lista al ListView
     ListView1.ItemsSource = listOrdenesItems;
     // Comprobamos la cantidad de regitros
     if (listOrdenesItems.Count == 0)
     {
         // Mostramos el mensaje de cero registros
         Lbl_ListPickups.Text      = "Este dispositivo no tiene ordenes de cargue asignadas para el día de hoy.";
         Lbl_ListPickups.IsVisible = true;
     }
     else
     {
         // Ocultamos el mensaje
         Lbl_ListPickups.IsVisible = false;
     }
     // Posicionamos el cursor en el buscador
     Input_Search.Focus();
 }
Exemplo n.º 4
0
 public void LoadDataLocal()
 {
     // Obtenemos las guías de la BD local
     listPlanillaItems = App.GuiaDatabase.GetAllGuias(controlled: false, userId: Constants.CurrentUser.IdSolex);
     // Agregamos la lista al ListView
     ListView1.ItemsSource = listPlanillaItems;
     // Comprobamos la cantidad de regitros
     if (listPlanillaItems.Count == 0)
     {
         // Actualizamos el contenido del mensaje en pantalla
         Lbl_ListNotDelivereds.Text = "Este dispositivo no tiene guías asignadas para el día de hoy.";
         // Mostramos el mensaje de cero registros
         Lbl_ListNotDelivereds.IsVisible = true;
     }
     else
     {
         // Ocultamos el mensaje
         Lbl_ListNotDelivereds.IsVisible = false;
     }
     // Posicionamos el cursor en el buscador
     Input_Search.Focus();
 }
Exemplo n.º 5
0
        public void LoadData()
        {
            // Instanciamos el listado de guías desde el servidor
            List <ResponseGuia> Items = new List <ResponseGuia>();

            // Creamos un hilo de ejecución para consumir el servicio de las entregas
            Device.BeginInvokeOnMainThread(async() =>
            {
                // Activamos el spinner
                ActivitySpinner.IsVisible = true;
                // Consultamos las guías por número de placa en el servicio de Solex
                Items = await App.RestClient.GetGuiasByUser(Constants.CurrentUser.IdSolex.ToString(), "1");
                // Reseteamos el listado de entregas del usuario actual
                App.GuiaDatabase.DeleteAllGuias(Constants.CurrentUser.IdSolex, true);
                // Recorremos el array de objetos json que devuelve el servicio
                foreach (var Item in Items)
                {
                    // Creamos el objeto guía de la BD local
                    Guia guia = new Guia
                    {
                        IdGuia            = Item.GuiaId,
                        Placa             = Item.Placa,
                        PlanillaNumero    = Item.Planilla,
                        Sucursal          = Item.Sucursal,
                        GuiaNumero        = Item.Guia,
                        DANE              = Item.DANE,
                        Ciudad            = Item.Ciudad,
                        Destinatario      = Item.Destinatario,
                        DireccionDestino  = Item.DireccionDestino,
                        TelefonoCliente   = Item.TelefonoCliente,
                        Unidades          = Item.Unidades,
                        UltimoEstadoId    = Item.UltimoEstadoId,
                        FechaEntrega      = Item.FechaEntrega,
                        FechaLlegoAlPunto = Item.FechaLlegoAlPunto,
                        Receives          = Item.RecibeNombre,
                        Receives_Doc      = Item.RecibeDocumento
                    };
                    if (Item.Latitud != null && Item.Longitud != null)
                    {
                        guia.Latitud  = (Item.Latitud).ToString().Replace(",", ".");
                        guia.Longitud = (Item.Latitud).ToString().Replace(",", ".");
                    }
                    if (Item.UltimoEstadoId == Constants.ESTADO_GUIA_LLEGO_PUNTO)
                    {
                        guia.Arrival        = true;
                        guia.Controlled     = false;
                        guia.ArrivalDate    = Item.FechaLlegoAlPunto;
                        guia.ColorButtonRow = Constants.CODIGO_COLOR_LLEGADA_PUNTO;
                    }
                    else if (Item.UltimoEstadoId == Constants.ESTADO_GUIA_ENTREGA_BLU)
                    {
                        guia.Delivered      = true;
                        guia.Controlled     = true;
                        guia.DeliveredDate  = Item.FechaEntrega;
                        guia.ColorButtonRow = Constants.CODIGO_COLOR_ENTREGA_BLU;
                    }
                    else if (Item.UltimoEstadoId == Constants.ESTADO_GUIA_ENTREGA_PARCIAL)
                    {
                        guia.Delivered      = true;
                        guia.Controlled     = true;
                        guia.DeliveredDate  = Item.FechaEntrega;
                        guia.ColorButtonRow = Constants.CODIGO_COLOR_ENTREGA_PARCIAL;
                    }
                    else if (Item.UltimoEstadoId == Constants.ESTADO_GUIA_NO_ENTREGADA)
                    {
                        guia.Delivered      = false;
                        guia.Controlled     = true;
                        guia.ColorButtonRow = Constants.CODIGO_COLOR_NO_ENTREGADA;
                    }
                    else
                    {
                        guia.Arrival        = false;
                        guia.Controlled     = false;
                        guia.ColorButtonRow = Constants.CODIGO_COLOR_NO_ENTREGADA;
                    }
                    // Se asigna el id del usuario que esta controlando la planilla
                    guia.ControlledUserId = Constants.CurrentUser.IdSolex;
                    // Verificamos si ya existe el registro
                    var exist_guia = App.GuiaDatabase.GetGuiaByIdSolex(Item.GuiaId);
                    if (exist_guia != null)
                    {
                        // Asignamos el id para pdoer actualizar los datos de la guía
                        guia.Id = exist_guia.Id;
                    }
                    // Por último llamamos al método de la CRUD de guía,
                    // el cual se encarga de insertar o actualizar la guía según sea el caso
                    App.GuiaDatabase.SaveGuia(guia);
                }
                // Actualizamos los datos del ListView
                LoadDataLocal();
                // Ocultamos el spinner
                ActivitySpinner.IsVisible = false;
                // Posicionamos el cursor en el buscador
                Input_Search.Focus();
            });
        }
Exemplo n.º 6
0
        public void LoadData()
        {
            // Instanciamos el listado de ordenes de cargue desde el servidor
            List <ResponseOrdenCargue> Items = new List <ResponseOrdenCargue>();

            // Creamos un hilo de ejecución para consumir el servicio de las ordenes de cargue
            Device.BeginInvokeOnMainThread(async() =>
            {
                // Activamos el spinner
                ActivitySpinner.IsVisible = true;
                // Consultamos las ordenes de cargue por número de placa en el servicio de Solex
                Items = await App.RestClient.GetOrdenesCargueByUser(Constants.CurrentUser.IdSolex.ToString());
                // Reseteamos el listado de ordenes de cargue del usuario actual
                App.OrdenCargueDatabase.DeleteAllOrdenes(Constants.CurrentUser.IdSolex);
                // Recorremos el array de objetos json que devuelve el servicio
                foreach (var Item in Items)
                {
                    OrdenCargue orden = new OrdenCargue
                    {
                        OrdenId             = Item.OrdenId,
                        Placa               = Item.Placa,
                        Latitud             = Item.Latitud.ToString(),
                        Longitud            = Item.Longitud.ToString(),
                        PlanillaNumero      = Item.Planilla,
                        Sucursal            = Item.Sucursal,
                        DANE                = Item.DANE,
                        Ciudad              = Item.Ciudad,
                        Destinatario        = Item.Destinatario,
                        DireccionDestino    = Item.DireccionDestino,
                        NombreCliente       = Item.NombreCliente,
                        TelefonoCliente     = Item.TelefonoCliente,
                        UltimoEstadoId      = Item.UltimoEstadoId,
                        UnidadesProgramadas = Item.UnidadesProgramadas,
                        UnidadesRecogidas   = Item.UnidadesRecogidas,
                        FechaLlegoAlPunto   = Item.FechaLlegoAlPunto,
                        FechaAsignacion     = Convert.ToDateTime(Item.FechaAsignacion)
                    };
                    if (Item.Latitud != null && Item.Longitud != null)
                    {
                        orden.Latitud  = (Item.Latitud).ToString().Replace(",", ".");
                        orden.Longitud = (Item.Latitud).ToString().Replace(",", ".");
                    }
                    if (Item.UltimoEstadoId == Constants.ESTADO_ORDEN_LLEGO_PUNTO)
                    {
                        orden.Arrival        = true;
                        orden.Controlled     = false;
                        orden.ArrivalDate    = Item.FechaLlegoAlPunto;
                        orden.ColorButtonRow = Constants.CODIGO_COLOR_LLEGADA_PUNTO;
                    }
                    else if (Item.UltimoEstadoId == Constants.ESTADO_ORDEN_EXITOSA)
                    {
                        orden.Delivered      = true;
                        orden.Controlled     = true;
                        orden.DeliveredDate  = Item.FechaRecogida;
                        orden.ColorButtonRow = Constants.CODIGO_COLOR_ENTREGA_BLU;
                    }
                    else
                    {
                        orden.Delivered      = false;
                        orden.DeliveredDate  = null;
                        orden.Controlled     = false;
                        orden.ColorButtonRow = Constants.CODIGO_COLOR_NO_ENTREGADA;
                    }
                    // Se asigna el id del usuario que esta controlando la planilla
                    orden.ControlledUserId = Constants.CurrentUser.IdSolex;
                    // Verificamos si ya existe el registro
                    var exist_orden = App.OrdenCargueDatabase.GetOrdenCargueByIdSolex(Item.OrdenId);
                    if (exist_orden != null)
                    {
                        // Asignamos el id para pdoer actualizar los datos de la orden de cargue
                        orden.Id = exist_orden.Id;
                    }
                    // Por último llamamos al método de la CRUD de orden de cargue
                    // el cual se encarga de insertar o actualizar la orden de cargue según sea el caso
                    App.OrdenCargueDatabase.SaveOrdenCargue(orden);
                }
                // Actualizamos los datos del ListView
                LoadDataLocal();
                // Ocultamos el spinner
                ActivitySpinner.IsVisible = false;
                // Posicionamos el cursor en el buscador
                Input_Search.Focus();
            });
        }