Example #1
0
        private void AddAttachments(RenewalLetter template)
        {
            var attachmentFragments = new List <DocumentFragment>();

            if (template.IsSatutorySelected)
            {
                attachmentFragments.Add(_availableAttachments[Constants.FragmentKeys.StatutoryNotices]);
            }

            if (template.IsPrivacySelected)
            {
                attachmentFragments.Add(_availableAttachments[Constants.FragmentKeys.PrivacyStatement]);
            }

            if (template.IsFSGSelected)
            {
                attachmentFragments.Add(_availableAttachments[Constants.FragmentKeys.FinancialServicesGuide]);
            }

            if (template.IsAdviceWarningSelected)
            {
                attachmentFragments.Add(_availableAttachments[Constants.FragmentKeys.GeneralAdviceWarning]);
            }

            if (template.IsRisksSelected)
            {
                attachmentFragments.Add(_availableAttachments[Constants.FragmentKeys.UninsuredRisksReviewList]);
            }

            _presenter.InsertSubFragments(Constants.WordBookmarks.RenewalLetterSub, Constants.WordBookmarks.RenewalLetterMain, attachmentFragments, Settings.Default.BlankFragmentBase);
        }
Example #2
0
        private void AddAttachments(RenewalLetter template)
        {
            var attachmentFragments = new List <DocumentFragment>();

            //if (chkWarning.Checked)
            if (template.IsWarningSelected)
            {
                attachmentFragments.Add(_availableAttachments[Constants.FragmentKeys.GeneralAdviceWarning]);
            }
            //if (chkRisks.Checked)
            if (template.IsRisksSelected)
            {
                attachmentFragments.Add(_availableAttachments[Constants.FragmentKeys.UninsuredRisksReviewList]);
            }
            //if (chkPrivacy.Checked)
            if (template.IsPrivacySelected)
            {
                attachmentFragments.Add(_availableAttachments[Constants.FragmentKeys.PrivacyStatement]);
            }
            //if (chkSatutory.Checked)
            if (template.IsSatutorySelected)
            {
                attachmentFragments.Add(_availableAttachments[Constants.FragmentKeys.StatutoryNotices]);
            }
            //if (chkFSG.Checked)
            if (template.IsFSGSelected)
            {
                attachmentFragments.Add(_availableAttachments[Constants.FragmentKeys.FinancialServicesGuide]);
            }

            _presenter.InsertSubFragments(Constants.WordBookmarks.RenewalLetterSub, Constants.WordBookmarks.RenewalLetterMain, attachmentFragments);
        }
Example #3
0
        private void AddAttachments(RenewalLetter template)
        {
            var attachmentFragments = new List <DocumentFragment>();

            if (template.IsSatutorySelected)
            {
                attachmentFragments.Add(_availableAttachments[Constants.FragmentKeys.StatutoryNotices]);
            }

            if (template.IsPrivacySelected)
            {
                attachmentFragments.Add(_availableAttachments[Constants.FragmentKeys.PrivacyStatement]);
            }

            if (template.IsFsgSelected)
            {
                attachmentFragments.Add(_availableAttachments[Constants.FragmentKeys.FinancialServicesGuideLetter]);
            }

            if (template.IsAdviceWarningSelected)
            {
                attachmentFragments.Add(_availableAttachments[Constants.FragmentKeys.GeneralAdviceWarning]);
            }

            if (template.IsRisksSelected)
            {
                attachmentFragments.Add(_availableAttachments[Constants.FragmentKeys.UninsuredRisksReviewList]);
            }

            if (attachmentFragments.Count > 0)
            {
                Task.Factory.StartNew(() => Thread.Sleep(2000)).Wait();
                _wizardPresenter.InsertSubFragments(Constants.WordBookmarks.RenewalLetterSub, Constants.WordBookmarks.RenewalLetterMain, attachmentFragments, Settings.Default.BlankFSGFragement);
            }
        }
 public IHttpActionResult Edit(RenewalLetter entity)
 {
     return(Ok(new ProjectEditResult
     {
         TaskUrl = entity.Edit()
     }));
 }
 public void InsertMainFragment(string bookmark, string fragUrl, RenewalLetter template)
 {
     if (Document.MoveCursorToStartOfBookmark(bookmark))
     {
         Document.InsertFile(fragUrl);
     }
     Document.UpdateOrCreatePropertyValue(Constants.WordDocumentProperties.RlChkContacted, template.IsContactSelected.ToString());
     Document.UpdateOrCreatePropertyValue(Constants.WordDocumentProperties.RlChkNewClient, template.IsNewClientSelected.ToString());
     Document.UpdateOrCreatePropertyValue(Constants.WordDocumentProperties.RlChkFunding, template.IsFundingSelected.ToString());
     Document.UpdateOrCreatePropertyValue(Constants.WordDocumentProperties.RlChkGaw, template.IsGawSelected.ToString());
 }
