Example #1
0
        private void PreRenewalQuestionareWizard_Load(object sender, EventArgs e)
        {
            tbcWizardScreens.TabPages.Remove(tabPolicyClass);
            txtClientName.Focus();
            txtClientName.Select();

            GetFragements();

            var auto = false;

            WizardBeingUpdated = true;

            var uiScheduler = TaskScheduler.FromCurrentSynchronizationContext();

            if (Cache.Contains(Constants.CacheNames.RegenerateTemplate))
            {
                Reload = false;

                var template = GetCachedTempalteObject <FactFinder>();
                lblCoverPageTitle.Text = template.CoverPageTitle;
                lblLogoTitle.Text      = template.LogoTitle;

                _selectedQuestionnaireFragments = template.SelectedDocumentFragments;
                //  LoadDataSources(null); //dont use new thread

                ReloadAllFields(template);
                //ReloadPolicyClasses(true);
                _selectedQuestions = template.SelectedQuestions;

                LoadQuestions(null);
                RetickQuestionsOnReload(true);
                rdoWariningYes.Checked = template.PopulateClaimMadeWarning;
                rdoApprovalYes.Checked = template.PopulateApprovalForm;
                ReloadStatutory(true, template.Statutory);


                auto = true;
            }
            else
            {
                if (Reload)
                {
                    MessageBox.Show(@"You cannot make any changes to this document through the wizard",
                                    @"Cannot make any changes", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Close();

                    LoadDataSources(null); //dont use new thread

                    var template = new FactFinder();
                    template = (FactFinder)_wizardPresenter.LoadData(template);

                    ReloadAllFields(template);
                    // ReloadPolicyClasses(false);
                    LoadQuestions(null);

                    var claimsMade =
                        _wizardPresenter.ReadDocumentProperty(Constants.WordDocumentProperties.ClaimsMadeWarning);
                    var approvalForms =
                        _wizardPresenter.ReadDocumentProperty(Constants.WordDocumentProperties.ApprovalForm);
                    ReloadStatutory(false);

                    if (string.Equals(claimsMade, "true", StringComparison.OrdinalIgnoreCase))
                    {
                        rdoWariningYes.Checked = true;
                    }

                    if (string.Equals(approvalForms, "true", StringComparison.OrdinalIgnoreCase))
                    {
                        rdoApprovalYes.Checked = true;
                    }


                    RetickQuestionsOnReload(false);
                }
                else
                {
                    Task.Factory.StartNew(() =>
                    {
                        //  LoadDataSources(uiScheduler);
                        LoadQuestions(uiScheduler);
                    });
                }
            }

            LoadCompanyLogoImagesTab(uiScheduler, tbcWizardScreens, lblLogoTitle.Text);
            LoadBrandingImagesTab(null, tbcWizardScreens, lblCoverPageTitle.Text, lblSpeciality.Text);
            WizardBeingUpdated = false;

            if (auto)
            {
                StartTimer();
            }
        }
        private void PreRenewalQuestionareWizard_Load(object sender, EventArgs e)
        {
            tbcWizardScreens.TabPages.Remove(tabPolicyClass);
            txtClientName.Focus();
            txtClientName.Select();

            bool auto = false;

            WizardBeingUpdated = true;

            TaskScheduler uiScheduler = TaskScheduler.FromCurrentSynchronizationContext();

            if (Cache.Contains(Constants.CacheNames.RegenerateTemplate))
            {
                Reload = false;

                var template = GetCachedTempalteObject <FactFinder>();
                lblCoverPageTitle.Text = template.CoverPageTitle;
                lblLogoTitle.Text      = template.LogoTitle;

                _selectedQuestionnaireFragments = template.SelectedDocumentFragments;
                //  LoadDataSources(null); //dont use new thread

                ReloadAllFields(template);
                //ReloadPolicyClasses(true);
                _selectedQuestions = template.SelectedQuestions;

                LoadQuestions(null);
                RetickQuestionsOnReload(true);
                rdoWariningYes.Checked = template.PopulateClaimMadeWarning;
                rdoApprovalYes.Checked = template.PopulateApprovalForm;
                ReloadStatutory(true, template.Statutory);



                auto = true;
            }
            else
            {
                if (Reload)
                {
                    LoadDataSources(null); //dont use new thread

                    var template = new FactFinder();
                    template = (FactFinder)_wizardPresenter.LoadData(template);

                    ReloadAllFields(template);
                    // ReloadPolicyClasses(false);
                    LoadQuestions(null);

                    var claimsMade    = _wizardPresenter.ReadDocumentProperty(Constants.WordDocumentProperties.ClaimsMadeWarning);
                    var approvalForms = _wizardPresenter.ReadDocumentProperty(Constants.WordDocumentProperties.ApprovalForm);
                    ReloadStatutory(false);

                    if (String.Equals(claimsMade, "true", StringComparison.OrdinalIgnoreCase))
                    {
                        rdoWariningYes.Checked = true;
                    }

                    if (String.Equals(approvalForms, "true", StringComparison.OrdinalIgnoreCase))
                    {
                        rdoApprovalYes.Checked = true;
                    }



                    RetickQuestionsOnReload(false);
                }
                else
                {
                    Task.Factory.StartNew(() =>
                    {
                        //  LoadDataSources(uiScheduler);
                        LoadQuestions(uiScheduler);
                    });
                }
            }

            base.LoadGenericImageTabs(uiScheduler, tbcWizardScreens, lblCoverPageTitle.Text, lblLogoTitle.Text);

            WizardBeingUpdated = false;

            if (auto)
            {
                base.StartTimer();
            }
        }