예제 #1
0
        private void AddAttachments(GenericLetter 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)
            {
                _wizardPresenter.InsertSubFragments(Constants.WordBookmarks.RenewalLetterSub, Constants.WordBookmarks.RenewalLetterMain, attachmentFragments, Settings.Default.BlankFSGFragement);
            }
        }
예제 #2
0
        private void PopulateAddress(GenericLetter 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 LetterGenerator()
        {
            GenericLetter offer = new GenericLetter()
            {
                Title   = "Offer Letter",
                Subject = "Confirmation of Employment",
                Place   = "Bangalore"
            };

            offer.HTMLTemplate        = File.ReadAllText("EmpLetterTemplate.html");
            templates["Offer Letter"] = offer;


            GenericLetter promo = new GenericLetter()
            {
                Title   = "Promotion Letter",
                Subject = "Promotion / Change Of Designation Communication",
                Place   = "Netherlands"
            };

            promo.HTMLTemplate            = File.ReadAllText("PromoLetterTemplate.html");
            templates["Promotion Letter"] = promo;
        }
예제 #4
0
        private void Next_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                //    BasePresenter.SwitchScreenUpdating(false);

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

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

                    var letter = new GenericLetter
                    {
                        Addressee           = txtAddressee.Text,
                        Salutation          = txtSalutation.Text,
                        ClientAddress       = txtClientAddress.Text,
                        ClientAddressLine2  = txtClientAddress2.Text,
                        ClientAddressLine3  = txtClientAddress3.Text,
                        ClientName          = txtClientName.Text,
                        DatePrepared        = dateReport.Value.ToString(CultureInfo.InvariantCulture),
                        ExecutiveName       = txtExecutiveName.Text,
                        ExecutiveEmail      = txtExecutiveEmail.Text,
                        ExecutiveMobile     = txtExecutiveMobile.Text,
                        ExecutivePhone      = txtExecutivePhone.Text,
                        ExecutiveTitle      = txtExecutiveTitle.Text,
                        ExecutiveDepartment = txtExecutiveDepartment.Text,
                        OAMPSBranchPhone    = txtBranchPhone.Text,
                        Reference           = txtReference.Text,
                        Subject             = txtSubject.Text,
                        Fax                     = txtFax.Text,
                        PolicyType              = _selectedPolicy,
                        IsFsgSelected           = chkFSG.Checked,
                        IsPrivacySelected       = chkPrivacy.Checked,
                        IsRisksSelected         = chkRisks.Checked,
                        IsSatutorySelected      = chkSatutory.Checked,
                        IsAdviceWarningSelected = chkWarning.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.TemplateGenericLetter);
                    }
                    else
                    {
                        PopulateAddress(letter);
                        //call presenter to populate
                        PopulateDocument(letter, lblCoverPageTitle.Text, lblLogoTitle.Text);

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

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

                        //tracking
                        LogUsage(letter,
                                 LoadType == Enums.FormLoadType.RegenerateTemplate
                                     ? Enums.UsageTrackingType.RegenerateDocument
                                     : Enums.UsageTrackingType.NewDocument);
                    }
                    //    _presenter.ActivateDocument();
                    Close();
                }
                else
                {
                    SwitchTab(tbcWizardScreens.SelectedIndex + 1);
                }
            }
            catch (Exception ex)
            {
                OnError(ex);
            }
            finally
            {
                Cursor = Cursors.Default;
                //  BasePresenter.SwitchScreenUpdating(true);
            }
        }
예제 #5
0
        private void ReloadFields()
        {
            bool auto = false;

            WizardBeingUpdated = true;
            var    template        = new GenericLetter();
            string policyReference = null;

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

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

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

                if (template.IsPrePrintSelected)
                {
                    chkPrePrint.Checked = template.IsPrePrintSelected;
                }
                Reload = false; //behaviour like a new from this point
                auto   = true;
            }
            else
            {
                template = (GenericLetter)_wizardPresenter.LoadData(template);
                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;
                        }
                    }
                }
            }

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

            txtSubject.Text    = template.Subject;
            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;

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

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