private async void BtnSave_Clicked(object sender, EventArgs e)
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                var provincia = BoxProvincia.Text ?? "";
                var ciudad    = BoxCiudad.Text ?? "";
                var direccion = BoxDireccion.Text ?? "";
                var cp        = BoxCP.Text ?? "";

                if (await this.TextValidate(App.AppName, "Aceptar",
                                            new ValidateItem(provincia, "Ingresa un estado"),
                                            new ValidateItem(ciudad, "Ingresa tu ciudad"),
                                            new ValidateItem(direccion, "Ingresa tu direcicón"),
                                            new ValidateItem(cp, "Ingresa tu código postal")))
                {
                    var idusuario = App.Oauth != null?App.Oauth.IdUsuario.ToString() : "0";

                    DirectionResult result = await App.RestClient.Post <DirectionResult>(App.BaseUrl + "/Direction/Add", new Dictionary <string, object>
                    {
                        { "idusuario", idusuario },
                        { "direccion", direccion },
                        { "ciudad", ciudad },
                        { "codigopostal", cp },
                        { "provincia", provincia }
                    });

                    if (result != null)
                    {
                        await DisplayAlert(App.AppName, result.Message, "Aceptar");

                        DirectionResult direction = await App.RestClient.Get <DirectionResult>(App.BaseUrl + "/Direction/Get/" + App.Oauth.IdUsuario, new Dictionary <string, object> {
                        });

                        if (direction != null)
                        {
                            if (direction.Direccion != null)
                            {
                                App.Oauth.Direction = direction.Direccion;
                            }
                        }

                        App.SetPreferences(App.Oauth);
                        await Navigation.PopAsync();
                    }
                    else
                    {
                        await DisplayAlert(App.AppName, "No fue posible guardar los cambios, intente mas tarde", "Aceptar");
                    }
                }
            }
            else
            {
                await DisplayAlert(App.AppName, "Debes de tener una conexión a internet activa", "Aceptar");
            }
        }
 public FaceResult(int pos_x = 0, int pos_y = 0, int size = 0, int conf = 0)
     : base(pos_x, pos_y, size, conf)
 {
     this.direction   = null;
     this.age         = null;
     this.gender      = null;
     this.gaze        = null;
     this.blink       = null;
     this.expression  = null;
     this.recognition = null;
 }
Example #3
0
 public TrackingFaceResult(int pos_x = 0, int pos_y = 0, int size = 0, int conf = 0, int detection_id = 0, int tracking_id = 0)
     : base(pos_x, pos_y, size, conf, detection_id, tracking_id)
 {
     this.trackingresult = new TrackingResult(pos_x, pos_y, size, conf, detection_id, tracking_id);
     this.direction      = null;
     this.age            = null;
     this.gender         = null;
     this.gaze           = null;
     this.blink          = null;
     this.expression     = null;
     this.recognition    = null;
 }
