예제 #1
0
        // Step 4 = Retrieve All Courses
        private int GetCourses(CISLogin MyLogin)
        {
            // get the Action URL by retreiveing the login webpage and parsing
            // the page to find the POST Action= item.
            CISAction CISAction = new CISAction();
            string    ActionUrl = CISAction.PostURL(SelectedCollege.RequestURL);

            try
            {
                // Listen for events
                myCourses.MessageResults += new InformationalMessage(SendMessage);
                SendMessage(this, new Information("Requesting course(s) from Website."));
                try
                {
                    myCourses.AddFromCIS(MyLogin, ExcelClassSettings, ActionUrl);
                }
                catch (Exception ex)
                {
                    if (myCourses.Count() == 0)
                    {
                        string temp = ex.Message;
                        throw;
                    }
                    // otherwise continue to process what was found
                }


                // Are there any courses?
                if (myCourses.Count() > 0)
                {
                    CurrentCompletedStep = WizardStep.ClassesRetrieved;
                    SendMessage(this, new Information(myCourses.Count() + " course(s) retreived."));
                    try
                    {
                        // set Monday Date
                        ExcelRollSettings.FirstDay = Convert.ToDateTime(myCourses[0].StartDate);
                    }
                    catch
                    { }
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                // release events
                myCourses.MessageResults -= new InformationalMessage(SendMessage);
            }
            return(myCourses.Count());
        }
예제 #2
0
        // Notes: Completion marks
        // Step 1 - upon successful creation of this class
        // Step 2 - upon successful Verifaction of excel templates
        // Step 3 - upon successful retreval of YRQ (quarter) information
        // Step 4 - upon successful retreval Courses for the selected YRQ
        // Step 5 - upon successful outputting of desired formats
        public bool StepNext()
        {
            bool retval = true;

            switch (CurrentCompletedStep)
            {
            case WizardStep.Creation:
                VerifyTemplates();
                break;

            case WizardStep.VerifyTemplates:
                // Get all available quarters
                GetQuarters();
                CurrentCompletedStep = WizardStep.QuartersFound;
                break;

            case WizardStep.QuartersFound:
                // Get courses for selected quarters

                CISLogin myLogin = new CISLogin(UserSettings, SelectedQuarter);

                // retreive the courses
                int numberofcourses = GetCourses(myLogin);
                if (numberofcourses > 0)
                {
                    SendMessage(this, new Information(numberofcourses.ToString(CultureInfo.CurrentCulture) + " classes retrieved!"));
                    CurrentCompletedStep = WizardStep.ClassesRetrieved;
                }
                else
                {
                    retval = false;
                    SendMessage(this, new Information("You are not teaching any courses!"));
                }
                break;

            case WizardStep.ClassesRetrieved:
                try
                {
                    ExportClicker();
                    ExportMTG();
                    ExportWamap();
                    ExportWebAssign();
                    ExportOutlook();
                    ExportExcel();
                    ExportSuccessful = true;
                }
                catch
                {
                    throw;
                }
                finally
                {
                    CurrentCompletedStep = WizardStep.Output;
                }
                break;

            case WizardStep.Output:
                //Email_Usage();

                CurrentCompletedStep = WizardStep.CloseProgram;
                break;

            default:
                break;
            }

            return(retval);
        }