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);
             }
         }
     }
 }
Esempio n. 2
0
 /// <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);
 }
Esempio n. 3
0
        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);
            }
        }
Esempio n. 4
0
 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];
         }
     }
 }
Esempio n. 5
0
        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());
            }
        }
Esempio n. 6
0
        /// <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);
            }
        }
Esempio n. 7
0
        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);
                    }
                }
            }
        }
Esempio n. 8
0
        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);
        }
 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;
         }
     }
 }
        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);
                }
            }
        }