/// <summary>
 /// Handles the 1 event of the LogoutButton_Click control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
 private async void LogoutButton_Click_1(object sender, RoutedEventArgs e)
 {
     ((Frame)Window.Current.Content).Navigate(typeof(Login.LoginSel));
     string courseUplaodUri = "/AddDBLog?opr='Logout'&msg='" + Constants.User.NAME + "'";
     //ctx.UpdateObject(c);
     CloudEDUEntities ctx = new CloudEDUEntities(new Uri(Constants.DataServiceURI));
     try
     {
         TaskFactory<IEnumerable<bool>> tf = new TaskFactory<IEnumerable<bool>>();
         IEnumerable<bool> result = await tf.FromAsync(ctx.BeginExecute<bool>(new Uri(courseUplaodUri, UriKind.Relative), null, null), iar => ctx.EndExecute<bool>(iar));
     }
     catch
     {
     }
 }
Exemple #2
0
 public async void SetAttendTeachNumber()
 {
     try
     {
         ctx = new CloudEDUEntities(new Uri(Constants.DataServiceURI));
         teachDsq = (DataServiceQuery<COURSE_AVAIL>)(from course in ctx.COURSE_AVAIL
                                                     where course.TEACHER_NAME == this.NAME
                                                     select course);
         TaskFactory<IEnumerable<COURSE_AVAIL>> tf = new TaskFactory<IEnumerable<COURSE_AVAIL>>();
         IEnumerable<COURSE_AVAIL> attends = await tf.FromAsync(ctx.BeginExecute<COURSE_AVAIL>(
             new Uri("/GetAllCoursesAttendedByCustomer?customer_id=" + this.ID, UriKind.Relative), null, null),
             iar => ctx.EndExecute<COURSE_AVAIL>(iar));
         ATTEND_COUNT = attends.Count();
         IEnumerable<COURSE_AVAIL> teaches = await tf.FromAsync(teachDsq.BeginExecute(null, null), iar => teachDsq.EndExecute(iar));
         TEACH_COUNT = teaches.Count();
     }
     catch
     {
         ShowMessageDialog("Set Attend Teach Number ");
     }
 }