예제 #1
0
 /// <summary>
 /// Constructor that intitializes the table
 /// </summary>
 /// <param name="name">The name of the table</param>
 /// <param name="sqlColumns">The columns of the table</param>
 public Table(string name, params SqlColumn[] sqlColumns)
 {
     Name       = name;
     SqlColumns = sqlColumns.ToList();
     //SqlColumnIndicesByName = SqlColumns.Select((col, ind) => new { Column = col, Index = ind }).ToDictionary(col => col.Column.Name, col => col.Index);
     Tree         = new BinaryTree <SqlRow>();
     ReturnString = null;
 }
예제 #2
0
        /// <summary>
        /// Constructor that initializes the table from an XML element
        /// </summary>
        /// <param name="tableElement">The element to fill the table from</param>
        public Table(XElement tableElement)
        {
            currentId = int.Parse(tableElement.Attribute("currentID").Value);
            List <SqlColumn> collumns = new List <SqlColumn>();

            //loops though the elements in columns to get the columns of the tree
            foreach (XElement columElement in tableElement.Element("Columns").Elements())
            {
                collumns.Add(new SqlColumn(columElement.FirstAttribute.Name.ToString(), Type.GetType(columElement.FirstAttribute.Value), this));
            }
            //Sets and initializes the feilds in the tree
            Name       = tableElement.Attribute("name").Value;
            SqlColumns = collumns;
            //SqlColumnIndicesByName = SqlColumns.Select((col, ind) => new { Column = col, Index = ind }).ToDictionary(col => col.Column.Name, col => col.Index);
            Tree = new BinaryTree <SqlRow>();

            //Fills the binary tree
            if (tableElement.Element("BinaryTree").HasElements)
            {
                Tree.BaseNode = FillBinaryTreeFromXML(null, tableElement.Element("BinaryTree").Element("Node"));
            }
            ReturnString = new RenderString(new List <RenderCharacter>());
        }