Example #6
0
        private void PopulateAddress(RenewalLetter letter)
        {
            if (!String.IsNullOrEmpty(txtBranchAddress1.Text))
            {
                letter.OAMPSBranchAddress      = txtBranchAddress1.Text;
                letter.OAMPSBranchAddressLine2 = txtBranchAddress2.Text;
            }

            if (!String.IsNullOrEmpty(txtPostal1.Text))
            {
                letter.OAMPSPostalAddress      = txtPostal1.Text;
                letter.OAMPSPostalAddressLine2 = txtPostal2.Text;
            }
        }
        public IHttpActionResult InitPage(string projectId, string id = null)
        {
            var letter  = RenewalLetter.Get(projectId, id);
            var project = ProjectInfo.Get(projectId, FlowCode.Renewal_Letter);
            var isActor = ProjectUsers.IsRole(projectId, ClientCookie.UserCode, ProjectUserRoleCode.AssetActor);

            letter.IsProjectFreezed = letter.CheckIfFreezeProject(projectId);
            var nextRefTableId  = new Guid(FlowInfo.GetRefTableId("RenewalConsInfo", projectId));
            var nextFlowStarted = ProjectInfo.IsFlowStarted(projectId, FlowCode.Renewal_ConsInfo);
            var haveTask        = TaskWork.Any(t => t.RefID == projectId && t.TypeCode == FlowCode.Renewal_Letter && t.Status == TaskWorkStatus.UnFinish && t.ReceiverAccount == ClientCookie.UserCode);
            var projectComment  = ProjectComment.GetSavedComment(letter.Id, "RenewalLetter", ClientCookie.UserCode);
            var isStarted       = ProjectInfo.IsFlowStarted(projectId, FlowCode.Renewal_Letter);
            var isFinished      = ProjectInfo.IsFlowFinished(projectId, FlowCode.Renewal_Letter);

            return(Ok(new
            {
                Info = RenewalInfo.FirstOrDefault(info => info.ProjectId == letter.ProjectId),
                Letter = letter,
                ProjectComment = projectComment != null ? projectComment.Content : "",
                Editable = ProjectInfo.IsFlowEditable(projectId, FlowCode.Renewal_Letter),
                Recallable = ProjectInfo.IsFlowRecallable(projectId, FlowCode.Renewal_Letter),
                Savable = ProjectInfo.IsFlowSavable(projectId, FlowCode.Renewal_Letter) && string.IsNullOrEmpty(id)
            }));
        }
