// IWebHandler public virtual bool ProcessRequest(HttpContext context) { if (Session.IsActionLink(context, _moveID)) { string rowIndex = context.Request.QueryString["RowIndex"]; if (rowIndex != null) { if (_movingRow != null) { string posY = context.Request.QueryString["Y"]; if (posY != null) { DAE.Runtime.Data.IRow target = ParentGrid.DataLink.Buffer(Int32.Parse(rowIndex)); SequenceChange(_movingRow, target, Int32.Parse(posY) < 10); } } else { _movingRow = (DAE.Runtime.Data.Row)ParentGrid.DataLink.Buffer(Int32.Parse(rowIndex)).Copy(); return(true); } } CancelMove(); return(true); } else { return(false); } }
/// <summary> True if this node is the row(has the key). </summary> public bool IsRow(DAE.Runtime.Data.IRow key) { if (_key.DataType.Equals(key.DataType)) { string compareValue; string name; for (int index = 0; index < _key.DataType.Columns.Count; index++) { name = _key.DataType.Columns[index].Name; if (key.HasValue(name)) { compareValue = ((DAE.Runtime.Data.Scalar)key.GetValue(name)).AsString; } else { compareValue = String.Empty; } if (((DAE.Runtime.Data.Scalar)_key.GetValue(index)).AsString != compareValue) { return(false); } } return(true); } return(false); }
// Render public virtual void RenderCell(HtmlTextWriter writer, DAE.Runtime.Data.IRow currentRow, bool isActiveRow, int rowIndex) { if (GetVisible()) { InternalRenderCell(writer, currentRow, isActiveRow, rowIndex); } }
private void UpdateNode(LibraryNode node, DAE.Runtime.Data.IRow row) { node.Registered = (bool)row["Main.IsLoaded"]; node.CanLoad = true; //(bool)ARow["Main.CanLoad"]; node.IsSuspect = (bool)row["Main.IsSuspect"]; node.UpgradeRequired = (bool)row["Main.UpgradeRequired"]; }
private bool KeysEqual(DAE.Runtime.Data.IRow key1, DAE.Runtime.Data.IRow key2) { if (key2.DataType.Equals(key1.DataType)) { string compareValue; string name2; for (int index = 0; index < key2.DataType.Columns.Count; index++) { name2 = key2.DataType.Columns[index].Name; if (key1.HasValue(name2)) { compareValue = ((DAE.Runtime.Data.Scalar)key1.GetValue(name2)).AsString; } else { compareValue = String.Empty; } if (((DAE.Runtime.Data.Scalar)key2.GetValue(index)).AsString != compareValue) { return(false); } } return(true); } else { return(false); } }
public void InjectValue(DAE.Runtime.Data.IRow row, bool overwrite) { if (overwrite) { if (row.HasValue(ColumnName)) { SetHasValue(true); Text = ((DAE.Runtime.Data.Scalar)row.GetValue(ColumnName)).AsString; } else { SetHasValue(false); Text = String.Empty; } } else { if (row.HasValue(ColumnName) && (Text != String.Empty)) { // Show partial match // TODO: More intelligent mechanism for displaying partial matches string newValue = ((DAE.Runtime.Data.Scalar)row.GetValue(ColumnName)).AsString; if (newValue.ToLower().StartsWith(Text.ToLower())) { int previousTextLength = Text.Length; Text = newValue; Select(previousTextLength, newValue.Length - previousTextLength); } } } }
public TreeNode(Tree tree, string text, DAE.Runtime.Data.IRow key, int depth, TreeNode parent) { _iD = Session.GenerateID(); _buttonID = Session.GenerateID(); _tree = tree; _text = text; _key = key; _depth = depth; _parent = parent; }
protected override BaseNode CreateChildNode(DAE.Runtime.Data.IRow row) { LibraryNode node = new LibraryNode(this, (string)row["Main.Name"]); if (row.DataType.Columns.ContainsName("Main.IsLoaded")) { UpdateNode(node, row); } return(node); }
protected void SetParams(DAE.Runtime.Data.IRow key) { for (int index = 0; index < Source.DataView.Order.Columns.Count; index++) { if (key.HasValue(index)) { _params[index].Value = key[index]; } } }
public void BuildTree() { ClearNodes(); if (IsFieldActive() && (Source.DataView.State != DAE.Client.DataSetState.Insert)) { // Open a dynamic navigable browse cursor on the root expression PrepareRootPlan(); IServerCursor cursor = _rootPlan.Open(_rootParams); try { DAE.Runtime.Data.IRow key; int columnIndex; string text; while (cursor.Next()) { key = new DAE.Runtime.Data.Row(_process.ValueManager, new DAE.Schema.RowType(Source.DataView.Order.Columns)); try { using (DAE.Runtime.Data.IRow row = cursor.Select()) { row.CopyTo(key); columnIndex = row.DataType.Columns.IndexOf(ColumnName); if (row.HasValue(columnIndex)) { text = ((DAE.Runtime.Data.Scalar)row.GetValue(columnIndex)).AsDisplayString; } else { text = Strings.Get("NoValue"); } } Nodes.Add(new TreeNode(this, text, key, 0, null)); } catch { key.Dispose(); throw; } } } finally { _rootPlan.Close(cursor); } foreach (TreeNode node in Nodes) { node.BuildChildren(); } SelectNode(Source.DataView.GetKey()); } }
protected internal TreeNode FindChild(DAE.Runtime.Data.IRow childKey) { foreach (TreeNode node in Nodes) { if (node.IsRow(childKey)) { return(node); } } return(null); }
/// <summary> Returns a child node matching the key (non reflectively or recursively). </summary> public TreeNode FindChild(DAE.Runtime.Data.IRow key) { foreach (TreeNode node in Nodes) { if (node.IsRow(key)) { return(node); } } return(null); }
public void SetFormDesigner() { using (DAE.Runtime.Data.Scalar nodeTable = DataSession.Evaluate(FormDesignerNodeTypesExpression)) { NodeTypeTable.Clear(); NodeTypeTable.LoadFromString(nodeTable.AsString); } // Load the files required to register any nodes, if necessary if (DataSession.Server is DAE.Server.LocalServer) { IServerCursor cursor = DataSession.OpenCursor(GetFormDesignerLibraryFilesExpression); try { using (DAE.Runtime.Data.IRow row = cursor.Plan.RequestRow()) { bool shouldLoad; List <string> filesToLoad = new List <string>(); while (cursor.Next()) { cursor.Select(row); string fullFileName = ((DAE.Server.LocalServer)DataSession.Server).GetFile ( (DAE.Server.LocalProcess)cursor.Plan.Process, (string)row["Library_Name"], (string)row["Name"], (DateTime)row["TimeStamp"], (bool)row["IsDotNetAssembly"], out shouldLoad ); if (shouldLoad) { filesToLoad.Add(fullFileName); } } // Load each file to ensure they can be reached by the assembly resolver hack (see AssemblyUtility) foreach (string fullFileName in filesToLoad) { Assembly.LoadFrom(fullFileName); } } } finally { DataSession.CloseCursor(cursor); } } }
/// <summary> Finds the first node using the specified row. </summary> /// <returns> The matching node reference or null (if not found). </returns> public BaseNode FindByKey(DAE.Runtime.Data.IRow row) { ItemNode itemNode; foreach (TreeNode node in Nodes) { itemNode = node as ItemNode; if ((itemNode != null) && itemNode.IsEqual(row)) { return(itemNode); } } return(null); }
private IScalar LoadFromCache(string document, IServerProcess process) { byte[] data; using (Stream stream = Cache.Reference(document)) { int length = StreamUtility.ReadInteger(stream); data = new byte[length]; stream.Read(data, 0, length); } using (DAE.Runtime.Data.IRow row = ((DAE.Runtime.Data.IRow)DataValue.FromPhysical(process.GetServerProcess().ValueManager, GetCacheRowType(process), data, 0))) // Uses GetServerProcess() as an optimization because this row is to remain local { return((IScalar)row.GetValue("Value").Copy()); } }
protected override BaseNode CreateChildNode(DAE.Runtime.Data.IRow row) { string name = (string)row["Main.Name"]; string type = (string)row["Type_ID"]; switch (type) { case "d4": return(new D4DocumentNode(this, name, type)); case "dfd": case "dfdx": return(new FormDocumentNode(this, name, type)); default: return(new DocumentNode(this, name, type)); } }
/// <summary> Creates this nodes immediate children. Avoids duplication. </summary> public void BuildChildren() { // Open a dynamic navigable browse cursor on the child expression IServerCursor cursor = Tree.OpenChildCursor(_key); try { DAE.Runtime.Data.Row key; string text; int index = 0; int columnIndex; while (cursor.Next()) { key = new DAE.Runtime.Data.Row(Tree.Process.ValueManager, new RowType(Tree.Source.DataView.Order.Columns)); try { using (DAE.Runtime.Data.IRow row = cursor.Select()) { row.CopyTo(key); columnIndex = row.DataType.Columns.IndexOf(Tree.ColumnName); if (row.HasValue(columnIndex)) { text = ((DAE.Runtime.Data.Scalar)row.GetValue(columnIndex)).AsDisplayString; } else { text = Strings.Get("NoValue"); } } if (FindChild(key) == null) { Nodes.Insert(index, new TreeNode(Tree, text, key, _depth + 1, this)); } index++; } catch { key.Dispose(); throw; } } } finally { Tree.CloseChildCursor(cursor); } }
private void LoadImage(HttpContext context, string iD, Stream stream) { string rowIndex = context.Request.QueryString["RowIndex"]; if ((rowIndex != String.Empty) && (ColumnName != String.Empty)) { DAE.Runtime.Data.IRow row = ParentGrid.DataLink.Buffer(Int32.Parse(rowIndex)); if ((row != null) && row.HasValue(ColumnName)) { using (Stream source = row.GetValue(ColumnName).OpenStream()) { StreamUtility.CopyStream(source, stream); } } } }
protected internal TreeNode Search(DAE.Runtime.Data.IRow childKey) { TreeNode result = FindChild(childKey); if (result == null) { foreach (TreeNode node in Nodes) { result = node.Search(childKey); if (result != null) { break; } } } return(result); }
protected virtual string GetClass(DAE.Runtime.Data.IRow currentRow, bool isActiveRow) { string classValue; if (isActiveRow) { classValue = "gridcellcurrent"; } else { classValue = "gridcell"; } if ((ColumnName != String.Empty) && !currentRow.HasValue(ColumnName)) { classValue = classValue + "null"; } return(classValue); }
protected void BuildParentPath(DAE.Runtime.Data.IRow key, ArrayList path) { foreach (DAE.Runtime.Data.Row localKey in path) { if (KeysEqual(key, localKey)) { throw new WebClientException(WebClientException.Codes.TreeViewInfiniteLoop); } } path.Add(key); IServerCursor cursor = OpenParentCursor(key); try { if (cursor.Next()) { key = new DAE.Runtime.Data.Row(_process.ValueManager, new RowType(Source.DataView.Order.Columns)); using (DAE.Runtime.Data.IRow selected = cursor.Select()) selected.CopyTo(key); } else { key = null; } } finally { CloseParentCursor(cursor); } if (key != null) { if (FindChild(key) == null) { BuildParentPath(key, path); } else { path.Add(key); } } }
public bool ExtractValue(DAE.Runtime.Data.IRow row) { try { if (HasValue) { ((DAE.Runtime.Data.Scalar)row.GetValue(_columnName)).AsString = Text; } else { row.ClearValue(_columnName); } return(true); } catch { ConversionFailed = true; return(false); } }
public bool ExtractValue(DAE.Runtime.Data.IRow row) { try { if (HasValue) { ((DAE.Runtime.Data.Scalar)row.GetValue(_columnName)).AsBoolean = (base.CheckState == CheckState.Checked); } else { row.ClearValue(_columnName); } return(true); } catch { ConversionFailed = true; return(false); } }
public void InjectValue(DAE.Runtime.Data.IRow row, bool overwrite) { if (overwrite) { if (row.HasValue(ColumnName)) { if (((DAE.Runtime.Data.Scalar)row.GetValue(ColumnName)).AsBoolean) { base.CheckState = CheckState.Checked; } else { base.CheckState = CheckState.Unchecked; } } else { base.CheckState = CheckState.Indeterminate; } } }
/// <summary> Returns this node or any child node matching the key (recursively). </summary> public TreeNode Search(DAE.Runtime.Data.IRow key) { if (IsRow(key)) { return(this); } TreeNode result = FindChild(key); if (result != null) { return(result); } foreach (TreeNode node in Nodes) { result = node.Search(key); if (result != null) { return(result); } } return(null); }
private static void ReadRow(DAE.Runtime.Data.IRow row, ResultColumn[] LTarget) { for (int columnIndex = 0; columnIndex < row.DataType.Columns.Count; columnIndex++) { if (!row.HasValue(columnIndex)) { LTarget[columnIndex].Add(Strings.Get("NoValue")); } else { string value; try { value = row.GetValue(columnIndex).ToString(); } catch (Exception exception) { value = "<error retrieving value: " + exception.Message.Replace("\r\n", "↵") + ">"; } LTarget[columnIndex].Add(value); } } }
/// <summary> Sets the selected node of the tree. Builds children as needed.</summary> protected internal void SelectNode(DAE.Runtime.Data.IRow key) { TreeNode node = Search(key); if (node == null) { ArrayList path = new ArrayList(); BuildParentPath((DAE.Runtime.Data.Row)key.Copy(), path); try { for (int index = path.Count - 1; index >= 0; index--) { if (index == path.Count - 1) { node = FindChild((DAE.Runtime.Data.Row)path[index]); if ((node == null) && !_selecting) { BuildTree(); _selecting = true; try { SelectNode(key); } finally { _selecting = false; } return; } } else { node = node.FindChild((DAE.Runtime.Data.Row)path[index]); } if (node == null) { throw new WebClientException(WebClientException.Codes.TreeViewUnconnected); } if (index != 0) { node.BuildChildren(); } } } finally { for (int index = 0; index < path.Count; index++) { ((DAE.Runtime.Data.Row)path[index]).Dispose(); } } } // make sure the node is visible if ((node.Parent != null) && (!node.Parent.IsExpanded)) { node.Parent.Expand(); } _selectedNode = node; }
protected internal IServerCursor OpenParentCursor(DAE.Runtime.Data.IRow key) { PrepareParentPlan(); SetParams(key); return(_parentPlan.Open(_params)); }
protected override BaseNode CreateChildNode(DAE.Runtime.Data.IRow row) { return(new ScalarTypeNode(this, (string)row["Name"])); }
protected override BaseNode CreateChildNode(DAE.Runtime.Data.IRow row) { return new TableNode(this, (string)row["Name"]); }