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 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);
        }
        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);
        }
        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);
        }