private void ValuePushed_(object sender, NodeControlValueEventArgs e) { if (e.Node != null && e.Node.Tag != null) { GrtTreeNode node = e.Node.Tag as GrtTreeNode; String value = e.Value as String; if (node != null && value != null) { GrtValueType nodeType = (GrtValueType)_grtTree.get_field_type(node.NodeId, _valueColumn); NodeCustomBox.EditMethod editMethod = GetNodeEditMethod(e.Node); switch (nodeType) { case GrtValueType.StringValue: PushStringValue(node, value, editMethod); break; case GrtValueType.IntValue: PushIntValue(node, value, editMethod); break; case GrtValueType.RealValue: PushRealValue(node, value, editMethod); break; default: MessageBox.Show("This value cannot be edited."); break; } } } }
private void ValueNeeded_(object sender, NodeControlValueEventArgs e) { if (e.Node != null && e.Node.Tag != null) { GrtTreeNode node = e.Node.Tag as GrtTreeNode; if (node != null) { string caption; _grtTree.get_field(node.NodeId, _valueColumn, out caption); e.Value = caption; NodeCustomBox.EditMethod editMethod = GetNodeEditMethod(e.Node); switch (editMethod) { case NodeCustomBox.EditMethod.Bool: switch (e.Value as string) { case "": case "0": e.Value = "False"; break; default: e.Value = "True"; break; } break; } } } }
private void roleAssignButton_Click(object sender, EventArgs e) { foreach (Aga.Controls.Tree.TreeNodeAdv node in allRolesTreeView.SelectedNodes) { GrtTreeNode aNode = node.Tag as GrtTreeNode; objectRoleListBE.add_role_for_privileges(roleTreeBE.get_role_with_id(aNode.NodeId)); } objectRoleListModel.RefreshModel(); }
private void PushRealValue(GrtTreeNode node, string value, NodeCustomBox.EditMethod editMethod) { try { double doubleValue = double.Parse(value); _grtTree.set_field(node.NodeId, _valueColumn, doubleValue); } catch (Exception ex) { MessageBox.Show(String.Format("The value you have entered is not a float value.\n\n({0})", ex.Message)); } }
NodeCustomBox.EditMethod GetNodeEditMethod_(TreeNodeAdv treeNode) { if (null != treeNode) { GrtTreeNode node = treeNode.Tag as GrtTreeNode; if (null != node) { string editMethod; _grtTree.get_field(node.NodeId, _editMethodColumn, out editMethod); if (editMethod.StartsWith("numeric")) { return(NodeCustomBox.EditMethod.Numeric); } else if (editMethod.StartsWith("bool")) { return(NodeCustomBox.EditMethod.Bool); } else if (editMethod.StartsWith("longtext")) { return(NodeCustomBox.EditMethod.LongText); } else if (editMethod.StartsWith("color")) { return(NodeCustomBox.EditMethod.Color); } else if (editMethod.StartsWith("file")) { return(NodeCustomBox.EditMethod.File); } else if (editMethod.StartsWith("datetime")) { return(NodeCustomBox.EditMethod.DateTime); } else if (editMethod.StartsWith("date")) { return(NodeCustomBox.EditMethod.Date); } else if (editMethod.StartsWith("time")) { return(NodeCustomBox.EditMethod.Time); } else { return(NodeCustomBox.EditMethod.Text); } } } return(NodeCustomBox.EditMethod.Text); }
bool IsNodeReadonly_(TreeNodeAdv treeNode) { if (null != treeNode) { GrtTreeNode node = treeNode.Tag as GrtTreeNode; if (null != node) { string isReadonly; _grtTree.get_field(node.NodeId, _isReadonlyColumn, out isReadonly); return(isReadonly == "1"); } } return(false); }
void BeforeEdit_(TreeNodeAdv treeNode, NodeCustomBox customBox) { GrtTreeNode node = treeNode.Tag as GrtTreeNode; if (null == node) { return; } string editMethod; _grtTree.get_field(node.NodeId, _editMethodColumn, out editMethod); if (editMethod.StartsWith("numeric")) { string[] sa = editMethod.Split(new Char[] { ':', ',' }); if (1 < sa.Length) { for (int n = 1; sa.Length > n; ++n) { try { int v = int.Parse((string)sa.GetValue(n)); switch (n) { case 1: customBox.Minimum = v; break; case 2: customBox.Maximum = v; break; case 3: customBox.Increment = v; break; case 4: customBox.DecimalPlaces = v; break; } } catch (Exception) { } } } } }
private void PushIntValue(GrtTreeNode node, string value, NodeCustomBox.EditMethod editMethod) { try { int intValue = 0; switch (editMethod) { case NodeCustomBox.EditMethod.Bool: switch (value) { case "": case "False": intValue = 0; break; default: intValue = 1; break; } break; default: try { Decimal d = Decimal.Parse(value, System.Globalization.NumberStyles.Float); intValue = Decimal.ToInt32(Decimal.Round(d, 0)); } catch (Exception) { } break; } _grtTree.set_field(node.NodeId, _valueColumn, intValue); } catch (Exception ex) { MessageBox.Show(String.Format("The value you have entered is not an integer value.\n\n({0})", ex.Message)); } }
private void PushStringValue(GrtTreeNode node, string value, NodeCustomBox.EditMethod editMethod) { _grtTree.set_field(node.NodeId, _valueColumn, value); }