Example #8
0
        protected static BaseWFEntity GetEmptyWorkflowEntity(string flowCode)
        {
            BaseWFEntity wfEntity = null;

            switch (flowCode)
            {
            case FlowCode.MajorLease:
                wfEntity = new MajorLeaseInfo();
                wfEntity.IsMainProject = true;
                break;

            case FlowCode.MajorLease_LegalReview:
                wfEntity = new MajorLeaseLegalReview();
                break;

            case FlowCode.MajorLease_FinanceAnalysis:
                wfEntity = new MajorLeaseFinancAnalysis();
                break;

            case FlowCode.MajorLease_ConsInfo:
                wfEntity = new MajorLeaseConsInfo();
                break;

            case FlowCode.MajorLease_Package:
                wfEntity = new MajorLeaseChangePackage();
                break;

            case FlowCode.MajorLease_ConsInvtChecking:
                wfEntity = new MajorLeaseConsInvtChecking();
                break;

            case FlowCode.MajorLease_GBMemo:
                wfEntity = new MajorLeaseGBMemo();
                break;

            case FlowCode.Closure:
                wfEntity = new ClosureInfo();
                wfEntity.IsMainProject = true;
                break;

            case FlowCode.Closure_ClosurePackage:
                wfEntity = new ClosurePackage();
                break;

            case FlowCode.Closure_ClosureTool:
                wfEntity = new ClosureTool();
                break;

            case FlowCode.Closure_ConsInvtChecking:
                wfEntity = new ClosureConsInvtChecking();
                break;

            case FlowCode.Closure_LegalReview:
                wfEntity = new ClosureLegalReview();
                break;

            case FlowCode.Closure_WOCheckList:
                wfEntity = new ClosureWOCheckList();
                break;

            case FlowCode.Closure_ExecutiveSummary:
                wfEntity = new ClosureExecutiveSummary();
                break;

            case FlowCode.TempClosure:
                wfEntity = new TempClosureInfo();
                wfEntity.IsMainProject = true;
                break;

            case FlowCode.TempClosure_LegalReview:
                wfEntity = new TempClosureLegalReview();
                break;

            case FlowCode.TempClosure_ClosurePackage:
                wfEntity = new TempClosurePackage();
                break;

            case FlowCode.Rebuild:
                wfEntity = new RebuildInfo();
                wfEntity.IsMainProject = true;
                break;

            case FlowCode.Rebuild_LegalReview:
                wfEntity = new RebuildLegalReview();
                break;

            case FlowCode.Rebuild_FinanceAnalysis:
                wfEntity = new RebuildFinancAnalysis();
                break;

            case FlowCode.Rebuild_ConsInfo:
                wfEntity = new RebuildConsInfo();
                break;

            case FlowCode.Rebuild_Package:
                wfEntity = new RebuildPackage();
                break;

            case FlowCode.Rebuild_ConsInvtChecking:
                wfEntity = new RebuildConsInvtChecking();
                break;

            case FlowCode.Rebuild_GBMemo:
                wfEntity = new GBMemo();
                break;

            case FlowCode.Renewal:
                wfEntity = new RenewalInfo();
                wfEntity.IsMainProject = true;
                break;

            case FlowCode.Renewal_Letter:
                wfEntity = new RenewalLetter();
                break;

            case FlowCode.Renewal_LLNegotiation:
                wfEntity = new RenewalLLNegotiation();
                break;

            case FlowCode.Renewal_ConsInfo:
                wfEntity = new RenewalConsInfo();
                break;

            case FlowCode.Renewal_Tool:
                wfEntity = new RenewalTool();
                break;

            case FlowCode.Renewal_Analysis:
                wfEntity = new RenewalAnalysis();
                break;

            case FlowCode.Renewal_ClearanceReport:
                wfEntity = new RenewalClearanceReport();
                break;

            case FlowCode.Renewal_ConfirmLetter:
                wfEntity = new RenewalConfirmLetter();
                break;

            case FlowCode.Renewal_LegalApproval:
                wfEntity = new RenewalLegalApproval();
                break;

            case FlowCode.Renewal_Package:
                wfEntity = new RenewalPackage();
                break;

            case FlowCode.Renewal_GBMemo:
                wfEntity = new RenewalGBMemo();
                break;

            case FlowCode.Reimage:
                wfEntity = new ReimageInfo();
                wfEntity.IsMainProject = true;
                break;

            case FlowCode.Reimage_ConsInfo:
                wfEntity = new ReimageConsInfo();
                break;

            case FlowCode.Reimage_Summary:
                wfEntity = new ReimageSummary();
                break;

            case FlowCode.Reimage_Package:
                wfEntity = new ReimagePackage();
                break;

            case FlowCode.Reimage_ConsInvtChecking:
                wfEntity = new ReimageConsInvtChecking();
                break;

            case FlowCode.Reimage_GBMemo:
                wfEntity = new ReimageGBMemo();
                break;
            }
            return(wfEntity);
        }
