コード例 #1
0
        private async void crear_mandado()
        {
            //Crear arreglo de rutas
            List <Manboss_mandados_ruta> rutas = new List <Manboss_mandados_ruta>();

            foreach (Lugares lugar in GlobalValues.arr_lugares)
            {
                Manboss_mandados_ruta aux = new Manboss_mandados_ruta();
                aux.Servicio    = lugar.Servicio;
                aux.Latitud     = lugar.Latitud;
                aux.Longitud    = lugar.Longitud;
                aux.Calle       = lugar.Calle;
                aux.Numero      = lugar.Numero;
                aux.Comentarios = lugar.Comentarios;
                aux.Terminado   = lugar.Terminado;
            }
            //Obtener datos de la sesión
            Context            mContext = Application.Context;
            ISharedPreferences prefs    = PreferenceManager.GetDefaultSharedPreferences(mContext);
            int cliente_id = prefs.GetInt("int", 0);
            //Crear mandado
            Manboss_mandado mandado = new Manboss_mandado();

            mandado.Estado           = 1;
            mandado.Cliente          = cliente_id;
            mandado.Total            = 0;
            mandado.Fecha            = DateTime.Now;
            mandado.Tipo_pago        = 0;
            mandado.Cuenta_pendiente = 0;
            //Enviar a base de datos
            await mandado_core.CrearMandado(rutas, mandado);
        }
コード例 #2
0
        public async Task <Manboss_cliente> GetClient(Manboss_mandado order)
        {
            this.order = order;
            Client     = await data.Client(order.Cliente);

            return(Client);
        }
コード例 #3
0
        public async Task <Manboss_mandado> ActiveOrder()
        {
            int repartidorID = User.Repartidor.Repartidor;

            order = await data.ActiveOrder(repartidorID, 3);

            if (order != null)
            {
                Client = await data.Client(order.Cliente);
            }

            return(order);
        }
コード例 #4
0
        private async void SetResources()
        {
            Dialogs.CreateProgressDialog(this, Resource.Style.AlertDialogDefault);
            Window.SetSoftInputMode(SoftInput.StateHidden);
            txt_Name      = FindViewById <TextView>(Resource.Id.txt_Name);
            txt_Direction = FindViewById <TextView>(Resource.Id.txt_Direction);
            txt_City      = FindViewById <TextView>(Resource.Id.txt_City);
            txt_Task      = FindViewById <TextView>(Resource.Id.txt_Task);
            txt_Detail    = FindViewById <TextView>(Resource.Id.txt_Detail);
            txt_TipoPago  = FindViewById <TextView>(Resource.Id.txt_TipoPago);

            mapView  = FindViewById <View>(Resource.Id.layoutMap);
            listView = FindViewById <View>(Resource.Id.layoutList);

            btn_Map  = FindViewById <Button>(Resource.Id.btn_Map);
            btn_List = FindViewById <Button>(Resource.Id.btn_List);

            img_Chat = FindViewById <ImageView>(Resource.Id.img_Chat);

            routeListView = FindViewById <ListView>(Resource.Id.TaskList);

            listView.Visibility = ViewStates.Gone;
            mapView.Visibility  = ViewStates.Visible;

            btn_Map.Click  += TabMap;
            btn_List.Click += TabList;
            img_Chat.Click += ShowChat;

            Manboss_mandado mandado = await core.ActiveOrder();

            if (mandado != null)
            {
                Manboss_cliente client = core.Client;
                chat          = new ChatInvoker(this, mandado.Id);
                txt_Name.Text = client.Nombre;
                txt_City.Text = map.GetCity(client.Latitud, client.Longitud);

                if (mandado.Tipo_pago == 0)
                {
                    txt_TipoPago.Text = "Efectivo";
                }
                else
                {
                    txt_TipoPago.Text = "Tarjeta";
                }

                SetMap();
            }
            Dialogs.DismissProgressDialog();
        }
コード例 #5
0
        public async Task <List <Manboss_mandado> > PendingOrders()
        {
            int repartidorID = User.Repartidor.Repartidor;

            orders = await data.PendingOrders(repartidorID, 2);

            active = await data.ActiveOrder(repartidorID, 3);

            if (active != null)
            {
                orders.Insert(0, active);
            }

            return(orders);
        }
コード例 #6
0
        public async Task <Manboss_mandado> GetMandado(int mandadoID)
        {
            Manboss_mandado mandado = null;

            try
            {
                Dictionary <string, string> param = new Dictionary <string, string>
                {
                    { "MandadoID", mandadoID.ToString() }
                };
                mandado = await client.InvokeApiAsync <Manboss_mandado>("Mandados/Mandados", HttpMethod.Post, param);
            }
            catch (Exception e)
            {
                string m = e.Message;
                Dialogs.BasicDialog("No se pudo establecer conexión", "Error en al Red", context);
            }
            return(mandado);
        }
コード例 #7
0
        public async Task <Manboss_mandado> ActiveOrder(int repartidorID, int estado)
        {
            Manboss_mandado mandado = null;

            try {
                Dictionary <string, string> param = new Dictionary <string, string>
                {
                    { "RepartidorID", repartidorID.ToString() },
                    { "Estado", estado.ToString() }
                };
                var mandados = await client.InvokeApiAsync <List <Manboss_mandado> >("MandadosActivos/Mandados", HttpMethod.Post, param);

                mandado = mandados[0];
            }
            catch (Exception e) {
                string m = e.Message;
            }
            return(mandado);
        }
コード例 #8
0
        public async Task <double> CompleteTask(Manboss_mandados_ruta r)
        {
            if (route.Count == 1)
            {
                ComissionsData cData = new ComissionsData(context);

                await data.SetOrder(order.Id, 4);

                await cData.AddComission(User.Repartidor.Repartidor, order.Id);

                Manboss_mandado aux = await cData.GetMandado(order.Id);

                return(aux.Total);
            }
            if (await data.CompleteTask(r.Id))
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
コード例 #9
0
        public async Task <Manboss_mandado> CrearMandado(List <Manboss_mandados_ruta> rutas, Manboss_mandado mandado)
        {
            Manboss_mandado ans = null;

            try
            {
                var rutas_aux   = JsonConvert.SerializeObject(rutas);
                var mandado_aux = JsonConvert.SerializeObject(mandado);
                Dictionary <string, string> param = new Dictionary <string, string>
                {
                    { "ruta", rutas_aux },
                    { "mandado", mandado_aux }
                };
                var current = await client.InvokeApiAsync <Manboss_mandado>("NuevoMandado/CrearMandado", HttpMethod.Post, param);

                ans = current;
            }
            catch (Exception e)
            {
                String error = e.ToString();
                return(null);
            }
            return(ans);
        }
コード例 #10
0
        public async Task <Manboss_mandado> CrearMandado(List <Manboss_mandados_ruta> rutas, Manboss_mandado mandado)
        {
            Manboss_mandado res = await data.CrearMandado(rutas, mandado);

            return(res);
        }
コード例 #11
0
 public void Display(Manboss_mandado order)
 {
     this.order = order;
     Display();
     SetResources();
 }
コード例 #12
0
        public async void GetOrder(int id)
        {
            Manboss_mandado order = await core.GetMandado(id);

            orderInvoker.Display(order);
        }