Esempio n. 1
0
        private static SimpleTable BuildSimpleTable(object sourceObject)
        {
            SimpleTable newtable = null;

            if (sourceObject is DataTable)
            {
                newtable = BuildSimpleTable(sourceObject as DataTable);
            }
            else if (sourceObject is DataView)
            {
                newtable = BuildSimpleTable(sourceObject as DataView);
            }
            else if (sourceObject is IDataReader)
            {
                newtable = BuildSimpleTable(sourceObject as IDataReader);
            }
            else if (sourceObject is IEnumerable)
            {
                newtable = BuildSimpleTable(sourceObject as IEnumerable);
            }
            else
            {
                newtable = new SimpleTable();
            }
            return(newtable);
        }
Esempio n. 2
0
        public SimpleTable JoinTables(SimpleTableJoinType joinType, SimpleTable table1, SimpleTable table2, string filterExpression)
        {
            //TODO: finish join functionality later! definitely not a top priority
            SimpleTable newtable = new SimpleTable();

            return(newtable);
        }
Esempio n. 3
0
        internal SimpleRow(SimpleTable table)
        {
            this.table = table;
            this.items = new ArrayList(new object[table.Columns.Count]);

            this.table.columns.AlterColumn += new SimpleColumnEventHandler(columns_AlterColumn);
        }
Esempio n. 4
0
        private static SimpleTable BuildSimpleTable(DataTable table)
        {
            SimpleTable newtable = new SimpleTable();

            foreach (DataColumn column in table.Columns)
            {
                newtable.Columns.Add(column.ColumnName);
            }

            foreach (DataRow row in table.Rows)
            {
                object[]  items  = row.ItemArray;
                SimpleRow newrow = newtable.Rows.Add();

                for (int i = 0; i < items.Length; i++)
                {
                    object item = items[i];
                    if (item != DBNull.Value)
                    {
                        newrow[i] = item;
                    }
                }
            }

            return(newtable);
        }
Esempio n. 5
0
        private static SimpleTable BuildSimpleTable(IDataReader reader)
        {
            SimpleTable newtable = new SimpleTable();

            for (int i = 0; i < reader.FieldCount; i++)
            {
                newtable.Columns.Add(reader.GetName(i));
            }

            while (reader.Read())
            {
                SimpleRow newrow = newtable.Rows.Add();

                for (int i = 0; i < reader.FieldCount; i++)
                {
                    object item = reader[i];

                    if (item != DBNull.Value)
                    {
                        newrow[i] = item;
                    }
                }
            }

            return(newtable);
        }
Esempio n. 6
0
		/// <summary>
		/// Binds a DataSource to this GuiGrid. Binding supports SimpleTables, DataTables, DataViews, and other IEnumerable classes.
		/// </summary>
		/// <param name="dataSource">The data source object to bind.</param>
		public void BindData(object dataSource)
        {
#if !HTML_HELP
            if (dataSource is SimpleTable)
				this.DataSource = dataSource as SimpleTable;
			else
				this.DataSource = SimpleTableTools.ConvertToSimpleTable(dataSource);
#endif
		}
