Пример #1
0
        public Line addLine()
        {
            XElement xLine = new TableDetails().addLine(xDocument);
            var      line  = new Line(Columns.ToArray(), xLine);

            Lines.Add(line);

            return(line);
        }
Пример #2
0
        private void InitializeLines()
        {
            TableDetails tableDetails = new TableDetails();

            IEnumerable <XElement> XLine = tableDetails.getXmlLines(xDocument);

            if (XLine == null)
            {
                return;
            }

            foreach (XElement line in XLine)
            {
                Lines.Add(new Line(Columns.ToArray(), line.Elements().ToArray(), line));
            }
        }
Пример #3
0
        private void InitializeColumns()
        {
            TableDetails tableDetails = new TableDetails();

            IEnumerable <XElement> xCol = tableDetails.getXmlColumns(xDocument);

            if (xCol == null)
            {
                return;
            }

            foreach (XElement el in xCol)
            {
                Columns.Add(xDocToColumn.tryParse(el, this));
            }
        }
Пример #4
0
        public Line addLine(params object[] data)
        {
            if (data.Count() != Columns.Count())
            {
                return(null);
            }

            XElement xLine   = new TableDetails().addLine(xDocument);
            Line     newLine = new Line(Columns.ToArray(), xLine);

            Lines.Add(newLine);

            int i = 0;

            foreach (object value in data)
            {
                newLine.Rows[i].set(value);
                i++;
            }

            return(newLine);
        }
Пример #5
0
        public bool addColumn(string columnName, DataType dataType, params DataOptions[] dataOptions)
        {
            XElement element = new TableDetails().AddEntity(this.xDocument, columnName, dataType, dataOptions);
            Column   col;

            if (element == null)
            {
                Column column = Columns.First(c => c.columnName == columnName);
                column.EditDataType(dataType);

                if (dataOptions.Contains(DataOptions.FOREIGN_KEY) == false)
                {
                    if (column.dataOptions.Contains(DataOptions.FOREIGN_KEY))
                    {
                        column.RemoveReference();
                    }
                }

                col = column;
            }
            else
            {
                col = new Column(columnName, dataType, dataOptions, element, this);
            }


            Columns.Add(col);

            if (Columns.Count() - 1 >= 0)
            {
                foreach (Line lin in Lines)
                {
                    lin.addEmpty(col);
                }
            }

            return(true);
        }