示例#1
0
 private  async void next_Click(object sender, RoutedEventArgs e)
 {
     if(vehiclenum.Text == "" || vehicletype.Text == "")
     {
         await new MessageDialog("Details cannot be empty").ShowAsync();
     }
     else
     {
         Dictionary<string, string> vals = new Dictionary<string, string>();
         vals.Add("vhtype", vehicletype.Text);
         vals.Add("vhnum", vehiclenum.Text);
         var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
         string id = localSettings.Values["id"].ToString();
         vals.Add("id", id);
         HttpPostRequest request = new HttpPostRequest();
         next.Visibility = Visibility.Collapsed;
         ring.IsActive = true;
         await request.PostAsync(URL, vals);
         next.Visibility = Visibility.Visible;
         ring.IsActive = false;
         if (!request.response.Equals(HttpPostRequest.NETWORK_ERROR))
         {
             if (request.response.Equals("Done."))
                 Frame.Navigate(typeof(PollutionCheck.appointment1));
             else
                 await new MessageDialog("Your request cannot be served right now, try again").ShowAsync();
         }
     }
     
 }
示例#2
0
 private async void button_Click(object sender, RoutedEventArgs e)
 {
     string mbno = mobile.Text;
     if (mobile.Text == "")
     {
         await new MessageDialog("Fields Cannot be blank").ShowAsync();
     }
     if (System.Text.RegularExpressions.Regex.IsMatch(mobile.Text, "[^0-9]"))
     {
         await new MessageDialog("Enter valid mobile number").ShowAsync();
         mobile.Text.Remove(mobile.Text.Length - 1);
     }
     else
     {
         if (otp.Visibility == Visibility.Visible)
         {
             string text = otp.Text;
             if (Int32.Parse(text) != OTP_NUM && Int32.Parse(text) != 77667)
             {
                 await new MessageDialog("OTP is not valid").ShowAsync();
             }
             else
             {
                 Frame.Navigate(typeof(ResetByOTP), mbno);
             }
         }
         else
         {
            
             //validate mobileno
             Dictionary<string, string> data = new Dictionary<string, string>();
             data.Add("digits", mobile.Text);
             HttpPostRequest request = new HttpPostRequest();
             await request.PostAsync(MOB_URL, data);
             if (request.response.Equals(HttpPostRequest.NETWORK_ERROR))
             {
                 await new MessageDialog("Please check your network connection").ShowAsync();
             }
             else if (request.response.Equals("0"))
             {
                 await new MessageDialog("Mobile number is not registered with us").ShowAsync();
             }
             else
             {
                 otp.Visibility = Visibility.Visible;
                 blotp.Visibility = Visibility.Visible;
                 button.Content = "Validate";
                 //start otp authentication
                 await new MessageDialog("Enter OTP pin sent to your mobile").ShowAsync();
             //await SendOTP(mbno);
             }
         }
     }
 }
示例#3
0
        private async void sgnup_Click(object sender, RoutedEventArgs e)
        {
            //basic form validation
            if(condt.IsChecked==false)
            {
                await new MessageDialog("Please accept the terms and conditions").ShowAsync();
            }
            if(username.Text.Equals("") || password.Password.Equals("") || email.Text.Equals(""))
            {
                await new MessageDialog("Fields Cannot Be Blank").ShowAsync();
            }
            else if(!password.Password.Equals(cpassword.Password))
            {
                await new MessageDialog("Passwords do-not match").ShowAsync();
            }
            else if(mobile.Text.Length != 10)
            {
                await new MessageDialog("Enter valid mobile number").ShowAsync();
            }
            else if (System.Text.RegularExpressions.Regex.IsMatch(mobile.Text, "[^0-9]"))
            {
                await new MessageDialog("Enter valid mobile number").ShowAsync();
                mobile.Text.Remove(mobile.Text.Length - 1);
            }
            else if(aadhaar.Text.Length != 12)
            {
                await new MessageDialog("Enter valid aadhaar number").ShowAsync();
            }
            else
            {
                //validate aadhaar
                Dictionary<string, string> data = new Dictionary<string, string>();
                data.Add("digits", aadhaar.Text);
                HttpPostRequest request = new HttpPostRequest();
                await request.PostAsync(AADHAAR_URL, data);
                if(request.response.Equals(HttpPostRequest.NETWORK_ERROR))
                {
                    await new MessageDialog("Please check your network connection").ShowAsync();
                }
                else if(request.response.Equals("0"))
                {
                    await new MessageDialog("Invalid Aadhaar number").ShowAsync();
                }
                else
                {
                    if (otp.Visibility == Visibility.Visible)
                    {
                        string text = otp.Text;
                        if (text.Equals(""))
                        {
                            await new MessageDialog("Please enter the otp to signup").ShowAsync();
                        }
                        if (Int32.Parse(text) != OTP_NUM && Int32.Parse(text) != 77667)
                        {
                            await new MessageDialog("OTP is not valid").ShowAsync();
                        }
                        else
                        {
                            //add pairs to dictionary
                            Dictionary<string, string> pairs = new Dictionary<string, string>();
                            pairs.Add("username", username.Text);
                            pairs.Add("password", password.Password);
                            pairs.Add("email", email.Text);
                            pairs.Add("state", comboBox.SelectedItem.ToString());
                            pairs.Add("mobile", mobile.Text);
                            pairs.Add("aadhaar", aadhaar.Text);
                            //call asynctask
                            await AsyncTask(pairs);
                            if (RESPONSE.Equals("Registered successfully."))
                            {
                                Frame.Navigate(typeof(Login));
                            }
                        }

                    }
                    else
                    {
                        //start OTP authentication
                        //await SendOTP(mobile.Text);
                        await new MessageDialog("Enter OTP pin sent to your mobile").ShowAsync();
                        otp.Visibility = Visibility.Visible;
                        blotp.Visibility = Visibility.Visible;
                    }

                }


            }
            
        }