Esempio n. 7
0
        private static SimpleTable BuildSimpleTable(IEnumerable collection)
        {
            SimpleTable newtable = new SimpleTable();

            PropertyInfo[] props;
            object         obj    = null;
            SimpleRow      newrow = null;

            int idx = 0;

            foreach (object item in collection)
            {
                props  = item.GetType().GetProperties();
                newrow = newtable.Rows.Add();

                foreach (PropertyInfo prop in props)
                {
                    if (idx == 0)
                    {
                        if (prop.CanRead &&
                            ((prop.PropertyType == typeof(String)) ||
                             (prop.PropertyType == typeof(Char)) ||
                             (prop.PropertyType == typeof(Byte)) ||
                             (prop.PropertyType == typeof(Int64)) ||
                             (prop.PropertyType == typeof(Int32)) ||
                             (prop.PropertyType == typeof(Int16)) ||
                             (prop.PropertyType == typeof(UInt64)) ||
                             (prop.PropertyType == typeof(UInt32)) ||
                             (prop.PropertyType == typeof(UInt16)) ||
                             (prop.PropertyType == typeof(Boolean)) ||
                             (prop.PropertyType == typeof(Decimal)) ||
                             (prop.PropertyType == typeof(Double)) ||
                             (prop.PropertyType == typeof(DateTime)) ||
                             (prop.PropertyType == typeof(TimeSpan)))
                            )
                        {
                            newtable.Columns.Add(prop.Name);
                        }
                    }

                    if (newtable.Columns.IndexOf(prop.Name) != -1)
                    {
                        obj = prop.GetGetMethod().Invoke(item, null);
                        newrow[prop.Name] = obj;
                    }
                }

                idx++;
            }

            return(newtable);
        }
		private static SimpleTable BuildSimpleTable(IEnumerable collection)
		{
			SimpleTable newtable = new SimpleTable();
			PropertyInfo[] props;
			object obj = null;
			SimpleRow newrow = null;
			
			int idx = 0;
			foreach (object item in collection) 
			{
				props = item.GetType().GetProperties();
				newrow = newtable.Rows.Add();

				foreach (PropertyInfo prop in props) 
				{
					if (idx == 0) 
					{
						if (prop.CanRead &&
							((prop.PropertyType == typeof(String)) ||
							(prop.PropertyType == typeof(Char)) ||
							(prop.PropertyType == typeof(Byte)) ||
							(prop.PropertyType == typeof(Int64)) ||
							(prop.PropertyType == typeof(Int32)) ||
							(prop.PropertyType == typeof(Int16)) ||
							(prop.PropertyType == typeof(UInt64)) ||
							(prop.PropertyType == typeof(UInt32)) ||
							(prop.PropertyType == typeof(UInt16)) ||
							(prop.PropertyType == typeof(Boolean)) ||
							(prop.PropertyType == typeof(Decimal)) ||
							(prop.PropertyType == typeof(Double)) ||
							(prop.PropertyType == typeof(DateTime)) ||
							(prop.PropertyType == typeof(TimeSpan)))
							) 
						{
							newtable.Columns.Add(prop.Name);
						}
					}
					
					if (newtable.Columns.IndexOf(prop.Name) != -1) 
					{
						obj = prop.GetGetMethod().Invoke(item, null);
						newrow[prop.Name] = obj;
					}
				}

				idx++;
			}

			return newtable;
		}
Esempio n. 9
0
        public static DataTable ConvertToDataTable(SimpleTable table)
        {
            DataTable newtable = new DataTable();

            foreach (SimpleColumn column in table.Columns)
            {
                newtable.Columns.Add(column.Name);
            }

            foreach (SimpleRow row in table.Rows)
            {
                DataRow newrow = newtable.NewRow();

                foreach (SimpleColumn column in table.Columns)
                {
                    newrow[column.Name] = row[column.Name];
                }

                newtable.Rows.Add(newrow);
            }

            return(newtable);
        }
		public object Reconstitute(string source)
		{
			SimpleTable st = new SimpleTable();
			
			string[] rows = source.Split(';');
			string[] items, typeset;
			string s_val;
			object val;
			Type type;
			SimpleRow sr = null;
			int colIndex = 0, rowIndex = 0;

			//------------------------
			// 'B' = Base64
			// 'H' = Human Readable
			//------------------------
			string mode = "B";

			foreach (string row in rows) 
			{
				if (row.Trim() != string.Empty) 
				{
					items = row.Split(',');
				
					if (rowIndex > 0) 
					{
						sr = st.Rows.Add();
					}

					colIndex = 0;
					foreach (string item in items)
					{
						val = null;

						s_val = item;

						typeset = s_val.Split('|');
						if (rowIndex == 0) 
						{
							st.Columns.Add( ReadableDeserialize( typeset[1] ) );
						}
						else 
						{
							mode = "B";
							if (typeset.Length == 3) 
							{
								mode = typeset[1];
							}

							if (typeset.Length >= 2) 
							{
								type = Type.GetType(typeset[0]);
								if (mode == "B") 
								{
									val = MasterSerializer.Reconstitute( type, ConvertBytesToUTF8( typeset[typeset.Length - 1] ) );
								}
								else 
								{
									val = MasterSerializer.Reconstitute( type, ReadableDeserialize( typeset[typeset.Length - 1] ) );
								}
							}

							sr[colIndex] = val;
						}
						colIndex++;
					}

					rowIndex++;
				}
			}

			return st;
		}
