Example #1
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            string name   = txtName.Text;
            string age    = txtAge.Text;
            string gender = ((ComboBoxItem)cbGender.SelectedItem).Content.ToString();

            string highest_edu = txtHEQ.Text;
            string percent     = txtHEG.Text;
            string password    = txtPassword.Password;
            string addr        = txtADDR.Text;
            string phone       = txtPHN.Text;
            string email       = txtEMAIL.Text;

            SCRIBE_REG item = new SCRIBE_REG {
                name = name, gender = gender, age = age, addr = addr, phone = phone, email = email, highest_edu = highest_edu, percent = percent
            };
            await App.MobileService.GetTable <SCRIBE_REG>().InsertAsync(item);

            MAIN_TABLE item1 = new MAIN_TABLE {
                email = email, password = password, category = "scribe"
            };
            await App.MobileService.GetTable <MAIN_TABLE>().InsertAsync(item1);
        }
        private async void search_Click(object sender, RoutedEventArgs e)
        {
            string day = date.Date.Day.ToString();



            string month     = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(date.Date.Month);
            string year      = date.Date.Year.ToString();
            string education = qualification.Text;
            string phGrade   = grade.Text;
            string pin       = pinCode.Text;

            if (pin.Length < 6 || Convert.ToInt32(phGrade) < 0)
            {
                txtArea.Visibility = Visibility.Visible;
                txtArea.Text       = "Check input";
            }
            else
            {
                List <string> a = new List <string>();

                List <SCRIBE_AVAIL> table = await App.MobileService.GetTable <SCRIBE_AVAIL>().ToListAsync();


                for (int i = 0; i < table.Count; i++)
                {
                    SCRIBE_AVAIL temp = table[i];
                    if (temp.month == month && temp.year == year && temp.day == day && temp.pincode == pin)
                    {
                        a.Add(temp.email);
                    }
                }

                List <string> to_Show = new List <string>();

                List <SCRIBE_REG> table1 = await App.MobileService.GetTable <SCRIBE_REG>().ToListAsync();

                for (int i = 0; i < a.Count; i++)
                {
                    string temp_email = a[i];
                    for (int j = 0; j < table1.Count; j++)
                    {
                        SCRIBE_REG temp = table1[j];
                        if (temp_email == temp.email && education == temp.highest_edu && Convert.ToInt32(phGrade) > Convert.ToInt32(temp.percent))
                        {
                            to_Show.Add(temp_email + "_" + temp.phone);
                        }
                    }
                }

                if (to_Show.Count < 1)
                {
                    txtArea.Visibility = Visibility.Visible;
                    txtArea.Text       = "No Scribes Available";
                }
                else
                {
                    txtArea.Visibility = Visibility.Visible;
                    for (int k = 0; k < to_Show.Count; k++)
                    {
                        txtArea.Text = txtArea.Text + "\n" + to_Show[k];
                    }
                }
            }
        }