Example #4
0
        private void CreateDirection()
        {
            var currentdirection = new Direction();

            if (App.Oauth.Direction != null)
            {
                currentdirection = App.Oauth.Direction;
            }

            Device.BeginInvokeOnMainThread(() =>
            {
                RootLayout.Children.Clear();
                Label info = new Label {
                    Text = "Tus pedidos necesitan una dirección"
                };
                RootLayout.Children.Add(info);
                StackLayout formulario = new StackLayout();
                Label labeldnicuit     = new Label {
                    Text = "Ingresa tu DNI o CUIT"
                };
                Entry boxdnicuit = new Entry {
                    Placeholder = "DNI o CUIT", Text = currentdirection != null ? currentdirection.Dnicuit : ""
                };
                Label labelempresa = new Label {
                    Text = "Nombre de la empresa con la que recibes tu paquetería."
                };
                Entry boxempresa = new Entry {
                    Placeholder = "DHL/FedEx", Text = currentdirection != null ? currentdirection.Empresa : ""
                };
                Label labeldireccion = new Label {
                    Text = "Ingresa tu dirección"
                };
                Entry boxdireccion = new Entry {
                    Placeholder = "Calle, No. Interior, No. Exterior", Text = currentdirection != null ? currentdirection.Direccion : ""
                };
                Label labelciudad = new Label {
                    Text = "Ingresa el nombre de tu ciudad"
                };
                Entry boxciudad = new Entry {
                    Placeholder = "Ciudad", Text = currentdirection != null ? currentdirection.Ciudad : ""
                };
                Label labelcp = new Label {
                    Text = "Código Postal"
                };
                Entry boxcp = new Entry {
                    Placeholder = "274883", Text = currentdirection != null ? currentdirection.CodigoPostal : ""
                };
                Label labelprovincia = new Label {
                    Text = "Ingresa el nombre de tu provincia"
                };
                Entry boxprovincia = new Entry {
                    Placeholder = "Provincia", Text = currentdirection != null ? currentdirection.Provincia : ""
                };
                Button btnsave = new Button {
                    Text = "Guardar"
                };
                btnsave.Clicked += async(s, e) =>
                {
                    var idusuario          = App.Oauth != null ? App.Oauth.IdUsuario.ToString() : "0";
                    DirectionResult result = await App.RestClient.Post <DirectionResult>(App.BaseUrl + "/Direction/Add", new Dictionary <string, object>
                    {
                        { "idusuario", idusuario },
                        { "dnicuit", boxdnicuit.Text ?? "" },
                        { "empresa", boxempresa.Text ?? "" },
                        { "direccion", boxdireccion.Text ?? "" },
                        { "ciudad", boxciudad.Text ?? "" },
                        { "codigopostal", boxcp.Text ?? "" },
                        { "provincia", boxprovincia.Text ?? "" }
                    });

                    if (result != null)
                    {
                        await DisplayAlert(App.AppName, result.Message, "Aceptar");

                        DirectionResult direction = await App.RestClient.Get <DirectionResult>(App.BaseUrl + "/Direction/Get/" + App.Oauth.IdUsuario, new Dictionary <string, object> {
                        });
                        if (direction != null)
                        {
                            if (direction.Direccion != null)
                            {
                                App.Oauth.Direction = direction.Direccion;
                                SetDirection(direction.Direccion);
                            }
                        }
                    }
                };
                formulario.Children.Add(labeldnicuit);
                formulario.Children.Add(boxdnicuit);
                formulario.Children.Add(labelempresa);
                formulario.Children.Add(boxempresa);
                formulario.Children.Add(labeldireccion);
                formulario.Children.Add(boxdireccion);
                formulario.Children.Add(labelciudad);
                formulario.Children.Add(boxciudad);
                formulario.Children.Add(labelcp);
                formulario.Children.Add(boxcp);
                formulario.Children.Add(labelprovincia);
                formulario.Children.Add(boxprovincia);
                formulario.Children.Add(btnsave);
                RootLayout.Children.Add(formulario);
            });
        }
Example #5
0
        private async void BtnLogin_Clicked(object sender, EventArgs e)
        {
            BtnLogin.IsEnabled = false;
            var alias    = BoxUser.Text ?? "";
            var password = BoxPassword.Text ?? "";

            if (CrossConnectivity.Current.IsConnected)
            {
                if (!string.IsNullOrEmpty(alias) && !string.IsNullOrEmpty(password))
                {
                    try
                    {
                        OauthResult result = await App.RestClient.Post <OauthResult>(App.BaseUrl + "/User/Oauth", new Dictionary <string, object>
                        {
                            { "alias", alias },
                            { "password", password }
                        });

                        if (result != null)
                        {
                            if (result.Code == 100)
                            {
                                DirectionResult direction = await App.RestClient.Get <DirectionResult>(App.BaseUrl + "/Direction/Get/" + result.IdUsuario, new Dictionary <string, object> {
                                });

                                App.Oauth          = result;
                                App.Oauth.Alias    = alias;
                                App.Oauth.Password = password;
                                if (direction != null)
                                {
                                    if (direction.Direccion != null)
                                    {
                                        App.Oauth.Direction = direction.Direccion;
                                    }
                                }
                                App.SetPreferences(App.Oauth);
                                await GoToPage(result);
                            }
                            else
                            {
                                await DisplayAlert(App.AppName, result.Message, "Aceptar");
                            }
                        }
                        else
                        {
                            await DisplayAlert(App.AppName, "No es posible acceder, intente más tarde", "Aceptar");
                        }
                    }
                    catch
                    {
                        await DisplayAlert(App.AppName, "No es posible acceder, intente más tarde", "Aceptar");
                    }
                }
                else
                {
                    await DisplayAlert(App.AppName, "Introduce los datos que se te piden", "Aceptar");
                }
            }
            else
            {
                await DisplayAlert(App.AppName, "Asegurate de tener conexión a internet", "Aceptar");
            }
            BtnLogin.IsEnabled = true;
        }