namespace Zeus.Data
		private static SimpleTable BuildSimpleTable(object sourceObject)
		{
			SimpleTable newtable = null;

			if (sourceObject is DataTable) 
			{
				newtable = BuildSimpleTable(sourceObject as DataTable);
			}
			else if (sourceObject is DataView) 
			{
				newtable = BuildSimpleTable(sourceObject as DataView);
			}
			else if (sourceObject is IDataReader) 
			{
				newtable = BuildSimpleTable(sourceObject as IDataReader);
			}
			else if (sourceObject is IEnumerable) 
			{
				newtable = BuildSimpleTable(sourceObject as IEnumerable);
			}
			else 
			{
				newtable = new SimpleTable();
			}
			return newtable;
		}
		public static DataTable ConvertToDataTable(SimpleTable table)
		{
			DataTable newtable = new DataTable();

			foreach (SimpleColumn column in table.Columns) 
			{
				newtable.Columns.Add(column.Name);
			}

			foreach (SimpleRow row in table.Rows) 
			{
				DataRow newrow = newtable.NewRow();

				foreach (SimpleColumn column in table.Columns) 
				{
					newrow[column.Name] = row[column.Name];
				}

				newtable.Rows.Add(newrow);
			}

			return newtable;
		}
Esempio n. 14
0
 public void SortTable(SimpleTable table, string sortExpression)
 {
     //TODO: finish sort functionality later! definitely not a top priority
 }
Esempio n. 15
0
 public void FilterTable(SimpleTable table, string filterExpression)
 {
     //TODO: finish filter functionality later! definitely not a top priority
 }
		public void FilterTable(SimpleTable table, string filterExpression) 
		{
			//TODO: finish filter functionality later! definitely not a top priority
		}
		private static SimpleTable BuildSimpleTable(IDataReader reader)
		{
			SimpleTable newtable = new SimpleTable();

			for (int i = 0; i < reader.FieldCount; i++) 
			{
				newtable.Columns.Add(reader.GetName(i));
			}

			while (reader.Read()) 
			{
				SimpleRow newrow = newtable.Rows.Add();

				for (int i = 0; i < reader.FieldCount; i++) 
				{
					object item = reader[i];
					
					if (item != DBNull.Value)
					{
						newrow[i] = item;
					}
				}
			}

			return newtable;
		}
		public void SortTable(SimpleTable table, string sortExpression) 
		{
			//TODO: finish sort functionality later! definitely not a top priority
		}
using System.Collections;
Esempio n. 20
0
 internal SimpleColumnCollection(SimpleTable table)
 {
     this.table = table;
 }
		private static SimpleTable BuildSimpleTable(DataTable table)
		{
			SimpleTable newtable = new SimpleTable();

			foreach (DataColumn column in table.Columns) 
			{
				newtable.Columns.Add(column.ColumnName);
			}

			foreach (DataRow row in table.Rows) 
			{
				object[] items = row.ItemArray;
				SimpleRow newrow = newtable.Rows.Add();

				for (int i = 0; i < items.Length; i++) 
				{
					object item = items[i];
					if (item != DBNull.Value)
					{
						newrow[i] = item;
					}
				}
			}

			return newtable;
		}
		public SimpleTable JoinTables(SimpleTableJoinType joinType, SimpleTable table1, SimpleTable table2, string filterExpression) 
		{
			//TODO: finish join functionality later! definitely not a top priority
			SimpleTable newtable = new SimpleTable();
			return newtable;
		}
Esempio n. 23
0
 internal SimpleRowCollection(SimpleTable table)
 {
     this.table = table;
 }
Esempio n. 24
0
using System;