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);
             }
         }
     }
 }
Example #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);
 }
Example #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);
            }
        }
Example #4
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());
            }
        }
Example #5
0
 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());
     }
 }
Example #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);
            }
        }
Example #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);
                    }
                }
            }
        }
 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;
         }
     }
 }
        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);
                }
            }
        }