Example #9
0
 private void AddMainFragment(RenewalLetter template)
 {
     if (!chkContacted.Checked && !chkNewInsurer.Checked && !chkGAW.Checked && !chkFunding.Checked)
     {
         _presenter.InsertMainFragment(Constants.WordBookmarks.RenewalLetterMain, Settings.Default.FragmentRLNoContact_ExistingInsr_NoGAW_NoFunding, template);
     }
     else if (chkContacted.Checked && !chkNewInsurer.Checked && !chkGAW.Checked && !chkFunding.Checked)
     {
         _presenter.InsertMainFragment(Constants.WordBookmarks.RenewalLetterMain, Settings.Default.FragmentRLYesContact_ExistingInsr_NoGAW_NoFunding, template);
     }
     else if (!chkContacted.Checked && !chkNewInsurer.Checked && chkGAW.Checked && !chkFunding.Checked)
     {
         _presenter.InsertMainFragment(Constants.WordBookmarks.RenewalLetterMain, Settings.Default.FragmentRLNoContact_ExistingInsr_YesGAW_NoFunding, template);
     }
     else if (chkContacted.Checked && !chkNewInsurer.Checked && chkGAW.Checked && !chkFunding.Checked)
     {
         _presenter.InsertMainFragment(Constants.WordBookmarks.RenewalLetterMain, Settings.Default.FragmentRLYesContact_ExistingInsr_YesGAW_NoFunding, template);
     }
     else if (!chkContacted.Checked && !chkNewInsurer.Checked && chkGAW.Checked && chkFunding.Checked)
     {
         _presenter.InsertMainFragment(Constants.WordBookmarks.RenewalLetterMain, Settings.Default.FragmentRLNoContact_ExistingInsr_YesGAW_YesFunding, template);
     }
     else if (chkContacted.Checked && !chkNewInsurer.Checked && chkGAW.Checked && chkFunding.Checked)
     {
         _presenter.InsertMainFragment(Constants.WordBookmarks.RenewalLetterMain, Settings.Default.FragmentRLYesContact_ExistingInsr_YesGAW_YesFunding, template);
     }
     else if (chkContacted.Checked && !chkNewInsurer.Checked && !chkGAW.Checked && chkFunding.Checked)
     {
         _presenter.InsertMainFragment(Constants.WordBookmarks.RenewalLetterMain, Settings.Default.FragmentRLYesContact_ExistingInsr_NoGAW_YesFunding, template);
     }
     else if (!chkContacted.Checked && chkNewInsurer.Checked && !chkGAW.Checked && !chkFunding.Checked)
     {
         _presenter.InsertMainFragment(Constants.WordBookmarks.RenewalLetterMain, Settings.Default.FragmentRLNoContact_NewInsr_NoGAW_NoFunding, template);
     }
     else if (chkContacted.Checked && chkNewInsurer.Checked && !chkGAW.Checked && !chkFunding.Checked)
     {
         _presenter.InsertMainFragment(Constants.WordBookmarks.RenewalLetterMain, Settings.Default.FragmentRLYesContact_NewInsr_NoGAW_NoFunding, template);
     }
     else if (!chkContacted.Checked && chkNewInsurer.Checked && chkGAW.Checked && !chkFunding.Checked)
     {
         _presenter.InsertMainFragment(Constants.WordBookmarks.RenewalLetterMain, Settings.Default.FragmentRLNoContact_NewInsr_YesGAW_NoFunding, template);
     }
     else if (chkContacted.Checked && chkNewInsurer.Checked && chkGAW.Checked && !chkFunding.Checked)
     {
         _presenter.InsertMainFragment(Constants.WordBookmarks.RenewalLetterMain, Settings.Default.FragmentRLYesContact_NewInsr_YesGAW_NoFunding, template);
     }
     else if (!chkContacted.Checked && chkNewInsurer.Checked && chkGAW.Checked && chkFunding.Checked)
     {
         _presenter.InsertMainFragment(Constants.WordBookmarks.RenewalLetterMain, Settings.Default.FragmentRLNoContact_NewInsr_YesGAW_YesFunding, template);
     }
     else if (chkContacted.Checked && chkNewInsurer.Checked && chkGAW.Checked && chkFunding.Checked)
     {
         _presenter.InsertMainFragment(Constants.WordBookmarks.RenewalLetterMain, Settings.Default.FragmentRLYesContact_NewInsr_YesGAW_YesFunding, template);
     }
     else if (!chkContacted.Checked && chkNewInsurer.Checked && !chkGAW.Checked && chkFunding.Checked)
     {
         _presenter.InsertMainFragment(Constants.WordBookmarks.RenewalLetterMain, Settings.Default.FragmentRLNoContact_NewInsr_NoGAW_YesFunding, template);
     }
     else if (chkContacted.Checked && chkNewInsurer.Checked && !chkGAW.Checked && chkFunding.Checked)
     {
         _presenter.InsertMainFragment(Constants.WordBookmarks.RenewalLetterMain, Settings.Default.FragmentRLYesContact_NewInsr_NoGAW_YesFunding, template);
     }
     else if (!chkContacted.Checked && !chkNewInsurer.Checked && !chkGAW.Checked && chkFunding.Checked)
     {
         _presenter.InsertMainFragment(Constants.WordBookmarks.RenewalLetterMain, Settings.Default.FragmentRLNoContact_ExistingInsr_NoGAW_YesFunding, template);
     }
 }
