public IInsuranceManual LoadIncludedPolicyClasses(IInsuranceManual template) { //load selected policy classes template.SelectedPolicyClasses = new List <IPolicyClass>(); string items = Document.GetPropertyValue(Constants.WordDocumentProperties.IncludedPolicyTypes); // var regex = new Regex(Constants.Seperators.Lineseperator); // var split = regex.Split(items); foreach (string i in items.Split(';')) //foreach (var i in split) { string[] d = i.Split('_'); if (d.Length == 3) { var p = new PolicyClass { Id = (d.Length == 0) ? string.Empty : d[0].ToString(CultureInfo.InvariantCulture), RecommendedInsurer = Document.ReadContentControlValue(d[2]), CurrentInsurer = Document.ReadContentControlValue(d[1]), RecommendedInsurerId = d[2].Substring(0, d[2].IndexOf("r", StringComparison.Ordinal)), CurrentInsurerId = d[1].Substring(0, d[1].IndexOf("c", StringComparison.Ordinal)), Order = int.Parse(d[2].Substring(d[2].IndexOf("r", StringComparison.Ordinal) + 1)) }; template.SelectedPolicyClasses.Add(p); } } return(template); }
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; // BasePresenter.SwitchScreenUpdating(false); StoreSelectedPolicies(); if (GenerateNewTemplate) { IInsuranceManual template = GenerateTempalteObject(); Cache.Add(Constants.CacheNames.RegenerateTemplate, template, new CacheItemPolicy()); _wizardPresenter.GenerateNewTemplate(Constants.CacheNames.RegenerateTemplate, Settings.Default.TemplateInsuranceRenewalReport); } else { //call presenter to populate PopulateDocument(); //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(); } Close(); } catch (Exception ex) { OnError(ex); } finally { Cursor = Cursors.Default; // BasePresenter.SwitchScreenUpdating(true); } } else { SwitchTab(tbcWizardScreens.SelectedIndex + 1); } }
private void ReloadFields(IInsuranceManual v) { DateTime outDate; txtClientName.Text = v.ClientName; txtClientCommonName.Text = v.ClientCommonName; txtExecutiveEmail.Text = v.ExecutiveEmail; txtExecutiveName.Text = v.ExecutiveName; txtExecutivePhone.Text = v.ExecutivePhone; txtExecutiveTitle.Text = v.ExecutiveTitle; txtExecutiveDepartment.Text = v.ExecutiveDepartment; txtExecutiveMobile.Text = v.ExecutiveMobile; //TODO: bug here as dates stored in document can be just year. therefor they wont cast. dtpPeriodOfInsuranceFrom.Text = DateTime.TryParse(v.PeriodOfInsuranceFrom, out outDate) ? v.PeriodOfInsuranceFrom : String.Empty; dtpPeriodOfInsuranceTo.Text = DateTime.TryParse(v.PeriodOfInsuranceTo, out outDate) ? v.PeriodOfInsuranceTo : string.Empty; lblLogoTitle.Text = v.LogoTitle; lblCoverPageTitle.Text = v.CoverPageTitle; txtAssistantExecutiveName.Text = v.AssistantExecutiveName; txtAssistantExecutiveTitle.Text = v.AssistantExecutiveTitle; txtAssistantExecutivePhone.Text = v.AssistantExecutivePhone; txtAssistantExecutiveEmail.Text = v.AssistantExecutiveEmail; txtAssitantExecDepartment.Text = v.AssistantExecDepartment; txtClaimsExecutiveEmail.Text = v.ClaimsExecutiveEmail; txtClaimsExecutiveName.Text = v.ClaimsExecutiveName; txtClaimsExecutivePhone.Text = v.ClaimsExecutivePhone; txtClaimsExecutiveTitle.Text = v.ClaimsExecutiveTitle; txtClaimExecDepartment.Text = v.ClaimsExecDepartment; txtOtherContactEmail.Text = v.OtherContactEmail; txtOtherContactName.Text = v.OtherContactName; txtOtherContactPhone.Text = v.OtherContactPhone; txtOtherContactTitle.Text = v.OtherContactTitle; txtOtherExecDepartment.Text = v.OtherExecDepartment; lblCoverPageTitle.Text = v.CoverPageTitle; lblLogoTitle.Text = v.LogoTitle; txtBranchAddress1.Text = v.OAMPSBranchAddress; txtBranchAddress2.Text = v.OAMPSBranchAddressLine2; }
private void PopulateDocument() { IInsuranceManual template = GenerateTempalteObject(); //change the graphics selected //if (Streams == null) return; _wizardPresenter.PopulateGraphics(template, lblCoverPageTitle.Text, lblLogoTitle.Text); if (LoadType == Enums.FormLoadType.RibbonClick) { LogUsage(template, Enums.UsageTrackingType.UpdateData); _wizardPresenter.PopulateData(template); return; } _wizardPresenter.PopulateImportantNotices(); if (rdoClitProfileYes.Checked) { _wizardPresenter.PopulateclientProfile(Settings.Default.FragmentClientProfile); } _wizardPresenter.PopulatePolicyTable(template.SelectedPolicyClasses); _wizardPresenter.PopulateProgramSummarys(template.SelectedPolicyClasses, Settings.Default.InsuranceManualProgramSummary); _wizardPresenter.PopulateClaimsProcedures(template.SelectedPolicyClasses); _wizardPresenter.PopulateData(template); _wizardPresenter.MoveToStartOfDocument(); //tracking LogUsage(template, LoadType == Enums.FormLoadType.RegenerateTemplate ? Enums.UsageTrackingType.RegenerateDocument : Enums.UsageTrackingType.NewDocument); }
private void ReloadPolicyClasses(IInsuranceManual v, bool reload) { if (v.SelectedPolicyClasses == null) { v = _wizardPresenter.LoadIncludedPolicyClasses(v); } int reOrder = 0; //repopulate selected fields v.SelectedPolicyClasses.Sort((x, y) => y.Order.CompareTo(x.Order)); for (int index = v.SelectedPolicyClasses.Count - 1; index >= 0; index--) { IPolicyClass f = v.SelectedPolicyClasses[index]; IPolicyClass found = MinorItems.FirstOrDefault(x => x.Id == f.Id); if (found != null) { foreach (TreeNodeAdv no in tvaPolicies.AllNodes) { if (String.Equals(no.Tag.ToString(), found.MajorClass, StringComparison.OrdinalIgnoreCase)) { foreach (TreeNodeAdv cno in no.Children) { if (String.Equals(cno.Tag.ToString(), found.Title, StringComparison.OrdinalIgnoreCase)) { reOrder = reOrder + 1; TreePath path = tvaPolicies.GetPath(cno); var node = ((AdvancedTreeNode)path.LastNode); node.CheckState = CheckState.Checked; node.Checked = true; no.Expand(false); //if (reload) //on generate get them from cache as they're passed thru //{ // node.Current = found.CurrentInsurer; // node.Reccommended = found.RecommendedInsurer; // node.OrderPolicy = reOrder.ToString(); // node.ReccommendedId = found.RecommendedInsurerId; // node.CurrentId = found.CurrentInsurerId; //} //else //{ node.Current = f.CurrentInsurer; node.Reccommended = f.RecommendedInsurer; node.OrderPolicy = reOrder.ToString(CultureInfo.InvariantCulture); node.ReccommendedId = f.RecommendedInsurerId; node.CurrentId = f.CurrentInsurerId; //} } } //var item = // MinorItems.FirstOrDefault( // i => String.Equals(i.Title, f.Title, StringComparison.OrdinalIgnoreCase)); //if (item != null) //{ //_selectedPolicyClasses.Add(item); //} } } } } }
private void ReloadPolicyClasses(IInsuranceManual v, bool reload) { if (v.SelectedPolicyClasses == null) { v = _wizardPresenter.LoadIncludedPolicyClasses(v); } var reOrder = 0; //repopulate selected fields v.SelectedPolicyClasses.Sort((x, y) => y.Order.CompareTo(x.Order)); var othercount = 1; var lastOtherFoundId = "-1"; var otherProcessed = false; for (var index = v.SelectedPolicyClasses.Count - 1; index >= 0; index--) { var f = v.SelectedPolicyClasses[index]; var found = MinorItems.FirstOrDefault(x => x.Id == f.Id); var isOther = false; if (found == null) { otherProcessed = false; //other renames need to handle. (holy moley) found = MinorItems.FirstOrDefault(x => x.Title.StartsWith("click me", StringComparison.OrdinalIgnoreCase) && x.Id != lastOtherFoundId); isOther = true; othercount++; } if (found == null) { continue; } foreach (var no in tvaPolicies.AllNodes) { lastOtherFoundId = found.Id; if (!String.Equals(no.Tag.ToString(), found.MajorClass, StringComparison.OrdinalIgnoreCase)) { continue; } foreach (var cno in no.Children) { if (!String.Equals(cno.Tag.ToString(), found.Title, StringComparison.OrdinalIgnoreCase)) { continue; } if (isOther && otherProcessed) { continue; } reOrder = reOrder + 1; var path = tvaPolicies.GetPath(cno); var node = ((AdvancedTreeNode)path.LastNode); node.CheckState = CheckState.Checked; node.Checked = true; no.Expand(false); if (isOther) { node.Text = f.Title; otherProcessed = true; } //if (reload) //on generate get them from cache as they're passed thru //{ // node.Current = found.CurrentInsurer; // node.Reccommended = found.RecommendedInsurer; // node.OrderPolicy = reOrder.ToString(); // node.ReccommendedId = found.RecommendedInsurerId; // node.CurrentId = found.CurrentInsurerId; //} //else //{ node.Insurer = f.RecommendedInsurer; node.OrderPolicy = reOrder.ToString(CultureInfo.InvariantCulture); node.InsurerId = f.RecommendedInsurerId; //} } //var item = // MinorItems.FirstOrDefault( // i => String.Equals(i.Title, f.Title, StringComparison.OrdinalIgnoreCase)); //if (item != null) //{ //_selectedPolicyClasses.Add(item); //} } } }