Exemple #1
0
        private void RunFullWizard()
        {
            Cursor = Cursors.WaitCursor;
            if (GenerateNewTemplate)
            {
                var template = GenerateTempalteObject();
                _selectedQuestions.Clear();

                var 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
                var tempalte = GenerateTempalteObject();

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

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


                    var attachmentFragments = new List <DocumentFragment>();

                    if (chkSatutory.Checked)
                    {
                        attachmentFragments.Add(_availableAttachments[Constants.FragmentKeys.StatutoryNotices]);
                    }

                    if (chkFSG.Checked)
                    {
                        attachmentFragments.Add(_availableAttachments[Constants.FragmentKeys.FinancialServicesGuide]);
                    }

                    if (attachmentFragments.Count > 0)
                    {
                        _wizardPresenter.PopulateImportantNotices(attachmentFragments,
                                                                  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 == Helpers.Enums.FormLoadType.RegenerateTemplate
                        ? Helpers.Enums.UsageTrackingType.RegenerateDocument
                        : Helpers.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)
                    {
                        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);
            }
        }