Exemple #1
0
 private void btnNext_Click(object sender, EventArgs e)
 {
     if (String.Equals(btnNext.Text, "&Finish", StringComparison.CurrentCultureIgnoreCase))
     {
         if (Validation.HasValidationErrors(Controls))
         {
             MessageBox.Show(@"Please ensure all required fields are populated", @"Required fields are missing",
                             MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             return;
         }
         try
         {
             Cursor = Cursors.WaitCursor;
             BaseWizardPresenter.SwitchScreenUpdating(false);
             RunPopulate();
         }
         catch (Exception ex)
         {
             OnError(ex);
         }
         finally
         {
             Cursor = Cursors.Default;
             BaseWizardPresenter.SwitchScreenUpdating(true);
         }
     }
     else
     {
         SwitchTab(tbcWizardScreens.SelectedIndex + 1);
     }
 }
        protected override void OnLoad(EventArgs e)
        {
            if (BaseWizardPresenter != null)
            {
                ProtectionType = BaseWizardPresenter.OnDocumentLoaded();

                Control[] coverPageLabel = Controls.Find("lblCoverPageTitle", true);
                if (coverPageLabel.Length == 1)
                {
                    string selectedCoverPage = BaseWizardPresenter.ReadDocumentProperty(Constants.WordDocumentProperties.CoverPageTitle);
                    coverPageLabel[0].Text = (String.IsNullOrEmpty(selectedCoverPage) ? coverPageLabel[0].Text : selectedCoverPage);
                }

                Control[] titleLabel = Controls.Find("lblLogoTitle", true);
                if (titleLabel.Length == 1)
                {
                    string selectedLogo = BaseWizardPresenter.ReadDocumentProperty(Constants.WordDocumentProperties.LogoTitle);
                    titleLabel[0].Text = (String.IsNullOrEmpty(selectedLogo) ? titleLabel[0].Text : selectedLogo);
                }


                BaseWizardPresenter.CloseInformationPanel(true);
            }

            CenterToScreen();
            CenterToParent();

            //Task.Factory.StartNew(() => Thread.Sleep(3000)).ContinueWith(task => this.Activate(), TaskScheduler.FromCurrentSynchronizationContext());
            base.OnLoad(e);
        }
        private IInsuranceManual GenerateTempalteObject()
        {
            var outProfile = false;

            bool.TryParse(BaseWizardPresenter.ReadDocumentProperty(Constants.WordDocumentProperties.ClientProfile),
                          out outProfile);
            //buid the marketing template
            var template = new InsuranceManual
            {
                DocumentTitle = BaseWizardPresenter.ReadDocumentProperty("Title"),
                //Constants.TemplateNames.InsuranceRenewalReport,
                DocumentSubTitle        = string.Empty,
                ClientName              = txtClientName.Text,
                ClientCommonName        = txtClientCommonName.Text,
                PeriodOfInsuranceFrom   = dtpPeriodOfInsuranceFrom.Text,
                PeriodOfInsuranceTo     = dtpPeriodOfInsuranceTo.Text,
                ExecutiveName           = txtExecutiveName.Text,
                ExecutiveEmail          = txtExecutiveEmail.Text,
                ExecutivePhone          = txtExecutivePhone.Text,
                ExecutiveTitle          = txtExecutiveTitle.Text,
                ExecutiveMobile         = txtExecutiveMobile.Text,
                ExecutiveDepartment     = txtExecutiveDepartment.Text,
                AssistantExecutiveName  = txtAssistantExecutiveName.Text,
                AssistantExecutiveTitle = txtAssistantExecutiveTitle.Text,
                AssistantExecutivePhone = txtAssistantExecutivePhone.Text,
                AssistantExecutiveEmail = txtAssistantExecutiveEmail.Text,
                AssistantExecDepartment = txtAssitantExecDepartment.Text,
                ClaimsExecutiveName     = txtClaimsExecutiveName.Text,
                ClaimsExecutiveTitle    = txtClaimsExecutiveTitle.Text,
                ClaimsExecutivePhone    = txtClaimsExecutivePhone.Text,
                ClaimsExecutiveEmail    = txtClaimsExecutiveEmail.Text,
                ClaimsExecDepartment    = txtClaimExecDepartment.Text,
                PopulateClientProfile   = outProfile,
                OtherContactName        = txtOtherContactName.Text,
                OtherContactTitle       = txtOtherContactTitle.Text,
                OtherContactPhone       = txtOtherContactPhone.Text,
                OtherContactEmail       = txtOtherContactEmail.Text,
                OtherExecDepartment     = txtOtherExecDepartment.Text,
                OAMPSBranchAddress      = txtBranchAddress1.Text,
                OAMPSBranchAddressLine2 = txtBranchAddress2.Text,
                DatePrepared            = DateTime.Now.ToString(@"dd/MM/yyyy"),
                SelectedPolicyClasses   = _selectedPolicyClasses
            };


            var baseTemplate = (BaseTemplate)template;
            var logoTab      = tbcWizardScreens.TabPages[Constants.ControlNames.TabPageLogosName];

            PopulateLogosToTemplate(logoTab, ref baseTemplate);

            var covberTab =
                tbcWizardScreens.TabPages[Constants.ControlNames.TabPageCoverPagesName];

            PopulateCoversToTemplate(covberTab, ref baseTemplate);


            template.PopulateClientProfile = _populateClientProfile;

            return(template);
        }
        private void btnNext_Click(object sender, EventArgs e)
        {
            if (String.Equals(btnNext.Text, "&Finish", StringComparison.CurrentCultureIgnoreCase))
            {
                try
                {
                    Cursor = Cursors.WaitCursor;
                    BaseWizardPresenter.SwitchScreenUpdating(false);
                    //call presenter to populate
                    PopulateDocument();
                }
                catch (Exception ex)
                {
                    OnError(ex);
                }
                finally
                {
                    Cursor = Cursors.Default;
                    BaseWizardPresenter.SwitchScreenUpdating(true);
                    //thie information panel loads when a document is in sharePoint that has metadata
                    //clients don't wish to see this so force the close of the panel once the wizard completes.
                    _wizardPresenter.CloseInformationPanel();
                }


                Close();
            }
            else
            {
                SwitchTab(tbcWizardScreens.SelectedIndex + 1);
            }
        }
 public virtual void PopulateDocument(IBaseTemplate template, string previousCoverPageTitle, string previousLogoTitle)
 {
     //populate the content controls
     BaseWizardPresenter.PopulateData(template);
     //change the graphics selected
     // if (Streams == null) return;
     BaseWizardPresenter.PopulateGraphics(template, previousCoverPageTitle, previousLogoTitle);
     BaseWizardPresenter.UpdateFields();
 }
 protected override void OnClosed(EventArgs e)
 {
     base.OnClosed(e);
     ThisAddIn.IsWizzardRunning = false;
     if (BaseWizardPresenter != null)
     {
         BaseWizardPresenter.OnDocumentLoadCompleted(ProtectionType);
     }
 }
        private FactFinder GenerateTempalteObject()
        {
            //buid the marketing template
            var template = new FactFinder
            {
                DocumentTitle             = BaseWizardPresenter.ReadDocumentProperty("Title"), //Constants.TemplateNames.InsuranceRenewalReport,
                DocumentSubTitle          = string.Empty,
                ClientName                = txtClientName.Text,
                ClientCommonName          = txtClientCommonName.Text,
                PeriodOfInsuranceFrom     = dtpPeriodOfInsuranceFrom.Text,
                PeriodOfInsuranceTo       = dtpPeriodOfInsuranceTo.Text,
                ExecutiveName             = txtExecutiveName.Text,
                ExecutiveEmail            = txtExecutiveEmail.Text,
                ExecutivePhone            = txtExecutivePhone.Text,
                ExecutiveTitle            = txtExecutiveTitle.Text,
                ExecutiveMobile           = txtExecutiveMobile.Text,
                ExecutiveDepartment       = txtExecutiveDepartment.Text,
                AssistantExecutiveName    = txtAssistantExecutiveName.Text,
                AssistantExecutiveTitle   = txtAssistantExecutiveTitle.Text,
                AssistantExecutivePhone   = txtAssistantExecutivePhone.Text,
                AssistantExecutiveEmail   = txtAssistantExecutiveEmail.Text,
                AssistantExecDepartment   = txtAssitantExecDepartment.Text,
                ClaimsExecutiveName       = txtClaimsExecutiveName.Text,
                ClaimsExecutiveTitle      = txtClaimsExecutiveTitle.Text,
                ClaimsExecutivePhone      = txtClaimsExecutivePhone.Text,
                ClaimsExecutiveEmail      = txtClaimsExecutiveEmail.Text,
                ClaimsExecDepartment      = txtClaimExecDepartment.Text,
                OtherContactName          = txtOtherContactName.Text,
                OtherContactTitle         = txtOtherContactTitle.Text,
                OtherContactPhone         = txtOtherContactPhone.Text,
                OtherContactEmail         = txtOtherContactEmail.Text,
                OtherExecDepartment       = txtOtherExecDepartment.Text,
                OAMPSBranchAddress        = txtBranchAddress1.Text,
                OAMPSBranchAddressLine2   = txtBranchAddress2.Text,
                DatePrepared              = DateTime.Now.ToString(@"dd/MM/yyyy"),
                SelectedDocumentFragments = _selectedQuestionnaireFragments,
                PopulateApprovalForm      = _populateApprovalForm,
                PopulateClaimMadeWarning  = _populateClaimMadeWarning,
                Statutory = SelectedStatutory.ToString()
            };


            var     baseTemplate = (BaseTemplate)template;
            TabPage logoTab      = tbcWizardScreens.TabPages[Constants.ControlNames.TabPageLogosName];

            PopulateLogosToTemplate(logoTab, ref baseTemplate);

            TabPage covberTab =
                tbcWizardScreens.TabPages[Constants.ControlNames.TabPageCoverPagesName];

            PopulateCoversToTemplate(covberTab, ref baseTemplate);

            return(template);
        }
        public ThemesOnlyWizard(OfficeDocument document)
        {
            InitializeComponent();

            tbcWizardScreens.SelectedIndexChanged += tbcWizardScreens_SelectedIndexChanged;

            _wizardPresenter    = new BaseWizardPresenter(document, this);
            BaseWizardPresenter = _wizardPresenter;

            //ShouldUpdateTemplate(Settings.Default.TemplateLibraryName, "Multi Page Document.docx");
        }
        public void PopulateDocument(IBaseTemplate template, string previousCoverPageTitle, string previousLogoTitle, IDocument document)
        {
            var tmpPresenter = new BaseWizardPresenter(document, this);

            //populate the content controls
            tmpPresenter.PopulateData(template);
            //change the graphics selected
            // if (Streams == null) return;
            tmpPresenter.PopulateGraphics(template, previousCoverPageTitle, previousLogoTitle);
            tmpPresenter.UpdateFields();
            tmpPresenter.CreateOrUpdateDocumentProperty(Constants.WordDocumentProperties.DocumentGeneratedDate, DateTime.Now.ToString(CultureInfo.CurrentUICulture));
        }
        private void PopulateImages()
        {
            var template = GenerateTempalteObject();

            //change the graphics selected
            //if (Streams == null) return;

            LogTemplateDetails(template);

            _wizardPresenter.PopulateGraphics(template, lblCoverPageTitle.Text, lblLogoTitle.Text);
            BaseWizardPresenter.CreateOrUpdateDocumentProperty(Constants.WordDocumentProperties.Speciality,
                                                               lblSpeciality.Text);
        }
        protected override void OnLoad(EventArgs e)
        {
            if (BaseWizardPresenter != null)
            {
                ProtectionType = BaseWizardPresenter.OnDocumentLoaded();

                Control[] coverPageLabel = Controls.Find("lblCoverPageTitle", true);
                if (coverPageLabel.Length == 1)
                {
                    string selectedCoverPage = BaseWizardPresenter.ReadDocumentProperty(Constants.WordDocumentProperties.CoverPageTitle);

                    //catch all document upgrades.
                    //in october 2014 oamps renamed to author j gall
                    //to ensure no document was left upgraded the below business rules catches any document missed
                    if (selectedCoverPage != null && selectedCoverPage.Equals("boulder opal", StringComparison.OrdinalIgnoreCase))
                    {
                        selectedCoverPage = "Cover Woodshed";
                    }

                    coverPageLabel[0].Text = (String.IsNullOrEmpty(selectedCoverPage) ? coverPageLabel[0].Text : selectedCoverPage);
                }

                Control[] titleLabel = Controls.Find("lblLogoTitle", true);
                if (titleLabel.Length == 1)
                {
                    string selectedLogo = BaseWizardPresenter.ReadDocumentProperty(Constants.WordDocumentProperties.LogoTitle);

                    //catch all document upgrades.
                    //in october 2014 oamps renamed to author j gall
                    //to ensure no document was left upgraded the below business rules catches any document missed
                    if (selectedLogo != null && selectedLogo.Equals("oamps insurance brokers ltd", StringComparison.OrdinalIgnoreCase))
                    {
                        selectedLogo = "Arthur J. Gallagher & Co (Aus) Limited";
                    }

                    titleLabel[0].Text = (String.IsNullOrEmpty(selectedLogo) ? titleLabel[0].Text : selectedLogo);
                }


                BaseWizardPresenter.CloseInformationPanel(true);
            }

            CenterToScreen();
            CenterToParent();

            //Task.Factory.StartNew(() => Thread.Sleep(3000)).ContinueWith(task => this.Activate(), TaskScheduler.FromCurrentSynchronizationContext());
            base.OnLoad(e);
        }
        public virtual void PopulateDocument(IBaseTemplate template, string previousCoverPageTitle, string previousLogoTitle)
        {
            //populate the content controls
            BaseWizardPresenter.PopulateData(template);
            //change the graphics selected
            // if (Streams == null) return;
            BaseWizardPresenter.PopulateGraphics(template, previousCoverPageTitle, previousLogoTitle);
            BaseWizardPresenter.UpdateFields();
            var type = template.GetType();

            //var propertyName = Constants.WordDocumentProperties.UsedDateOfLogo;

            //if(key.Equals("Themes",StringComparison.OrdinalIgnoreCase))
            //    propertyName = Constants.WordDocumentProperties.UsedDateOfTheme;


            var date     = DateTime.Now.ToString("dd/MM/yy");
            var logoVal  = string.Format("{0};{1}", template.LogoImageUrl, date);
            var themeVal = string.Format("{0};{1}", template.CoverPageImageUrl, date);

            BaseWizardPresenter.CreateOrUpdateDocumentProperty(Constants.WordDocumentProperties.UsedDateOfLogo, logoVal);
            BaseWizardPresenter.CreateOrUpdateDocumentProperty(Constants.WordDocumentProperties.UsedDateOfTheme, themeVal);
            BaseWizardPresenter.CreateOrUpdateDocumentProperty(Constants.WordDocumentProperties.DocumentGeneratedDate, date);
        }
        internal virtual void LoadGenericImageTabs(TaskScheduler uiScheduler, TabControl tab, string coverPageTitleForDefault, string logoTitleForDefault)
        {
            HeaderType = BaseWizardPresenter.ReadDocumentProperty(Constants.SharePointFields.HeaderType);

            if (!String.Equals(HeaderType, "No Header Image", StringComparison.OrdinalIgnoreCase))
            {
                tab.TabPages.Add(Constants.ControlNames.TabPageCoverPagesName, Constants.ControlNames.TabPageCoverPagesTitle);
                TabPage tbpMainGraphic = tab.TabPages[Constants.ControlNames.TabPageCoverPagesName];
                tbpMainGraphic.AutoScroll = true;
                tbpMainGraphic.HorizontalScroll.Enabled = false;
                tbpMainGraphic.HorizontalScroll.Visible = false;
                tbpMainGraphic.VerticalScroll.Visible   = true;
                tbpMainGraphic.VerticalScroll.Enabled   = true;

                if (uiScheduler == null)
                {
                    LoadCoverPageGraphicsSync(null, tbpMainGraphic, coverPageTitleForDefault);
                }
                else
                {
                    Task.Factory.StartNew(() => LoadCoverPageGraphicsSync(uiScheduler, tbpMainGraphic, coverPageTitleForDefault));
                }
            }

            tab.TabPages.Add(Constants.ControlNames.TabPageLogosName, Constants.ControlNames.TabPageLogosTitle);
            TabPage tbpOampsLogo = tab.TabPages[Constants.ControlNames.TabPageLogosName];

            if (uiScheduler == null)
            {
                LoadLogoGraphicsSync(null, tbpOampsLogo, logoTitleForDefault);
            }
            else
            {
                Task.Factory.StartNew(() => LoadLogoGraphicsSync(uiScheduler, tbpOampsLogo, logoTitleForDefault));
            }
        }
        private void PopulateDocument()
        {
            //buid the marketing template
            var template = new SummaryOfDiscussions
            {
                DocumentTitle              = BaseWizardPresenter.ReadDocumentProperty("Title"), //Constants.TemplateNames.FileNote,
                DocumentSubTitle           = string.Empty,
                ClientName                 = txtClientName.Text,
                ClientCode                 = txtClientCode.Text,
                ClientContactName          = txtClientContactName.Text,
                DateDiscussion             = dateDiscussion.Text,
                TimeDiscussion             = timeDiscussion.Text,
                ExecutiveEmail             = txtExecutiveEmail.Text,
                ExecutiveMobile            = txtExecutiveMobile.Text,
                ExecutiveName              = txtExecutiveName.Text,
                ExecutivePhone             = txtExecutivePhone.Text,
                ExecutiveDepartment        = txtExecutiveDepartment.Text,
                IsDiscussedByPhone         = rdoPhone.Checked.ToString(),
                IsDiscussedInPerson        = rdoPerson.Checked.ToString(),
                IsOther                    = rdoOther.Checked.ToString(),
                IsDiscussedWithCaller      = rdoCaller.Checked.ToString(),
                IsDiscussedWithCustomer    = rdoCustomer.Checked.ToString(),
                IsDiscussedWithUnderWriter = rdoUnderWriter.Checked.ToString()
            };

            var baseTemplate = (BaseTemplate)template;

            TabPage logoTab = tbcWizardScreens.TabPages[Constants.ControlNames.TabPageLogosName];

            PopulateLogosToTemplate(logoTab, ref baseTemplate);

            //foreach (Control c in logoTab.Controls)
            //{
            //    if (c.GetType() == typeof(ValueRadioButton))
            //    {
            //        var v = ((ValueRadioButton)c);
            //        if (v.Checked)
            //        {
            //            template.LogoImageUrl = v.GetValue(Constants.RadioButtonValues.ImageUrl);
            //        }
            //    }
            //}

            TabPage covberTab = tbcWizardScreens.TabPages[Constants.ControlNames.TabPageCoverPagesName];

            //foreach (Control c in covberTab.Controls)
            //{
            //    if (c.GetType() == typeof(ValueRadioButton))
            //    {
            //        var v = ((ValueRadioButton)c);
            //        if (v.Checked)
            //        {
            //            template.CoverPageImageUrl = v.GetValue(Constants.RadioButtonValues.ImageUrl);
            //        }
            //    }
            //}
            PopulateCoversToTemplate(covberTab, ref baseTemplate);

            //populate the content controls
            _wizardPresenter.PopulateData(template);
            _wizardPresenter.CreatePropertiesForRadioButtons(rdoCustomer.Checked, rdoCaller.Checked, rdoUnderWriter.Checked,
                                                             rdoPhone.Checked, rdoPerson.Checked, rdoOther.Checked);

            //change the graphics selected
            //if (Streams == null) return;
            _wizardPresenter.PopulateGraphics(template, String.Empty, string.Empty);

            //tracking
            LogUsage(template,
                     Reload
                         ? Enums.UsageTrackingType.UpdateData
                         : Enums.UsageTrackingType.NewDocument);
        }
        private void btnNext_Click(object sender, EventArgs e)
        {
            if (String.Equals(btnNext.Text, "&Finish", StringComparison.CurrentCultureIgnoreCase))
            {
                if (Validation.HasValidationErrors(Controls))
                {
                    MessageBox.Show(@"Please ensure all required fields are populated", @"Required fields are missing",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                try
                {
                    Cursor = Cursors.WaitCursor;
                    if (GenerateNewTemplate)
                    {
                        var template = GenerateTempalteObject();

                        Cache.Add(Constants.CacheNames.RegenerateTemplate, template, new CacheItemPolicy());

                        _wizardPresenter.GenerateNewTemplate(Constants.CacheNames.RegenerateTemplate, Settings.Default.TemplatePrerenewalQuestionare);
                    }
                    else
                    {
                        //    //call presenter to populate
                        var template = GenerateTempalteObject();

                        if (!Reload)
                        {
                            //_presenter.PopulateClaimMadeWarningFragment(_populateClaimMadeWarning, Settings.Default.FragmentPRQClaimsMadeWarning);
                            //_presenter.PopulateApprovalFormFragment(_populateApprovalForm, Settings.Default.FragmentPRQApprovalForm);

                            PopulateQuestionFragments(template);
                            PopulateDocument(template, lblCoverPageTitle.Text, lblLogoTitle.Text);

                            //_presenter.InsertQuestionnaireFragement(_selectedQuestionnaireFragments);
                        }
                        else
                        {
                            PopulateDocument(template, lblCoverPageTitle.Text, lblLogoTitle.Text);
                        }


                        //tracking
                        LogUsage(template,
                                 LoadType == Enums.FormLoadType.RegenerateTemplate
                                     ? Enums.UsageTrackingType.RegenerateDocument
                                     : Enums.UsageTrackingType.NewDocument);

                        if (!Reload)
                        {
                            //    //thie information panel loads when a document is in sharePoint that has metadata
                            //    //clients don't wish to see this so force the close of the panel once the wizard completes.
                            _wizardPresenter.CloseInformationPanel();
                            _wizardPresenter.MoveToStartOfDocument();
                        }
                    }


                    Close();
                    BaseWizardPresenter.CloseDocument(false, false);
                }
                catch (Exception ex)
                {
                    OnError(ex);
                }
                finally
                {
                    Cursor = Cursors.Default;
                    //    BasePresenter.SwitchScreenUpdating(true);
                }
            }
            else
            {
                SwitchTab(tbcWizardScreens.SelectedIndex + 1);
            }
        }
        private void PopulateDocument()
        {
            BaseWizardPresenter.CreateOrUpdateDocumentProperty(Constants.WordDocumentProperties.Speciality,
                                                               lblSpeciality.Text);

            var template = GenerateTempalteObject();

            //change the graphics selected
            //if (Streams == null) return;
            if (LoadType == Enums.FormLoadType.ConvertWizard)
            {
//if we are running a convert we want to force the repopulation of the images.
                lblCoverPageTitle.Text = string.Empty;
                lblLogoTitle.Text      = string.Empty;
            }

            LogTemplateDetails(template);
            _wizardPresenter.PopulateGraphics(template, lblCoverPageTitle.Text, lblLogoTitle.Text);

            if (LoadType == Enums.FormLoadType.RibbonClick)
            {
                LogUsage(template, Enums.UsageTrackingType.UpdateData);
                _wizardPresenter.PopulateData(template);
                return;
            }

            _wizardPresenter.PopulateImportantNotices();

            if (rdoClitProfileYes.Checked)
            {
                _wizardPresenter.PopulateclientProfile(Settings.Default.FragmentClientProfile);
            }

            if (rdoContractProcedYes.Checked)
            {
                _wizardPresenter.PopulateContractingProcedure(Settings.Default.FragmentContractingProcedure);
            }


            var urls =
                (from object i in clbClaimsProcedures.CheckedItems select((ISharePointListItem)i).FileRef).ToList();

            _wizardPresenter.PopulateClaimsProcedures(urls);

            _wizardPresenter.PopulatePolicyTable(template.SelectedPolicyClasses);

            _wizardPresenter.PopulateProgramSummarys(template.SelectedPolicyClasses,
                                                     Settings.Default.InsuranceManualProgramSummary);

            //_wizardPresenter.PopulateClaimsProcedures(template.SelectedPolicyClasses);

            _wizardPresenter.PopulateData(template);
            _wizardPresenter.MoveToStartOfDocument();

            _wizardPresenter.ForceUpdateToc();


            Enums.UsageTrackingType loggingtype;

            if (LoadType == Enums.FormLoadType.ConvertWizard)
            {
                loggingtype = Enums.UsageTrackingType.ConvertDocument;
            }
            else
            {
                loggingtype = (LoadType == Enums.FormLoadType.RegenerateTemplate
                    ? Enums.UsageTrackingType.RegenerateDocument
                    : Enums.UsageTrackingType.NewDocument);
            }
            //tracking
            LogUsage(template, loggingtype);
        }
Exemple #17
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            if (string.Equals(btnNext.Text, "&Finish", StringComparison.CurrentCultureIgnoreCase))
            {
                if (Validation.HasValidationErrors(Controls))
                {
                    MessageBox.Show(@"Please ensure all required fields are populated", @"Required fields are missing",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                try
                {
                    Cursor = Cursors.WaitCursor;
                    BaseWizardPresenter.SwitchScreenUpdating(false);
                    //call presenter to populate
                    //buid the marketing template
                    var template = new Agenda
                    {
                        DocumentTitle    = _meetingType,
                        DocumentSubTitle = string.Empty,
                        AgendaDate       = dateAgenda.Text,
                        AgendaTimeFrom   = timeAgendaFrom.Text,
                        AgendaTimeTo     = timeAgendaTo.Text,
                        Subject          = txtClientSubject.Text,
                        ClientName       = txtClientName.Text,
                        Location         = txtLocation.Text
                    };

                    var baseTemplate = (BaseTemplate)template;
                    var logoTab      = tbcWizardScreens.TabPages[Constants.ControlNames.TabPageLogosName];
                    PopulateLogosToTemplate(logoTab, ref baseTemplate);
                    var covberTab = tbcWizardScreens.TabPages[Constants.ControlNames.TabPageCoverPagesName];
                    PopulateCoversToTemplate(covberTab, ref baseTemplate);
                    if (GenerateNewTemplate)
                    {
                        Cache.Add(Constants.CacheNames.RegenerateTemplate, template, new CacheItemPolicy());
                        _wizardPresenter.GenerateNewTemplate(Constants.CacheNames.RegenerateTemplate,
                                                             Settings.Default.TemplateAgenda);
                    }
                    else
                    {
                        if (rdoMeetingMinutes.Checked && !Reload)
                        {
                            _wizardPresenter.InsertMinutesFragement(Settings.Default.FragmentAGMinutes);
                        }

                        if (rdoMeetingMinutes.Checked && AutoComplete)
                        {
                            _wizardPresenter.InsertMinutesFragement(Settings.Default.FragmentAGMinutes);
                        }
                        PopulateDocument(template, lblCoverPageTitle.Text, lblLogoTitle.Text);

                        //tracking
                        LogUsage(template,
                                 Reload
                                ? Enums.UsageTrackingType.UpdateData
                                : Enums.UsageTrackingType.NewDocument);
                    }
                    //thie information panel loads when a document is in sharePoint that has metadata
                    //clients don't wish to see this so force the close of the panel once the wizard completes.
                    _wizardPresenter.CloseInformationPanel();
                    Close();
                }
                catch (Exception ex)
                {
                    OnError(ex);
                }
                finally
                {
                    Cursor = Cursors.Default;
                    BaseWizardPresenter.SwitchScreenUpdating(true);
                }
            }
            else
            {
                SwitchTab(tbcWizardScreens, tbcWizardScreens.SelectedIndex + 1);
            }
        }