示例#1
0
        /// <summary>
        /// Handles the Tapped event of the noteInfo control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="TappedRoutedEventArgs"/> instance containing the event data.</param>
        private async void noteInfo_Tapped(object sender, TappedRoutedEventArgs e)
        {
            TextBlock tb     = sender as TextBlock;
            int       noteId = (int)tb.Tag;

            IEnumerable <LESSON> allLessons = null;

            try
            {
                DataServiceQuery <NOTE_AVAIL> naDsq = (DataServiceQuery <NOTE_AVAIL>)(from selNote in ctx.NOTE_AVAIL
                                                                                      where selNote.ID == noteId
                                                                                      select selNote);

                TaskFactory <IEnumerable <NOTE_AVAIL> > changeNote = new TaskFactory <IEnumerable <NOTE_AVAIL> >();
                changedNote = (await changeNote.FromAsync(naDsq.BeginExecute(null, null), iar => naDsq.EndExecute(iar))).FirstOrDefault();

                DataServiceQuery <LESSON> lessonDsq = (DataServiceQuery <LESSON>)(from selLesson in ctx.LESSON
                                                                                  where selLesson.COURSE_ID == course.ID
                                                                                  select selLesson);
                TaskFactory <IEnumerable <LESSON> > lessonTf = new TaskFactory <IEnumerable <LESSON> >();
                allLessons = await lessonTf.FromAsync(lessonDsq.BeginExecute(null, null), res => lessonDsq.EndExecute(res));
            }
            catch
            {
                ShowMessageDialog("Seach failed or Network connection error26!");
                return;
            }
            List <string> allLessonString = new List <string>();

            foreach (var l in allLessons)
            {
                allLessonString.Add(l.TITLE);
            }

            addNotePopup.IsOpen = true;
            noteTitle.Text      = changedNote.TITLE;
            noteContent.Text    = changedNote.CONTENT;
            selectLessonComboBox.ItemsSource   = allLessonString;
            selectLessonComboBox.SelectedIndex = changedNote.LESSON_NUMBER - 1;
            sharableCheckBox.IsChecked         = changedNote.SHARE;

            changedLessonID = changedNote.LESSON_ID;
        }
示例#2
0
 public void AddToNOTE_AVAIL(NOTE_AVAIL nOTE_AVAIL)
 {
     base.AddObject("NOTE_AVAIL", nOTE_AVAIL);
 }
示例#3
0
 public static NOTE_AVAIL CreateNOTE_AVAIL(string cONTENT, int lESSON_ID, int ID, global::System.DateTime dATE, bool sHARE, string cOURSE_TITLE, string cUSTOMER_NAME, int cOURSE_ID, int lESSON_NUMBER)
 {
     NOTE_AVAIL nOTE_AVAIL = new NOTE_AVAIL();
     nOTE_AVAIL.CONTENT = cONTENT;
     nOTE_AVAIL.LESSON_ID = lESSON_ID;
     nOTE_AVAIL.ID = ID;
     nOTE_AVAIL.DATE = dATE;
     nOTE_AVAIL.SHARE = sHARE;
     nOTE_AVAIL.COURSE_TITLE = cOURSE_TITLE;
     nOTE_AVAIL.CUSTOMER_NAME = cUSTOMER_NAME;
     nOTE_AVAIL.COURSE_ID = cOURSE_ID;
     nOTE_AVAIL.LESSON_NUMBER = lESSON_NUMBER;
     return nOTE_AVAIL;
 }