Beispiel #1
0
 //view selected assignment - deadline/questions/Seats/responses DEADLINE
 private void button3_Click(object sender, RibbonControlEventArgs e)
 {
     if (Globals.ThisAddIn.activeDb.Assignments.Any())
     {
         TopViewModel tvm = new TopViewModel(Globals.ThisAddIn.activeDb, (tvm2) => { Globals.ThisAddIn.responsesMarked -= tvm2.updateGrids; });
         Globals.ThisAddIn.responsesMarked += tvm.updateGrids;
         DeadlineQuestionsWindow dqw = new DeadlineQuestionsWindow(tvm);
         dqw.Show();
     }
     else
     {
         System.Windows.MessageBox.Show("you have not assigned any work yet", "", MessageBoxButton.OK);
     }
 }
Beispiel #2
0
        //opens DeadlineQuestionsWindow and hooks up events
        public SeatResponseWorker(MailItem mi, SchoolContext paramDb)
        {
            SchoolContext _db = paramDb;

            if (mi != null)
            {
                PDF _pdfAssignment = OutlookProvider.getAssignmentsFromMailItem(mi).FirstOrDefault();
                if (_pdfAssignment != null)
                {
                    Course             course              = _db.getCourse(_pdfAssignment, true);
                    Assignment         _assignment         = _db.getAssignment(_pdfAssignment, course, false);
                    List <OutlookSeat> senderAndRecipients = new List <OutlookSeat>();
                    senderAndRecipients.AddRange(OutlookSeat.getEmailNames(mi.Recipients));
                    if (mi.Sender != null)
                    {
                        senderAndRecipients.AddRange(OutlookSeat.getEmailNames(mi.Sender));
                    }

                    if (_assignment != null)
                    {
                        foreach (OutlookSeat en in senderAndRecipients)
                        {
                            Seat _Seat = _db.getSeat(en, null, false, true);
                            if (_Seat != null)
                            {
                                _deadline = _db.DeadlinesOfSeatAssignment(_Seat, _assignment).LastOrDefault();
                                if (_deadline != null)
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            DeadlineQuestionsWindow dqw = new DeadlineQuestionsWindow(_db);

            if (_deadline != null)
            {
                TopViewModel top = dqw.DataContext as TopViewModel;
                top.TCSs.selectedEntity = _deadline.TCS;
                top.TCSs.selectedViewModel.deadlines.selectedEntity = _deadline;
            }

            dqw.Closed += dqw_Closed;
            dqw.Show();
        }