private void _checked_CheckStateChanged(object sender, TreePathEventArgs e) { var node = ((AdvancedTreeNode)e.Path.LastNode); var isChecked = node.Checked; if (isChecked) { var item = MinorItems.Find(i => i.Title == node.Text); if (item != null) { tvaPolicies.AllNodes.ToList().ForEach( (x) => { var nodeControl = tvaPolicies.GetNodeControls(x); if (nodeControl != null) { var checkbox = nodeControl.FirstOrDefault(y => (y.Control is NodeCheckBox)); //checkbox found var dCheckBox = (NodeCheckBox)checkbox.Control; if (dCheckBox != null) { dCheckBox.SetValue(x, false); } } } ); node.Checked = true; _selectedPolicy = item; } } }
private void _checked_CheckStateChanged(object sender, TreePathEventArgs e) { var node = ((AdvancedTreeNode)e.Path.LastNode); var isChecked = node.Checked; if (Reload && !WizardBeingUpdated) { var previous = !isChecked; if (ContinueWithSignificantChange(sender, previous)) { GenerateNewTemplate = true; } else { var nodeAdv = tvaPolicies.AllNodes.FirstOrDefault(x => x.ToString() == node.Text); var type = sender.GetType(); if (type == typeof(NodeCheckBox)) { ((NodeCheckBox)sender).SetValue(nodeAdv, previous); } return; } } var item = MinorItems.Find(i => i.Title == node.Text); if (isChecked) { if (item != null) { //does it already exist in the selected fragemnts. //multiple policy classes are mapped to the same fragement, we only want to insert one copy of the fragement in the template //also alert the user that they have selected a policy class already mapped to a selected policy class var mappingAlreadySelected = _selectedQuestionnaireFragments.Find(i => i.FragmentPolicyUrl == item.FragmentPolicyUrl); if (mappingAlreadySelected == null) //no existing mapping found { _selectedQuestionnaireFragments.Add(item); } else { MessageBox.Show( string.Format( "The selected policy class '{0}' is already mapped to the same questionnaire as a previously selected policy class '{1}'. \n You will only receive one questionnaire for these policy classes.", item.Title, mappingAlreadySelected.Title)); } } } else { _selectedQuestionnaireFragments.Remove(item); } }
private void ColorMappings(DrawEventArgs e) { if (MinorItems.Any(x => x.FragmentPolicyUrl != null && x.Title == e.Text)) { e.TextColor = Color.Green; } else { if (e.Node.Children.Count > 0 || !String.IsNullOrEmpty(txtFindPolicyClass.Text)) { return; } e.TextColor = Color.DimGray; } }
private void ReloadPolicyClasses(bool regenProcess) { var ids = regenProcess ? _selectedQuestionnaireFragments.Aggregate(string.Empty, (current, p) => current + p.Id + ";") : _wizardPresenter.ReadDocumentProperty(Constants.WordDocumentProperties.IncludedPolicyTypes); if (string.IsNullOrEmpty(ids)) { return; } var l = ids.Split(';'); foreach (var id in l) { var found = MinorItems.FirstOrDefault(x => x.Id == id); if (found == null) { continue; } foreach (var no in tvaPolicies.AllNodes) { if (string.Equals(no.Tag.ToString(), found.Title, StringComparison.OrdinalIgnoreCase)) { if (!regenProcess) { _selectedQuestionnaireFragments.Add(found); } var path = tvaPolicies.GetPath(no); var node = ((AdvancedTreeNode)path.LastNode); node.CheckState = CheckState.Checked; node.Checked = true; if (no.Parent != null) { no.Parent.ExpandAll(); } } } } }
private List <IPolicyClass> GetSelectedPolicies() { var policies = new List <IPolicyClass>(); foreach (var no in tvaPolicies.AllNodes) { foreach (var cno in no.Children) { var path = tvaPolicies.GetPath(cno); var node = ((AdvancedTreeNode)path.LastNode); if (node.Checked) { policies.Add(MinorItems.FirstOrDefault(i => i.Title == node.Text)); } } } return(policies); }
private void ReloadPolicyClasses(IInsuranceRenewalReport v) { if (v.SelectedDocumentFragments == null) { v = _presenter.LoadIncludedPolicyClasses(v); } //repopulate selected fields foreach (var f in v.SelectedDocumentFragments) { var found = MinorItems.FirstOrDefault(x => x.Id == f.Id); if (found != null) { foreach (var no in tvaPolicies.AllNodes) { if (String.Equals(no.Tag.ToString(), found.MajorClass, StringComparison.OrdinalIgnoreCase)) { foreach (var cno in no.Children) { if (String.Equals(cno.Tag.ToString(), found.Title, StringComparison.OrdinalIgnoreCase)) { var path = tvaPolicies.GetPath(cno); var node = ((AdvancedTreeNode)path.LastNode); node.CheckState = CheckState.Checked; node.Checked = true; no.Expand(false); //var item = MinorItems.FirstOrDefault(i => String.Equals(i.Title, found.Title, StringComparison.OrdinalIgnoreCase)); node.Current = found.CurrentInsurer; node.Reccommended = found.RecommendedInsurer; _selectedDocumentFragments.Add(found); } } } } } } }
private List <IPolicyClass> GetSelectedPolicies() { var policies = new List <IPolicyClass>(); // ReSharper disable LoopCanBeConvertedToQuery foreach (TreeNodeAdv no in tvaPolicies.AllNodes) // ReSharper restore LoopCanBeConvertedToQuery { // ReSharper disable LoopCanBeConvertedToQuery foreach (TreeNodeAdv cno in no.Children) // ReSharper restore LoopCanBeConvertedToQuery { var path = tvaPolicies.GetPath(cno); var node = ((AdvancedTreeNode)path.LastNode); if (node.Checked) { policies.Add(MinorItems.FirstOrDefault(i => i.Title == node.Text)); } } } return(policies); }
private void StoreSelectedPolicies() { tvaPolicies.AllNodes.ToList().ForEach( (x) => { var nodeControl = tvaPolicies.GetNodeControls(x); var checkbox = nodeControl.FirstOrDefault(y => (y.Control is NodeCheckBox)); //checkbox found var dCheckBox = (NodeCheckBox)checkbox.Control; if (dCheckBox != null) { var value = dCheckBox.GetValue(x); if ((bool)value == true) { var policyClass = nodeControl.FirstOrDefault( y => (y.Control is NodeTextBox && y.Control.ParentColumn.Header == @"Policy Class")); var policyClassValue = ((NodeTextBox)policyClass.Control).GetValue(x); var currentInsurer = nodeControl.FirstOrDefault( y => (y.Control is NodeTextBox && y.Control.ParentColumn.Header == @"Current Insurer")); var currentInsurerValue = ((NodeTextBox)currentInsurer.Control).GetValue(x); var reccommendedInsurer = nodeControl.FirstOrDefault( y => (y.Control is NodeTextBox && y.Control.ParentColumn.Header == @"Recommended Insurer")); var reccommendedInsurerValue = ((NodeTextBox)reccommendedInsurer.Control).GetValue(x); var reccommendedInsurerId = nodeControl.FirstOrDefault( y => (y.Control is NodeTextBox && y.Control.ParentColumn.Header == @"RecommendedId")); var reccommendedInsurerIdValue = ((NodeTextBox)reccommendedInsurerId.Control).GetValue(x); var currentId = nodeControl.FirstOrDefault( y => (y.Control is NodeTextBox && y.Control.ParentColumn.Header == @"CurrentId")); var currentIdValue = ((NodeTextBox)currentId.Control).GetValue(x); var order = nodeControl.FirstOrDefault( y => (y.Control is NodeTextBox && y.Control.ParentColumn.Header == @"Order")); var orderValue = ((NodeTextBox)order.Control).GetValue(x); //var item = MinorItems.Find(i => i.Title == policyClassValue.ToString()); var item = MinorItems.Find(i => i.Title == policyClassValue.ToString() && i.MajorClass == x.Parent.Tag.ToString()); if (item != null) { item.RecommendedInsurer = reccommendedInsurerValue.ToString(); item.CurrentInsurer = currentInsurerValue.ToString(); var outOrder = 0; int.TryParse(orderValue.ToString(), out outOrder); //if (!String.IsNullOrEmpty(orderValue.ToString()) && int.TryParse(orderValue.ToString(), out outOrder)) //{ //} item.Order = outOrder; if (currentIdValue != null) { item.CurrentInsurerId = currentIdValue.ToString(); } if (reccommendedInsurerIdValue != null) { item.RecommendedInsurerId = reccommendedInsurerIdValue.ToString(); } _selectedDocumentFragments.Add(item); } } } } ); }
private void ReloadPolicyClasses(IInsuranceRenewalReport v, bool reload) { if (v.SelectedDocumentFragments == null) { v = _presenter.LoadIncludedPolicyClasses(v); } int reOrder = 0; //repopulate selected fields v.SelectedDocumentFragments.Sort((x, y) => y.Order.CompareTo(x.Order)); for (int index = v.SelectedDocumentFragments.Count - 1; index >= 0; index--) { var f = v.SelectedDocumentFragments[index]; var found = MinorItems.FirstOrDefault(x => x.Id == f.Id); if (found != null) { foreach (var no in tvaPolicies.AllNodes) { if (String.Equals(no.Tag.ToString(), found.MajorClass, StringComparison.OrdinalIgnoreCase)) { foreach (var cno in no.Children) { if (String.Equals(cno.Tag.ToString(), found.Title, StringComparison.OrdinalIgnoreCase)) { reOrder = reOrder + 1; var 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(); node.ReccommendedId = f.RecommendedInsurerId; node.CurrentId = f.CurrentInsurerId; } } } //var item = // MinorItems.FirstOrDefault( // i => String.Equals(i.Title, f.Title, StringComparison.OrdinalIgnoreCase)); //if (item != null) //{ //_selectedDocumentFragments.Add(item); //} } } } } }
private void _checked_CheckStateChanged(object sender, TreePathEventArgs e) { var node = ((AdvancedTreeNode)e.Path.LastNode); var isChecked = node.Checked; if (Reload && !WizardBeingUpdated) { var previous = !isChecked; if (ContinueWithSignificantChange(sender, previous)) { _generateNewTemplate = true; } else { TreeNodeAdv nodeAdv = tvaPolicies.AllNodes.FirstOrDefault(x => x.ToString() == node.Text); var type = sender.GetType(); if (type == typeof(NodeCheckBox)) { ((NodeCheckBox)sender).SetValue(nodeAdv, previous); } return; } } if (isChecked) { var parent = ((AdvancedTreeNode)e.Path.FirstNode); if (parent != null) { //var item = MinorItems.Find(i => i.Title == node.Text && i.MajorClass == parent.Text); //if (item != null) //{ //} //var d = _treeModel.Nodes[2]; var insurers = new Popups.Insurers(); this.TopMost = false; this.Cursor = Cursors.WaitCursor; //insurers.CurrentInsurers = _insurers; insurers.ShowDialog(); this.Cursor = Cursors.Default; if (insurers.RecommendedInsurer != null && insurers.CurrentInsurer != null) { //item.CurrentInsurer = insurers.CurrentInsurer; //item.RecommendedInsurer = insurers.RecommendedInsurer; //item.CurrentInsurerId = insurers.CurrentInsurerId; //item.RecommendedInsurerId = insurers.RecommendedInsurerId; // _selectedDocumentFragments.Add(item); node.Reccommended = insurers.RecommendedInsurer; node.Current = insurers.CurrentInsurer; node.ReccommendedId = insurers.RecommendedInsurerId; node.CurrentId = insurers.CurrentInsurerId; TreeNodeAdv maxOrder = null; int maxNumber = 0; foreach (TreeNodeAdv x in tvaPolicies.AllNodes) { var currentNumber = _orderPolicy.GetValue(x); if (currentNumber != null) { int intCurrentNumber = 0; if (int.TryParse(currentNumber.ToString(), out intCurrentNumber)) { if (intCurrentNumber > maxNumber) { maxNumber = intCurrentNumber; } } } } node.OrderPolicy = (maxNumber + 1).ToString(); } else { node.Checked = false; } } } else { var item = MinorItems.Find(i => i.Title == node.Text); // var item = fragementPresenter. if (item != null) { // _selectedDocumentFragments.Remove(item); } } }
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; }
private void StoreSelectedPolicies() { //tvaPolicies.AllNodes.ToList().ForEach( // (x) => foreach (var x in tvaPolicies.AllNodes) { var nodeControl = tvaPolicies.GetNodeControls(x); var checkbox = nodeControl.FirstOrDefault(y => (y.Control is NodeCheckBox)); //checkbox found var dCheckBox = (NodeCheckBox)checkbox.Control; if (dCheckBox != null) { object value = dCheckBox.GetValue(x); if ((bool)value) { NodeControlInfo policyClass = nodeControl.FirstOrDefault( y => (y.Control is NodeTextBox && y.Control.ParentColumn.Header == @"Policy Class")); object policyClassValue = ((NodeTextBox)policyClass.Control).GetValue(x); NodeControlInfo currentInsurer = nodeControl.FirstOrDefault( y => (y.Control is NodeTextBox && y.Control.ParentColumn.Header == @"Insurer/s")); object currentInsurerValue = ((NodeTextBox)currentInsurer.Control).GetValue(x); NodeControlInfo currentId = nodeControl.FirstOrDefault( y => (y.Control is NodeTextBox && y.Control.ParentColumn.Header == @"InsurerId")); object currentIdValue = ((NodeTextBox)currentId.Control).GetValue(x); NodeControlInfo order = nodeControl.FirstOrDefault( y => (y.Control is NodeTextBox && y.Control.ParentColumn.Header == @"Order")); object orderValue = ((NodeTextBox)order.Control).GetValue(x); NodeControlInfo policyNumber = nodeControl.FirstOrDefault( y => (y.Control is NodeTextBox && y.Control.ParentColumn.Header == @"Policy Number")); object policyNumberValue = ((NodeTextBox)policyNumber.Control).GetValue(x); //var item = MinorItems.Find(i => i.Title == policyClassValue.ToString()); var item = MinorItems.Find(i => i.Title == policyClassValue.ToString() && i.MajorClass == x.Parent.Tag.ToString()); if (item != null) { if (currentInsurerValue != null) { item.CurrentInsurer = currentInsurerValue.ToString(); } } var outOrder = 0; int.TryParse(orderValue.ToString(), out outOrder); //if (!String.IsNullOrEmpty(orderValue.ToString()) && int.TryParse(orderValue.ToString(), out outOrder)) //{ //} if (item != null) { item.Order = outOrder; if (policyNumberValue != null) { item.PolicyNumber = policyNumberValue.ToString(); } if (currentIdValue != null) { item.CurrentInsurerId = currentIdValue.ToString(); } //todo update listname to settings if (policyClassValue != null) { var ps = LoadClaimsProcedure(Settings.Default.SharePointContextUrl, "Insurance Manual Claims Procedures", policyClassValue.ToString()); if (ps != null && ps.Url != null) { item.FragmentPolicyUrl = ps.Url; } } _selectedPolicyClasses.Add(item); } } } } if (_selectedPolicyClasses != null) { _selectedPolicyClasses.Sort((x, y) => x.Order.CompareTo(y.Order)); } }
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(); } }
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); //} } } }