public void LoadIncludedPolicyClassesTest() { var document = new UnitTestDocument(); IBaseView view = null; document.MockDocumentProperties = new List <string>(); var target = new InsuranceRenewealReportWizardPresenter(document, view); var template = new InsuranceRenewalReport { ClientName = "client name test", ClientCommonName = "client common name test" }; var expected = new InsuranceRenewalReport { ClientName = "client name test", ClientCommonName = "client common name test" }; IInsuranceRenewalReport actual = target.LoadIncludedPolicyClasses(template); Assert.AreEqual(expected.ClientCommonName, actual.ClientCommonName); Assert.AreEqual(expected.ClientName, actual.ClientName); Assert.AreEqual(expected.CoverPageTitle, actual.CoverPageTitle); }
private void LoadForm() { //var selectedCoverPage = _presenter.ReadDocumentProperty(Constants.WordDocumentProperties.CoverPageTitle); //selectedCoverPage = (String.IsNullOrEmpty(selectedCoverPage) ? lblCoverPageTitle.Text : selectedCoverPage); //var selectedLogo = _presenter.ReadDocumentProperty(Constants.WordDocumentProperties.LogoTitle); //selectedLogo = (String.IsNullOrEmpty(selectedLogo) ? lblLogoTitle.Text : selectedLogo); var uiScheduler = TaskScheduler.FromCurrentSynchronizationContext(); base.LoadGenericImageTabs(uiScheduler, tbcWizardScreens, lblCoverPageTitle.Text, lblLogoTitle.Text); if (Reload) // this happens if they click the button on the ribbon. { var template = new InsuranceRenewalReport(); var values = _presenter.LoadData(template); var v = ((IInsuranceRenewalReport)values); LoadDataSources(null); ReloadFields(v); ReloadPolicyClasses(v, false); ReloadSegments(); ReloadStatutory(); ReloadRemuneration(); ReloadUFI(); ReloadClientProfile(); } else //new template { Task.Factory.StartNew(() => LoadDataSources(uiScheduler)); } }
public void SendSeg4or5Message(InsuranceRenewalReport template, string recipients) { var textInfo = new CultureInfo("en-AU", false).TextInfo; var name = textInfo.ToTitleCase(Environment.UserName.Replace(".", " ")); var bodywithValues = string.Format(@"Hello, <br/> <br/> This is an automated email generated by the CSS Template wizard. <br/><br/> {0} has just created a New Business Proposal – short document for a segment 4 / 5 client. <br/><br/> Details are below. Please action as appropriate. <br/> Account Executive: {1}<br/> Client Name: {2}<br/>", name, template.ExecutiveName, template.ClientName); Document.SendEmail("New Business Proposal – short (Seg 4 or 5)", bodywithValues, recipients); }
public void SendUFIMessage(InsuranceRenewalReport template, string recipients) { var textInfo = new CultureInfo("en-AU", false).TextInfo; var name = textInfo.ToTitleCase(Environment.UserName.Replace(".", " ")); var bodywithValues = string.Format(@"Hello, <br/> <br/> This is an automated email generated by the CSS Template wizard. <br/><br/> {0} has just created an Insurance Renewal Report recommending an unauthorised foreign insurer. <br/><br/> Details are below. Please action as appropriate. <br/> Account Executive: {1}<br/> Client Name: {2}<br/>", name, template.ExecutiveName, template.ClientName); Document.SendEmail("UFI recommended", bodywithValues, recipients); }
public void DeleteContactTables(InsuranceRenewalReport template) { if (string.IsNullOrEmpty(template.AssistantExecutiveName)) { Document.DeleteTable(Constants.WordTables.AssistantExec); } if (string.IsNullOrEmpty(template.ClaimsExecutiveName)) { Document.DeleteTable(Constants.WordTables.ClaimsExec); } if (string.IsNullOrEmpty(template.OtherContactName)) { Document.DeleteTable(Constants.WordTables.OtherContact); } }
public void btnConvertToManual_Click(IRibbonControl control) { var reportDoc = new OfficeDocument(Globals.ThisAddIn.Application.ActiveDocument); var presenterreportDoc = new InsuranceRenewealReportWizardPresenter(reportDoc, null); var reportTemplate = new InsuranceRenewalReport(); reportTemplate = (InsuranceRenewalReport)presenterreportDoc.LoadData(reportTemplate); reportTemplate = (InsuranceRenewalReport)presenterreportDoc.LoadIncludedPolicyClasses(reportTemplate); ObjectCache cache = MemoryCache.Default; cache.Add(Constants.CacheNames.ConvertWizard, reportTemplate, new CacheItemPolicy()); var manualDoc = reportDoc.OpenFile(Settings.Default.TemplateInsuranceManual); var allTables = reportDoc.GetTablesByNamePrefix(string.Empty); foreach (var tableName in allTables) { if (!manualDoc.TableExists(tableName)) { continue; } if (tableName.Contains("Policy Wording")) { var text = reportDoc.GetTableCellText(tableName, 0, 2); manualDoc.TypeTableCellText(tableName, 0, 2, text); } else { reportDoc.CopyTable(tableName); manualDoc.SelectTable(tableName); manualDoc.DeleteTable(tableName); manualDoc.InsertParagraphBreak(); manualDoc.PasteClipboardOriginalFormatting(); } } //if (reportDoc.TableExists(Constants.WordTables.PolicyWording) && manualDoc.TableExists(Constants.WordTables.PolicyWording)) //{ // reportDoc.CopyTable(Constants.WordTables.PolicyWording); // manualDoc.DeleteTable(Constants.WordTables.PolicyWording); // manualDoc.PasteClipboard(); //} var allBookmarkedSections = reportDoc.GetBookmarksByPartialName(Constants.WordBookmarks.SummaryOfCoverStart); foreach (var bookmark in allBookmarkedSections) { var id = bookmark.Replace(Constants.WordBookmarks.SummaryOfCoverStart, string.Empty); if (reportDoc.HasBookmark(Constants.WordBookmarks.SummaryOfCoverStart + id) && reportDoc.HasBookmark(Constants.WordBookmarks.SummaryOfCoverEnd + id)) { var rs = reportDoc.GetBookmarkStartRange(Constants.WordBookmarks.SummaryOfCoverStart + id); var re = reportDoc.GetBookmarkStartRange(Constants.WordBookmarks.SummaryOfCoverEnd + id); reportDoc.CopyRange(rs, re); if (manualDoc.HasBookmark(Constants.WordBookmarks.SummaryOfCoverStart + id)) { //var ms = manualDoc.GetBookmarkStartRange(Constants.WordBookmarks.SummaryOfCoverStart + id); manualDoc.MoveCursorToStartOfBookmark(Constants.WordBookmarks.SummaryOfCoverStart + id); manualDoc.PasteClipboard(); } } } if (reportDoc.HasBookmark(Constants.WordBookmarks.InsertClientProfile) && reportDoc.HasBookmark(Constants.WordBookmarks.InsertClientProfileEnd)) { var rs = reportDoc.GetBookmarkStartRange(Constants.WordBookmarks.InsertClientProfile); var re = reportDoc.GetBookmarkStartRange(Constants.WordBookmarks.InsertClientProfileEnd); reportDoc.CopyRange(rs, re); if (manualDoc.HasBookmark(Constants.WordBookmarks.InsertClientProfile)) { var ms = manualDoc.GetBookmarkStartRange(Constants.WordBookmarks.InsertClientProfile); var me = manualDoc.GetBookmarkStartRange(Constants.WordBookmarks.InsertClientProfileEnd); manualDoc.DeleteRange(ms, me); manualDoc.MoveCursorToStartOfBookmark(Constants.WordBookmarks.InsertClientProfile); manualDoc.PasteClipboard(); } } manualDoc.MoveToStartOfDocument(); //var presenterManualDoc = new RibbonWizardPresenter(manualDoc, null); //var p = reportDoc.TurnOffProtection(string.Empty); //presenterManualDoc.PopulateData(reportTemplate); //manualDoc.PopulateControl(Constants.WordContentControls.DocumentTitle, "Insurance Manual"); //reportDoc.TurnOnProtection(p, string.Empty); //var w = new BaseWizardForm(); //var t = new InsuranceManual(); //t.DocumentTitle = "Insurance Manual zzzz"; //w.LogUsage(t, Enums.UsageTrackingType.ConvertDocument); }
private InsuranceRenewalReport GenerateTempalteObject() { //buid the marketing template var template = new InsuranceRenewalReport { DocumentTitle = BasePresenter.ReadDocumentProperty("Title"),//Constants.TemplateNames.InsuranceRenewalReport, DocumentSubTitle = string.Empty, ClientName = txtClientName.Text, ClientCommonName = txtClientCommonName.Text, PeriodOfInsuranceFrom = dtpPeriodOfInsuranceFrom.Text, PeriodOfInsuranceTo = dtpPeriodOfInsuranceTo.Text, ExecutiveName = txtExecutiveName.Text, ExecutiveEmail = txtExecutiveEmail.Text, ExecutivePhone = txtExecutivePhone.Text, ExecutiveTitle = txtExecutiveTitle.Text, ExecutiveMobile = txtExecutiveMobile.Text, ExecutiveDepartment = txtExecutiveDepartment.Text, AssistantExecutiveName = txtAssistantExecutiveName.Text, AssistantExecutiveTitle = txtAssistantExecutiveTitle.Text, AssistantExecutivePhone = txtAssistantExecutivePhone.Text, AssistantExecutiveEmail = txtAssistantExecutiveEmail.Text, AssistantExecDepartment = txtAssitantExecDepartment.Text, ClaimsExecutiveName = txtClaimsExecutiveName.Text, ClaimsExecutiveTitle = txtClaimsExecutiveTitle.Text, ClaimsExecutivePhone = txtClaimsExecutivePhone.Text, ClaimsExecutiveEmail = txtClaimsExecutiveEmail.Text, ClaimsExecDepartment = txtClaimExecDepartment.Text, OtherContactName = txtOtherContactName.Text, OtherContactTitle = txtOtherContactTitle.Text, OtherContactPhone = txtOtherContactPhone.Text, OtherContactEmail = txtOtherContactEmail.Text, OtherExecDepartment = txtOtherExecDepartment.Text, OAMPSBranchAddress = txtBranchAddress1.Text, OAMPSBranchAddressLine2 = txtBranchAddress2.Text, DatePrepared = DateTime.Now.ToString(@"dd/MM/yyyy"), SelectedDocumentFragments = _selectedDocumentFragments }; var baseTemplate = (BaseTemplate)template; var logoTab = tbcWizardScreens.TabPages[Constants.ControlNames.TabPageLogosName]; PopulateLogosToTemplate(logoTab, ref baseTemplate); var covberTab = tbcWizardScreens.TabPages[Constants.ControlNames.TabPageCoverPagesName]; PopulateCoversToTemplate(covberTab, ref baseTemplate); template.Segment = _selectedSegment; template.Remuneration = _selectedRemuneration; template.Statutory = _selectedStatutory; template.PopulateUFI = _populateUFI; template.PopulateClientProfile = _populateClientProfile; return(template); }
public void SendUFIMessage(InsuranceRenewalReport template) { //string fromEmail = "*****@*****.**";//sending email from... //string ToEmail = "*****@*****.**";//destination email //string body = "test b"; //string subject = "test s"; //try //{ // SmtpClient sMail = new SmtpClient("mail.wesins.wiroot.internal");//exchange or smtp server goes here. // sMail.DeliveryMethod = SmtpDeliveryMethod.Network; // //sMail.Credentials = new NetworkCredential("username","password");this line most likely wont be needed if you are already an authenticated user. // sMail.Send(fromEmail, ToEmail, subject, body); //} //catch (Exception ex) //{ // //do something after error if there is one //} //var splitedArray = body.Split('\\'); //string bodywithValues = null; //foreach (var s in splitedArray) //{ // if(string.IsNullOrEmpty(s)) continue; // foreach (var pInfo in template.GetType().GetProperties()) // { // if (pInfo == null) // break; // if (!String.Equals(pInfo.PropertyType.Name, "string", StringComparison.OrdinalIgnoreCase)) continue; // if(string.Equals(pInfo.Name, s, StringComparison.InvariantCultureIgnoreCase)) // { // if (pInfo.GetValue(template, null) != null) // bodywithValues += pInfo.GetValue(template, null).ToString(); // } // else // { // bodywithValues += s; // } // } //} var bodywithValues = string.Format(@"This is a UFI email with some fields: <br> user name: {0}; <br> ClaimsExecutiveName:{1};<br> ClaimsExecDepartment:{2}; <br> DatePrepared:{3};" + "<table border='1'>" + BuildTable(template.SelectedDocumentFragments) + "</table>", template.ClientName, template.ClaimsExecutiveName, template.ClaimsExecDepartment, template.DatePrepared); //TODO GET THIS BACK IN THE NEXT RELEASE //Document.SendEmail(bodywithValues); //var message = new MailMessage(); //var smtp = new SmtpClient(); //message.From = new MailAddress("*****@*****.**"); //message.To.Add(new MailAddress("*****@*****.**")); //message.Subject = "Test"; //message.Body = "Content"; ////smtp.Port = 587; //smtp.Host = "mail.wesins.wiroot.internal"; //smtp.EnableSsl = true; //smtp.UseDefaultCredentials = true; ////smtp.Credentials = NetworkCredential("*****@*****.**", "pwd"); //smtp.DeliveryMethod = SmtpDeliveryMethod.Network; //smtp.Send(message); }
private InsuranceRenewalReport GenerateTempalteObject() { //buid the marketing template var template = new InsuranceRenewalReport { DocumentTitle = BasePresenter.ReadDocumentProperty("Title"),//Constants.TemplateNames.InsuranceRenewalReport, DocumentSubTitle = string.Empty, ClientName = txtClientName.Text, ClientCommonName = txtClientCommonName.Text, PeriodOfInsuranceFrom = dtpPeriodOfInsuranceFrom.Text, PeriodOfInsuranceTo = dtpPeriodOfInsuranceTo.Text, ExecutiveName = txtExecutiveName.Text, ExecutiveEmail = txtExecutiveEmail.Text, ExecutivePhone = txtExecutivePhone.Text, ExecutiveTitle = txtExecutiveTitle.Text, ExecutiveMobile = txtExecutiveMobile.Text, ExecutiveDepartment = txtExecutiveDepartment.Text, AssistantExecutiveName = txtAssistantExecutiveName.Text, AssistantExecutiveTitle = txtAssistantExecutiveTitle.Text, AssistantExecutivePhone = txtAssistantExecutivePhone.Text, AssistantExecutiveEmail = txtAssistantExecutiveEmail.Text, AssistantExecDepartment = txtAssitantExecDepartment.Text, ClaimsExecutiveName = txtClaimsExecutiveName.Text, ClaimsExecutiveTitle = txtClaimsExecutiveTitle.Text, ClaimsExecutivePhone = txtClaimsExecutivePhone.Text, ClaimsExecutiveEmail = txtClaimsExecutiveEmail.Text, ClaimsExecDepartment = txtClaimExecDepartment.Text, OtherContactName = txtOtherContactName.Text, OtherContactTitle = txtOtherContactTitle.Text, OtherContactPhone = txtOtherContactPhone.Text, OtherContactEmail = txtOtherContactEmail.Text, OtherExecDepartment = txtOtherExecDepartment.Text, OAMPSBranchAddress = txtBranchAddress1.Text, OAMPSBranchAddressLine2 = txtBranchAddress2.Text, DatePrepared = DateTime.Now.ToString(CultureInfo.InvariantCulture), SelectedDocumentFragments = _selectedDocumentFragments }; var baseTemplate = (BaseTemplate)template; var logoTab = tbcWizardScreens.TabPages[Constants.ControlNames.TabPageLogosName]; //foreach (Control c in logoTab.Controls) //{ // if (c.GetType() == typeof(ValueRadioButton)) // { // var v = ((ValueRadioButton)c); // if (v.Checked) // { // template.LogoImageUrl = v.GetValue(Constants.RadioButtonValues.ImageUrl); // template.LogoTitle = v.Text; // template.OAMPSCompanyName = v.Text; // template.OAMPSAfsl = v.GetValue(Constants.RadioButtonValues.AFSLKey); // template.OAMPSAbnNumber = v.GetValue(Constants.RadioButtonValues.ABNKey); // template.WebSite = v.GetValue(Constants.RadioButtonValues.WebsiteKey); // } // } //} PopulateLogosToTemplate(logoTab, ref baseTemplate); var covberTab = tbcWizardScreens.TabPages[Constants.ControlNames.TabPageCoverPagesName]; PopulateCoversToTemplate(covberTab, ref baseTemplate); //foreach (Control c in covberTab.Controls) //{ // if (c.GetType() == typeof(ValueRadioButton)) // { // var v = ((ValueRadioButton)c); // if (v.Checked) // { // template.CoverPageImageUrl = v.GetValue(Constants.RadioButtonValues.ImageUrl); // template.CoverPageTitle = v.Text; // } // } //} template.Segment = _selectedSegment; template.Remuneration = _selectedRemuneration; template.Statutory = _selectedStatutory; template.PopulateUFI = _populateUFI; return(template); }