Example #1
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            Owner oOwner = new Owner();
            Token oToken = Token.GetInstance();

            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.OwnerProfile);

            lblName           = FindViewById <TextView>(Resource.Id.lblName);
            lblPhone          = FindViewById <TextView>(Resource.Id.lblPhone);
            lblMail           = FindViewById <TextView>(Resource.Id.lblMail);
            lblIdentification = FindViewById <TextView>(Resource.Id.lblIdentification);
            lblAddress        = FindViewById <TextView>(Resource.Id.lblAddress);
            btnAddPet         = FindViewById <Button>(Resource.Id.btnAddPet);

            Repository.Services.Service oService = new Repository.Services.Service();
            Owner.SetInstance(await oService.GetOwnerApi(oToken));
            oOwner                 = Owner.GetInstance();
            lblName.Text           = oOwner.firstName;
            lblPhone.Text          = oOwner.phone;
            lblMail.Text           = oOwner.email;
            lblIdentification.Text = oOwner.identificationNumber;
            lblAddress.Text        = oOwner.address;

            btnAddPet.Click += (e, v) =>
            {
                StartActivity(typeof(RegisterPetActivity));
            };
        }
Example #2
0
        private async void BtnIngresar_Click(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(txtPassword.Text) && !string.IsNullOrWhiteSpace(txtEmail.Text))
                {
                    Repository.Services.Service oService = new Repository.Services.Service();

                    var owner = await oService.LoginApi(txtEmail.Text, txtPassword.Text);

                    if (owner != null)
                    {
                        Owner.SetInstance(owner);
                        var welcome = $"Bienvenido {owner.firstName} a LostPests ";
                        Toast.MakeText(this, welcome, ToastLength.Long).Show();
                        StartActivity(typeof(OwnerProfileActivity));
                    }
                    else
                    {
                        Toast.MakeText(this, "Error en la autenticacion", ToastLength.Long).Show();
                    }
                }
                else
                {
                    Toast.MakeText(this, "Favor llenar los campos", ToastLength.Short).Show();
                }
            }
            catch (System.Exception ex)
            {
                Toast.MakeText(this, "Erro al conectar con el servicio" + ex.Message, ToastLength.Short).Show();
            }
        }
Example #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.RegisterPage);

            MapFragment oMapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);

            oMapFragment.GetMapAsync(this);

            oProfilePictureView = FindViewById <ProfilePictureView>(Resource.Id.ImgPro);
            txtCorreo           = FindViewById <EditText>(Resource.Id.txtCorreo);
            txtName             = FindViewById <EditText>(Resource.Id.txtName);
            btnRegistro         = FindViewById <Button>(Resource.Id.btnRegistro);
            txtCedula           = FindViewById <EditText>(Resource.Id.txtCedula);
            txtNumber           = FindViewById <EditText>(Resource.Id.txtNumber);

            oProfilePictureView.Click += OProfilePictureView_Click;


            oProfilePictureView.ProfileId = oOwner.facebookId;
            txtName.Text   = $"{oOwner.firstName} { oOwner.lastName}";
            txtCorreo.Text = oOwner.email;
            InitializeLocationManager();

            btnRegistro.Click += async delegate
            {
                Random random       = new Random();
                string randomNumber = string.Join(string.Empty, Enumerable.Range(0, 10).Select(number => random.Next(0, 9).ToString()));

                oOwner.firstName            = txtName.Text;
                oOwner.email                = txtCorreo.Text;
                oOwner.identificationNumber = randomNumber;
                oOwner.phone                = txtNumber.Text;
                Repository.Services.Service oService = new Repository.Services.Service();
                var _oOwner = await oService.RegisterApi(oOwner);
            };
        }