Beispiel #1
0
        public SignupViewModel()
        {
            new_user = new User();
            new_user_addr = new Address();



            //DEBUG
            //new_user.username = "******";
            //new_user.email = "*****@*****.**";
            //new_user.language = "FR";
            //new_user.birthday = "1989-12-20";
            //passwd = "lolxdlol";
            //passwd_verif = passwd;

            do_signup = new SignupCommand(this);
        }
Beispiel #2
0
        async Task<Address> geocode(Address addr)
        {
            HttpClient client = new HttpClient();
            Exception exception = null;

            string address = addr.numberStreet.ToString() + " " + addr.street + " " + addr.zipcode + " " + addr.city;
            string url = "http://maps.google.com/maps/api/geocode/json?address=" + WebUtility.UrlEncode(address);

            try
            {
                var data = await client.GetStringAsync(url);
                var result = JObject.Parse(data);

                var lat = result["results"][0]["geometry"]["location"]["lat"];
                var lng = result["results"][0]["geometry"]["location"]["lng"];

                addr.lat = lat.ToString().Replace(",", ".");
                addr.lng = lng.ToString().Replace(",", ".");
                addr.latt = Double.Parse(lat.ToString());
                addr.lngg = Double.Parse(lng.ToString());

                return addr;
            }
            catch (Exception e)
            {
                exception = e;
            }
            if (exception != null)
                await new MessageDialog("Erreur lors de la récupération des coordonnées des concerts").ShowAsync();
            return addr;
        }
Beispiel #3
0
        async Task<bool> check_addr(Address addr)
        {
            // no addr, let's continue
            if ((addr.city == null || addr.city == "") &&
             (addr.complement == null || addr.complement == "") &&
             (addr.country == null || addr.country == "") &&
             (addr.numberStreet == null || addr.numberStreet == "") &&
             (addr.street == null || addr.street == "") &&
             (addr.zipcode == null || addr.zipcode == ""))
            {
                check_addr_nb = 1;
                return false;
            }

            // full addr
            if ((addr.city != null && addr.city != "") &&
                       (addr.complement != null && addr.complement != "") &&
                       (addr.country != null && addr.country != "") &&
                       (addr.numberStreet != null && addr.numberStreet != "") &&
                       (addr.street != null && addr.street != "") &&
                       (addr.zipcode != null && addr.zipcode != ""))
                return true;

            // INCOMPLETE ADDR
            await new MessageDialog("Merci de remplir tous les champs d'addresse").ShowAsync();
            check_addr_nb = -1;
            return false;
        }
Beispiel #4
0
 bool check_addr(Address addr)
 {
     if (addr == null)
         return false;
     if (addr.city == null || addr.complement == null || addr.country == null ||
         addr.numberStreet == null || addr.street == null || addr.zipcode == null)
     {
         // To reset addr (delete / new)
         edit_user.address = null;
         edit_user.address = new Address();
         return false;
     }
     return true;
 }