Exemple #1
0
        /// <summary>
        /// This method is used to change the current page to Home page and send a json file to verify the user credentials
        /// @author Mauricio C.
        /// </summary>
        private async void Button_Clicked(object sender, EventArgs e)
        {
            var userValidate = userEntry.Text;

            if (!string.IsNullOrEmpty(userValidate))
            {
                string     email    = userEntry.Text;
                string     password = "******" + CreateMD5(pasEntry.Text);
                HttpClient cliente  = new HttpClient();
                string     url      = "http://" + ip + ":6969/login/" + email + password;
                var        result   = await cliente.GetAsync(url);

                var json = result.Content.ReadAsStringAsync().Result;
                CookTime.REST_API_UserModel.User InputUser = new REST_API_UserModel.User();
                InputUser = CookTime.REST_API_UserModel.User.FromJson(json);
                if (InputUser.Name == null)
                {
                    await DisplayAlert("Cook Time", "The data you filled with does not match with any CookTime user. Please verify your info and try again!", "OK");
                }
                else
                {
                    CURRENTUSER = CookTime.REST_API_UserModel.User.FromJson(json);
                    await DisplayAlert("Cook Time", "Welcome back " + CURRENTUSER.Name, "OK");

                    await Navigation.PushAsync(new HomePage());
                }
            }
        }
Exemple #2
0
 /// <summary>
 /// This method opens a user, profile or company view pages in case one of those is selected
 /// @author Jose A.
 /// </summary>
 private void View_Recipe(object sender, EventArgs e)
 {
     if (Reference == 1)
     {
         REST_API_UserModel.User user = (REST_API_UserModel.User)ListaObjects.SelectedItem;
         Navigation.PushAsync(new ProfileView(user));
     }
     if (Reference == 2)
     {
         Recipe recipe = (Recipe)ListaObjects.SelectedItem;
         Navigation.PushAsync(new ViewRecipe(recipe));
     }
     if (Reference == 3)
     {
         Company company = (Company)ListaObjects.SelectedItem;
         Navigation.PushAsync(new CompanyProfileView(company));
     }
 }
Exemple #3
0
        /// <summary>
        /// This method simply updates the user information, everytime a change has been made to itself.
        /// @author Jose A.
        /// </summary>
        public static async void updateUser()
        {
            HttpClient cliente = new HttpClient();
            string     url     = "http://" + ip + ":6969/login/" + CURRENTUSER.Email + "/" + CURRENTUSER.Password;
            var        result  = await cliente.GetAsync(url);

            var json = result.Content.ReadAsStringAsync().Result;

            CookTime.REST_API_UserModel.User InputUser = new REST_API_UserModel.User();
            InputUser = CookTime.REST_API_UserModel.User.FromJson(json);
            if (InputUser.Name == null)
            {
                return;
            }
            else
            {
                CURRENTUSER = CookTime.REST_API_UserModel.User.FromJson(json);
            }
        }