Example #10
0
        private void Next_Click(object sender, EventArgs e)
        {
            if (String.Equals(btnNext.Text, "&Finish", StringComparison.CurrentCultureIgnoreCase))
            {
                if (Validation.HasValidationErrors(this.Controls))
                {
                    MessageBox.Show(@"Please ensure all required fields are populated", @"Required fields are missing",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                var letter = new RenewalLetter
                {
                    Addressee          = txtAddressee.Text,
                    Salutation         = txtSalutation.Text,
                    ClientAddress      = txtClientAddress.Text,
                    ClientAddressLine2 = txtClientAddress2.Text,

                    ClientName       = txtClientName.Text,
                    DatePolicyExpiry = datePolicy.Text,
                    DatePrepared     = dateReport.Text,
                    ExecutiveName    = txtExecutiveName.Text,
                    ExecutiveEmail   = txtExecutiveEmail.Text,
                    ExecutiveMobile  = txtExecutiveMobile.Text,
                    ExecutivePhone   = txtExecutivePhone.Text,
                    ExecutiveTitle   = txtExecutiveTitle.Text,

                    ExecutiveDepartment = txtExecutiveDepartment.Text,
                    PaymentDate         = datePayment.Text,
                    OAMPSBranchPhone    = txtBranchPhone.Text,
                    Reference           = txtReference.Text,
                    Fax                 = txtFax.Text,
                    PolicyType          = _selectedPolicy,
                    IsContactSelected   = chkContacted.Checked,
                    IsFundingSelected   = chkFunding.Checked,
                    IsNewClientSelected = chkNewInsurer.Checked,

                    IsFSGSelected           = chkFSG.Checked,
                    IsPrivacySelected       = chkPrivacy.Checked,
                    IsRisksSelected         = chkRisks.Checked,
                    IsSatutorySelected      = chkSatutory.Checked,
                    IsWarningSelected       = chkWarning.Checked,
                    OAMPSBranchAddress      = txtBranchAddress1.Text,
                    OAMPSBranchAddressLine2 = txtBranchAddress2.Text,
                    PDSDescVersion          = txtPDSVersion.Text
                };
                TabPage logoTab      = tbcWizardScreens.TabPages[BusinessLogic.Helpers.Constants.ControlNames.TabPageLogosName];
                var     baseTemplate = (BaseTemplate)letter;
                PopulateLogosToTemplate(logoTab, ref baseTemplate);


                if (_generateNewTemplate)
                {
                    Cache.Add(Constants.CacheNames.RegenerateTemplate, letter, new CacheItemPolicy());

                    _presenter.GenerateNewTemplate(Constants.CacheNames.RegenerateTemplate, Settings.Default.TemplateInsuranceRenewalLetter);
                }
                else
                {
                    _presenter.PopulatePolicy(letter.PolicyType);

                    PopulateAddress(letter);

                    if (!Reload)
                    {
                        AddMainFragment(letter);
                    }

                    //call presenter to populate
                    PopulateDocument(letter);

                    //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.
                    //Presenter.CloseInformationPanel();
                    if (!Reload)
                    {
                        AddAttachments(letter);
                    }

                    if (isPrePrintedStationary)
                    {
                        _presenter.DeleteDocumentHeaderAndFooter();
                    }
                }


                Close();
            }
            else
            {
                SwitchTab(tbcWizardScreens.SelectedIndex + 1);
            }
        }
Example #11
0
        private void ReloadFields()
        {
            WizardBeingUpdated = true;


            var template = new RenewalLetter();

            try
            {
                string policyReference = null;

                if (Cache.Contains(Constants.CacheNames.RegenerateTemplate))
                {
                    MessageBox.Show(BusinessLogic.Helpers.Constants.Miscellaneous.RegenerateOnLoadMsg, String.Empty,
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);

                    template = (RenewalLetter)Cache.Get(Constants.CacheNames.RegenerateTemplate);
                    Cache.Remove(Constants.CacheNames.RegenerateTemplate);

                    if (template.PolicyType != null)
                    {
                        policyReference = template.PolicyType.Title;
                    }

                    chkWarning.Checked  = template.IsWarningSelected;
                    chkFSG.Checked      = template.IsFSGSelected;
                    chkPrivacy.Checked  = template.IsPrivacySelected;
                    chkRisks.Checked    = template.IsRisksSelected;
                    chkSatutory.Checked = template.IsSatutorySelected;

                    chkContacted.Checked  = template.IsContactSelected;
                    chkNewInsurer.Checked = template.IsNewClientSelected;
                    chkFunding.Checked    = template.IsFundingSelected;
                    Reload = false; //behaviour like a new from this point
                }
                else
                {
                    template = (RenewalLetter)_presenter.LoadData(template);


                    policyReference = _presenter.ReadPolicyReference();

                    UpdateMainFragmentCheckBox(Constants.WordDocumentProperties.RlChkContacted, chkContacted);
                    UpdateMainFragmentCheckBox(Constants.WordDocumentProperties.RlChkFunding, chkFunding);
                    UpdateMainFragmentCheckBox(Constants.WordDocumentProperties.RlChkNewClient, chkNewInsurer);

                    var fgKeys = _presenter.ReadDocumentProperty(Constants.WordDocumentProperties.RlSubFragments);
                    if (fgKeys != null)
                    {
                        var keys = fgKeys.Split(';');
                        foreach (string key in keys)
                        {
                            if (key.Equals(Constants.FragmentKeys.FinancialServicesGuide, StringComparison.InvariantCultureIgnoreCase))
                            {
                                chkFSG.Checked = true;
                            }
                            else if (key.Equals(Constants.FragmentKeys.GeneralAdviceWarning, StringComparison.InvariantCultureIgnoreCase))
                            {
                                chkWarning.Checked = true;
                            }
                            else if (key.Equals(Constants.FragmentKeys.PrivacyStatement, StringComparison.InvariantCultureIgnoreCase))
                            {
                                chkPrivacy.Checked = true;
                            }
                            else if (key.Equals(Constants.FragmentKeys.StatutoryNotices, StringComparison.InvariantCultureIgnoreCase))
                            {
                                chkSatutory.Checked = true;
                            }
                            else if (key.Equals(Constants.FragmentKeys.UninsuredRisksReviewList, StringComparison.InvariantCultureIgnoreCase))
                            {
                                chkRisks.Checked = true;
                            }
                        }
                    }
                }

                txtAddressee.Text      = template.Addressee;
                txtSalutation.Text     = template.Salutation;
                txtClientAddress.Text  = template.ClientAddress;
                txtClientAddress2.Text = template.ClientAddressLine2;
                txtClientName.Text     = template.ClientName;

                txtPDSVersion.Text = template.PDSDescVersion;

                txtExecutiveName.Text       = template.ExecutiveName;
                txtExecutiveEmail.Text      = template.ExecutiveEmail;
                txtExecutiveMobile.Text     = template.ExecutiveMobile;
                txtExecutivePhone.Text      = template.ExecutivePhone;
                txtExecutiveTitle.Text      = template.ExecutiveTitle;
                txtExecutiveDepartment.Text = template.ExecutiveDepartment;

                txtBranchAddress1.Text = template.OAMPSBranchAddress;
                txtBranchAddress2.Text = template.OAMPSBranchAddressLine2;

                txtPostal1.Text = template.OAMPSPostalAddress;
                txtPostal2.Text = template.OAMPSPostalAddressLine2;

                txtBranchPhone.Text = template.OAMPSBranchPhone;

                lblLogoTitle.Text      = template.LogoTitle;
                lblCoverPageTitle.Text = template.CoverPageTitle;

                txtReference.Text = template.Reference;
                txtFax.Text       = template.Fax;

                datePayment.Text = template.PaymentDate;
                datePolicy.Text  = template.DatePolicyExpiry;
                dateReport.Text  = template.DatePrepared;

                foreach (var no in tvaPolicies.AllNodes)
                {
                    foreach (var cno in no.Children)
                    {
                        if (String.Equals(cno.Tag.ToString(), policyReference, StringComparison.OrdinalIgnoreCase))
                        {
                            no.Expand();
                            var path = tvaPolicies.GetPath(cno);

                            var node = ((AdvancedTreeNode)path.LastNode);
                            node.CheckState = CheckState.Checked;
                            node.Checked    = true;
                            _selectedPolicy = MinorItems.FirstOrDefault(i => i.Title == node.Text);
                        }
                    }
                }
            }
            catch (Exception)
            {
            }



            WizardBeingUpdated = false;
        }
Example #12
0
        private void Next_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                //   BasePresenter.SwitchScreenUpdating(false);

                if (String.Equals(btnNext.Text, "&Finish", StringComparison.CurrentCultureIgnoreCase))
                {
                    _selectedPolicies = GetSelectedPolicies();

                    if (Validation.HasValidationErrors(Controls))
                    {
                        MessageBox.Show(@"Please ensure all required fields are populated", @"Required fields are missing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }

                    _wizardPresenter.CloseInformationPanel(true); //has to be here to close as the presenter opens new word documents taht become active.

                    var letter = new RenewalLetter
                    {
                        Addressee           = txtAddressee.Text,
                        Salutation          = txtSalutation.Text,
                        ClientAddress       = txtClientAddress.Text,
                        ClientAddressLine2  = txtClientAddress2.Text,
                        ClientAddressLine3  = txtClientAddress3.Text,
                        ClientName          = txtClientName.Text,
                        DatePolicyExpiry    = datePolicy.Value.ToShortDateString(),
                        DatePrepared        = dateReport.Value.ToShortDateString(),
                        ExecutiveName       = txtExecutiveName.Text,
                        ExecutiveEmail      = txtExecutiveEmail.Text,
                        ExecutiveMobile     = txtExecutiveMobile.Text,
                        ExecutivePhone      = txtExecutivePhone.Text,
                        ExecutiveTitle      = txtExecutiveTitle.Text,
                        ExecutiveDepartment = txtExecutiveDepartment.Text,
                        PaymentDate         = datePayment.Value.ToShortDateString(),
                        OAMPSBranchPhone    = txtBranchPhone.Text,
                        Reference           = txtReference.Text,
                        Fax                     = txtFax.Text,
                        Policies                = _selectedPolicies,
                        IsContactSelected       = chkContacted.Checked,
                        IsFundingSelected       = chkFunding.Checked,
                        IsNewClientSelected     = chkNewInsurer.Checked,
                        IsFsgSelected           = chkFSG.Checked,
                        IsPrivacySelected       = chkPrivacy.Checked,
                        IsRisksSelected         = chkRisks.Checked,
                        IsSatutorySelected      = chkSatutory.Checked,
                        IsAdviceWarningSelected = chkWarning.Checked,
                        IsGawSelected           = chkGAW.Checked,
                        OAMPSBranchAddress      = txtBranchAddress1.Text,
                        OAMPSBranchAddressLine2 = txtBranchAddress2.Text,
                        PdsDescVersion          = txtPDSVersion.Text,
                        OAMPSPostalAddress      = txtPostal1.Text,
                        OAMPSPostalAddressLine2 = txtPostal2.Text,
                        IsPrePrintSelected      = chkPrePrint.Checked
                    };

                    _wizardPresenter.CreateOrUpdateDocumentProperty(Constants.WordDocumentProperties.RlRdoPreprint, chkPrePrint.Checked.ToString());

                    TabPage logoTab      = tbcWizardScreens.TabPages[Constants.ControlNames.TabPageLogosName];
                    var     baseTemplate = (BaseTemplate)letter;
                    PopulateLogosToTemplate(logoTab, ref baseTemplate);


                    if (GenerateNewTemplate)
                    {
                        Cache.Add(Constants.CacheNames.RegenerateTemplate, letter, new CacheItemPolicy());
                        _wizardPresenter.GenerateNewTemplate(Constants.CacheNames.RegenerateTemplate, Settings.Default.TemplateInsuranceRenewalLetter);
                    }
                    else
                    {
                        if (!Reload)
                        {
                            _wizardPresenter.PopulatePolicy(letter.Policies, letter.DatePolicyExpiry, chkNewInsurer.Checked);
                        }

                        PopulateAddress(letter);

                        if (!Reload)
                        {
                            AddMainFragment(letter);
                        }

                        //call presenter to populate
                        PopulateDocument(letter, lblCoverPageTitle.Text, lblLogoTitle.Text);

                        //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.
                        //Presenter.CloseInformationPanel();
                        if (!Reload)
                        {
                            AddAttachments(letter);
                        }

                        if (chkPrePrint.Checked)
                        {
                            _wizardPresenter.DeleteDocumentHeaderAndFooter();
                        }

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

                    //_presenter.CloseInformationPanel(true);
                    Close();

                    //foreach (Microsoft.Office.Interop.Word.Document doc in Globals.ThisAddIn.Application.Documents)
                    //{
                    //    doc.Application.DisplayDocumentInformationPanel = false;
                    //}
                }
                else
                {
                    SwitchTab(tbcWizardScreens.SelectedIndex + 1);
                }
            }

            catch (AggregateException aggregateException)
            {
                OnError(aggregateException);
            }
            catch (Exception ex)
            {
                OnError(ex);
            }
            finally
            {
                Cursor = Cursors.Default;
                // BasePresenter.SwitchScreenUpdating(true);
            }
        }
Example #13
0
        private void ReloadFields()
        {
            bool auto = false;

            WizardBeingUpdated = true;
            var template = new RenewalLetter();
            List <IPolicyClass> policiesReference = null;

            _selectedPolicies = new List <IPolicyClass>();

            if (Cache.Contains(Constants.CacheNames.RegenerateTemplate))
            {
                template = (RenewalLetter)Cache.Get(Constants.CacheNames.RegenerateTemplate);
                Cache.Remove(Constants.CacheNames.RegenerateTemplate);

                if (template.Policies != null)
                {
                    policiesReference = template.Policies;
                }

                chkWarning.Checked  = template.IsAdviceWarningSelected;
                chkFSG.Checked      = template.IsFsgSelected;
                chkPrivacy.Checked  = template.IsPrivacySelected;
                chkRisks.Checked    = template.IsRisksSelected;
                chkSatutory.Checked = template.IsSatutorySelected;

                chkGAW.Checked        = template.IsGawSelected;
                chkContacted.Checked  = template.IsContactSelected;
                chkNewInsurer.Checked = template.IsNewClientSelected;
                chkFunding.Checked    = template.IsFundingSelected;


                if (template.IsPrePrintSelected)
                {
                    chkPrePrint.Checked = template.IsPrePrintSelected;
                }


                Reload = false; //behaviour like a new from this point

                auto = true;
            }
            else
            {
                template          = (RenewalLetter)_wizardPresenter.LoadData(template);
                policiesReference = _wizardPresenter.ReadPoliciesInDocument();

                UpdateMainFragmentCheckBox(Constants.WordDocumentProperties.RlChkContacted, chkContacted);
                UpdateMainFragmentCheckBox(Constants.WordDocumentProperties.RlChkFunding, chkFunding);
                UpdateMainFragmentCheckBox(Constants.WordDocumentProperties.RlChkNewClient, chkNewInsurer);
                UpdateMainFragmentCheckBox(Constants.WordDocumentProperties.RlChkGaw, chkGAW);


                //var value = _presenter.ReadDocumentProperty(Constants.WordDocumentProperties.RlRdoPreprint);
                //bool isSelected;
                //if (Boolean.TryParse(value, out isSelected))
                //{
                //    rdoPrePrintYes.Checked = isSelected;
                //}


                UpdatePrePrintedCheckBoxChecked();

                string fgKeys = _wizardPresenter.ReadDocumentProperty(Constants.WordDocumentProperties.RlSubFragments);
                if (fgKeys != null)
                {
                    string[] keys = fgKeys.Split(';');
                    foreach (string key in keys)
                    {
                        if (key.Equals(Constants.FragmentKeys.FinancialServicesGuideLetter, StringComparison.InvariantCultureIgnoreCase))
                        {
                            chkFSG.Checked = true;
                        }
                        else if (key.Equals(Constants.FragmentKeys.GeneralAdviceWarning, StringComparison.InvariantCultureIgnoreCase))
                        {
                            chkWarning.Checked = true;
                        }
                        else if (key.Equals(Constants.FragmentKeys.PrivacyStatement, StringComparison.InvariantCultureIgnoreCase))
                        {
                            chkPrivacy.Checked = true;
                        }
                        else if (key.Equals(Constants.FragmentKeys.StatutoryNotices, StringComparison.InvariantCultureIgnoreCase))
                        {
                            chkSatutory.Checked = true;
                        }
                        else if (key.Equals(Constants.FragmentKeys.UninsuredRisksReviewList, StringComparison.InvariantCultureIgnoreCase))
                        {
                            chkRisks.Checked = true;
                        }
                    }
                }
            }


            var processedTitles = new List <string>();

            foreach (TreeNodeAdv no in tvaPolicies.AllNodes)
            {
                foreach (TreeNodeAdv cno in no.Children)
                {
                    if (policiesReference != null && policiesReference.Count > 0)
                    {
                        IPolicyClass p = policiesReference.Find(i => i.Title.Replace("\r\a", string.Empty).Equals(cno.Tag.ToString().Replace("\r\a", string.Empty), StringComparison.OrdinalIgnoreCase));
                        if (p != null)
                        {
                            if (!processedTitles.Contains(cno.Tag.ToString()))
                            {
                                if (String.Equals(cno.Tag.ToString(), p.Title.Replace("\r\a", string.Empty), StringComparison.OrdinalIgnoreCase))
                                {
                                    processedTitles.Add(cno.Tag.ToString());
                                    no.Expand();
                                    TreePath path = tvaPolicies.GetPath(cno);

                                    var node = ((AdvancedTreeNode)path.LastNode);
                                    node.CheckState = CheckState.Checked;
                                    node.Checked    = true;

                                    if ((_selectedPolicies.Find(j => j.Title == node.Text) == null))
                                    {
                                        _selectedPolicies.Add(MinorItems.FirstOrDefault(i => i.Title == node.Text));
                                    }
                                }
                            }
                        }
                    }
                }
            }

            txtAddressee.Text      = template.Addressee;
            txtSalutation.Text     = template.Salutation;
            txtClientAddress.Text  = template.ClientAddress;
            txtClientAddress2.Text = template.ClientAddressLine2;
            txtClientAddress3.Text = template.ClientAddressLine3;
            txtClientName.Text     = template.ClientName;

            txtPDSVersion.Text = template.PdsDescVersion;

            txtExecutiveName.Text       = template.ExecutiveName;
            txtExecutiveEmail.Text      = template.ExecutiveEmail;
            txtExecutiveMobile.Text     = template.ExecutiveMobile;
            txtExecutivePhone.Text      = template.ExecutivePhone;
            txtExecutiveTitle.Text      = template.ExecutiveTitle;
            txtExecutiveDepartment.Text = template.ExecutiveDepartment;

            txtBranchAddress1.Text = template.OAMPSBranchAddress;
            txtBranchAddress2.Text = template.OAMPSBranchAddressLine2;

            txtPostal1.Text = template.OAMPSPostalAddress;
            txtPostal2.Text = template.OAMPSPostalAddressLine2;

            txtBranchPhone.Text = template.OAMPSBranchPhone;

            lblLogoTitle.Text      = template.LogoTitle;
            lblCoverPageTitle.Text = template.CoverPageTitle;

            txtReference.Text = template.Reference;
            txtFax.Text       = template.Fax;

            DateTime outDate;

            datePolicy.Value = DateTime.TryParse(template.DatePolicyExpiry, out outDate)
                                   ? outDate
                                   : DateTime.Today;

            datePayment.Value = DateTime.TryParse(template.PaymentDate, out outDate)
                                    ? outDate
                                    : DateTime.Today;

            dateReport.Value = DateTime.TryParse(template.DatePrepared, out outDate)
                                   ? outDate
                                   : DateTime.Today;


            WizardBeingUpdated = false;

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