예제 #1
0
 public MisTurnos(EmpaqueModel empaque)
 {
     em = empaque;
     InitializeComponent();
     Cargar();
     NavigationPage.SetBackButtonTitle(this, "MiTurnoAPP");
 }
예제 #2
0
 public MainPage(EmpaqueModel empaque)
 {
     this.empaque = empaque;
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
     this.Master = new Master(this.empaque);
     this.Detail = new NavigationPage(new Detail(this.empaque));
     App.MasterD = this;
 }
예제 #3
0
        private async Task CargaPerfil(EmpaqueModel emp)
        {
            string response = await Service.GetAllApi("api/supermarket");

            List <Supermercado> supermercados2 = JsonConvert.DeserializeObject <List <Supermercado> >(response);

            lblSuperm.ItemsSource = supermercados2;
            listaSuperm           = supermercados2;
            Supermercado super = new Supermercado();

            foreach (var item in listaSuperm as List <Supermercado> )
            {
                if (item.Id == empa.Supermarket)
                {
                    super = item;
                }
            }

            lblSuperm.SelectedItem = super;

            List <Genero> llenar = new List <Genero>();
            Genero        f      = new Genero()
            {
                Id   = 0,
                Sexo = "Femenino"
            };

            llenar.Add(f);

            Genero m = new Genero()
            {
                Id   = 1,
                Sexo = "Masculino"
            };

            llenar.Add(m);

            Genero o = new Genero()
            {
                Id   = 2,
                Sexo = "Otro"
            };

            llenar.Add(o);

            PckGender.ItemsSource   = llenar;
            PckGender.SelectedIndex = Convert.ToInt32(emp.Gender);
            lblRut.Text             = emp.Rut.ToString();
            lblEmail.Text           = emp.Email;
            lblName.Text            = emp.FirstName;
            lblLastname.Text        = emp.LastName;
            lblPass.Text            = emp.Password;
            dtpNacimiento.Date      = emp.BirthDate;
            lblAdress.Text          = emp.Address;
            lblPhone.Text           = emp.PhoneNumber.ToString();
            lblJobTitle.Text        = emp.JobTitle;
        }
예제 #4
0
        private async void Ingresar(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Email.Text))
            {
                await DisplayAlert("Error de Acceso", "Debe ingresar email valido.", "Ok");
            }

            if (string.IsNullOrEmpty(Pass.Text))
            {
                await DisplayAlert("Error de Acceso", "Debe ingresar contraseña.", "Ok");
            }
            waitActivityIndicator.IsRunning = true;


            EmpaqueModel empaque = new EmpaqueModel()
            {
                Email = Email.Text, Password = Pass.Text
            };

            try {
                HttpResponseMessage response = await Service.Post("api/User/Authenticate", empaque);

                if (response.StatusCode != System.Net.HttpStatusCode.NotFound)
                {
                    var empty = await Service.GetOneApi("api/User/Authenticate", empaque);

                    EmpaqueModel emp = JsonConvert.DeserializeObject <EmpaqueModel>(empty.ToString());



                    if (remenberMeSwitch.IsToggled)
                    {
                        //Settings.Empaque = emp.Email;
                        //Settings.EmpaquePass = emp.Password;
                        //Settings.Remember = true;
                        await sqllite.DeleteAll();

                        await sqllite.Insert <EmpaqueModel>(emp);

                        await Navigation.PushAsync(new MainPage(emp));
                    }

                    waitActivityIndicator.IsRunning = false;

                    await Navigation.PushAsync(new MainPage(emp));
                }

                else
                {
                    waitActivityIndicator.IsRunning = false;
                    await DisplayAlert("Error de Acceso", "Informacion de usuario no corresponde", "Ok");
                }
            }catch (Exception ex) {
                waitActivityIndicator.IsRunning = false;
                await DisplayAlert("Error de Acceso", "Compruebe conexion a internet   " + ex, "Ok");
            }
        }
예제 #5
0
 private async void Carga(EmpaqueModel empaque)
 {
     await CargaPerfil(empaque);
 }
예제 #6
0
 public MiPerfil(EmpaqueModel empaque)
 {
     this.empa = empaque;
     InitializeComponent();
     Carga(empa);
 }
예제 #7
0
        private async void Btn_EditarPerfil_Clicked(object sender, EventArgs e)
        {
            Btn_EditarPerfil.IsEnabled      = false;
            waitActivityIndicator.IsRunning = true;
            Supermercado super = new Supermercado();

            foreach (var item in listaSuperm as List <Supermercado> )
            {
                if (item.Equals(lblSuperm.SelectedItem))
                {
                    super.Id = item.Id;
                }
            }

            EmpaqueModel empaque = new EmpaqueModel()
            {
                Id          = empa.Id,
                Rut         = Convert.ToInt32(lblRut.Text.Replace(".", "").Replace("-", "")),
                Email       = lblEmail.Text,
                Password    = lblPass.Text,
                FirstName   = lblName.Text,
                LastName    = lblLastname.Text,
                BirthDate   = dtpNacimiento.Date,
                Gender      = PckGender.SelectedIndex,
                Address     = lblAdress.Text,
                PhoneNumber = Convert.ToInt32(lblPhone.Text),
                Supermarket = super.Id,
                JobTitle    = lblJobTitle.Text
            };

            try
            {
                HttpResponseMessage response = await Service.Put("api/user/" + empa.Id.ToString(), empaque);

                if (response.StatusCode != System.Net.HttpStatusCode.NotFound)
                {
                    waitActivityIndicator.IsRunning = false;
                    await DisplayAlert("Cambios Guardados", "Cambios realizados con éxito", "Ok");

                    Btn_EditarPerfil.IsEnabled = true;
                    return;
                }

                else
                {
                    waitActivityIndicator.IsRunning = false;
                    await DisplayAlert("Error de conexión", "Error inesperado al editar sus datos", "Ok");

                    Btn_EditarPerfil.IsEnabled = true;
                    return;
                }
            }

            catch (Exception ex)
            {
                Btn_EditarPerfil.IsEnabled = true;
                await DisplayAlert("Error de edición", "Error al editar empaque " + ex, "Ok");

                return;
            }
        }
예제 #8
0
 public Detail(EmpaqueModel empaque)
 {
     this.empa = empaque;
     InitializeComponent();
     Bienvenido.Text = string.Format("Bienvenid@ : {0} {1}", empaque.FirstName, empaque.LastName);
 }
예제 #9
0
 public Master(EmpaqueModel empaque)
 {
     this.empaque = empaque;
     InitializeComponent();
 }
예제 #10
0
 public ListaTurnos(EmpaqueModel empaque)
 {
     this.empaq = empaque;
     InitializeComponent();
     Cargar();
 }