Esempio n. 1
0
        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();
            }
        }
Esempio n. 2
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();
            }
        }
Esempio n. 3
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;
                    if (GenerateNewTemplate)
                    {
                        FactFinder template = GenerateTempalteObject();

                        _selectedQuestions.Clear();

                        CheckedListBox.CheckedItemCollection c = clbQustions.CheckedItems;
                        var items = c.Cast <IQuestionClass>().ToList();
                        _selectedQuestions.AddRange(items);

                        template.SelectedQuestions = _selectedQuestions;

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

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

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

                            CheckedListBox.CheckedItemCollection c = clbQustions.CheckedItems;
                            var items = c.Cast <IQuestionClass>().ToList();
                            _wizardPresenter.InsertQuestionnaireFragement(items, Settings.Default.InformationForPolicyFragment);
                            //_presenter.InsertQuestionnaireFragement(_selectedQuestionnaireFragments);


                            _wizardPresenter.PopulateImportantNotices(SelectedStatutory, Settings.Default.FragmentStatutory,
                                                                      Settings.Default.FragmentPrivacy, Settings.Default.FragmentFSG,
                                                                      Settings.Default.FragmentTermsOfEngagement);
                        }

                        PopulateDocument(tempalte, lblCoverPageTitle.Text, lblLogoTitle.Text);


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

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


                    Close();
                }
                catch (Exception ex)
                {
                    OnError(ex);
                }
                finally
                {
                    Cursor = Cursors.Default;
                    //    BasePresenter.SwitchScreenUpdating(true);
                }
            }
            else
            {
                SwitchTab(tbcWizardScreens.SelectedIndex + 1);
            }
        }