private async void calenderTap(object sender, RoutedEventArgs e) { if (prev != null) { prev.Foreground = new SolidColorBrush(Colors.White); } TextBlock text1 = (TextBlock)e.OriginalSource; text1.Foreground = new SolidColorBrush(Colors.Red); prev = text1; //TODO GET DATE MONTH YEAR. String month = CalendarHeader.Text.Split(' ')[0]; String year = CalendarHeader.Text.Split(' ')[1]; TextBlock text = (TextBlock)e.OriginalSource; recent_tap = text.Text; 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.email == email && temp.month == month && temp.year == year && temp.day == recent_tap) { pincode.Text = temp.pincode; } } // retrive the text from DATABASE }
private async void btnSave_click(object sender, RoutedEventArgs e) { //TODO SAVE DATE string pincod = pincode.Text; string month = CalendarHeader.Text.Split(' ')[0]; string year = CalendarHeader.Text.Split(' ')[1]; // date present in recent_tap // email available in email variable. // UPDATE IF NOT APPEND IN Table. SCRIBE_AVAIL item = new SCRIBE_AVAIL { email = email, day = recent_tap, month = month, year = year, pincode = pincod }; List <SCRIBE_AVAIL> table = await App.MobileService.GetTable <SCRIBE_AVAIL>().ToListAsync(); bool updat = false; for (int i = 0; i < table.Count; i++) { SCRIBE_AVAIL temp = table[i]; if (temp.email == email && temp.month == month && temp.year == year && temp.day == recent_tap) { temp.pincode = pincod; updat = true; await App.MobileService.GetTable <SCRIBE_AVAIL>().UpdateAsync(temp); return; } } if (updat == false) { await App.MobileService.GetTable <SCRIBE_AVAIL>().InsertAsync(item); } }
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]; } } } }