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