public RowCollectionFilterDialog(RowCollection rowCollection)
        {
            InitializeComponent();

            this.rowCollection = rowCollection;
            filtersItems = new ArrayList();
        }
        public RowCollectionFilterItem(RowCollection rowCollection)
        {
            InitializeComponent();

            this.rowCollection = rowCollection;

            FillColumnList();
            cbColumn.SelectedIndex = 0;
            cbAction.SelectedIndex = 0;
            cbLogicalGroup.SelectedIndex = 0;
            cbLogicalOperator.SelectedIndex = 0;
        }
 public FormRowCollectionViewer(RowCollection rowCollection)
 {
     InitializeComponent();
     this.rowCollection = rowCollection;
     try
     {
         this.Text = string.Format("Data view - [{0}]", rowCollection.Name);
         CreateColumnsAndControls();
         ShowData();
     }
     catch (Exception ex)
     {
         ModuleLog.Write(ex, this, "RowCollectionViewer", ModuleLog.LogType.ERROR);
     }
 }
 /// <summary>
 /// Create new instance of row collection row
 /// </summary>
 /// <param name="parent">Parent row collection</param>
 /// <param name="columns">Column values for this row</param>
 public RowCollectionRow(RowCollection parent, string[] columns)
 {
     this.rowCollection = parent;
     try
     {
         columnsList = new ArrayList();
         foreach (string column in columns)
         {
             AddColl(new RowCollectionColumn(column));
         }
     }
     catch (Exception ex)
     {
         ModuleLog.Write(ex, typeof(RowCollectionRow), "ObjectRow", ModuleLog.LogType.ERROR);
     }
 }
        private void ProcessXML(XmlNodeList xmlNodeList, UberTools.Modules.GenericTemplate.RowCollectionNS.RowCollection parentRowCollection)
        {
            RowCollection    rowCollection = null;
            RowCollectionRow objectRow;
            string           rowCollectionName = null;

            foreach (XmlNode node in xmlNodeList)
            {
                if (node.NodeType == XmlNodeType.Element)
                {
                    rowCollectionName = FindXPath(node);
                    rowCollection     = rowCollectionMenager[rowCollectionName];
                    if (rowCollection == null)
                    {
                        rowCollection = rowCollectionMenager.CreateRowCollection(node.Attributes.Count, rowCollectionName);
                    }

                    // check if parent row collection is not null, only first call is null
                    if (parentRowCollection != null)
                    {
                        // add this row collection to parent chilld list
                        parentRowCollection.AddChild(rowCollection);
                    }

                    // make new instance of ObjectRow object
                    objectRow = new RowCollectionRow(rowCollection, GetAllAttribites(node));
                    // if node have inner text
                    if (node.InnerText != "")
                    {
                        // add extra columnt to objectRow object
                        objectRow.AddColl(new RowCollectionColumn(node.InnerText));
                    }
                    // add new row to row collection
                    rowCollection.Rows.Add(objectRow);

                    //ModuleLog.Write(GetAllAttribites(node), this, "ProcessXML", ModuleLog.LogType.INFO);

                    // recurse chilld
                    ProcessXML(node.ChildNodes, rowCollection);
                }
            }
        }
        public void Save(RowCollection rowCollection)
        {
            XmlDocument xmlDocument = new XmlDocument();
            XmlDeclaration xmlDeclaration;
            XmlElement rootNode;
            XmlElement nameElement;
            XmlElement columnsNamesNode;
            XmlElement rowsNode;
            XmlElement rowNode;

            XmlElement columnNameElement;
            XmlElement columnValueElement;

            try
            {
                ModuleLog.Write(new string[] { "Saving data object...", this.path, rowCollection.LabelName }, this, "Save", ModuleLog.LogType.DEBUG);

                xmlDeclaration = xmlDocument.CreateXmlDeclaration("1.0", "UTF-8", "yes");
                xmlDocument.InsertBefore(xmlDeclaration, xmlDocument.DocumentElement);

                // create root element and add it to xml document
                rootNode = xmlDocument.CreateElement("DataObject");
                xmlDocument.AppendChild(rootNode);

                // create Name element
                nameElement = xmlDocument.CreateElement("Name");
                nameElement.InnerText = rowCollection.LabelName;
                rootNode.AppendChild(nameElement);

                // create column names node and add all names
                columnsNamesNode = xmlDocument.CreateElement("Columns");
                columnsNamesNode.SetAttribute("count", rowCollection.Columns.Count.ToString());
                for (int i = 0; i < rowCollection.Columns.Count; i++)
                {
                    columnNameElement = xmlDocument.CreateElement("Column");
                    columnNameElement.InnerText = rowCollection.Columns[i];
                    columnsNamesNode.AppendChild(columnNameElement);
                }
                rootNode.AppendChild(columnsNamesNode);

                // add rows
                rowsNode = xmlDocument.CreateElement("Rows");
                rowsNode.SetAttribute("count", rowCollection.Rows.Count.ToString());
                foreach (RowCollectionRow row in rowCollection.Rows)
                {
                    rowNode = xmlDocument.CreateElement("Row");
                    // add columns value to row

                    for (int i = 0; i < rowCollection.Columns.Count; i++)
                    {
                        columnValueElement = xmlDocument.CreateElement("Column");
                        columnValueElement.InnerText = row[i].Value;
                        rowNode.AppendChild(columnValueElement);
                    }
                    rowsNode.AppendChild(rowNode);
                }
                rootNode.AppendChild(rowsNode);

                xmlDocument.Save(this.path);

            }
            catch (Exception ex)
            {
                ModuleLog.Write(ex, this, "Save", ModuleLog.LogType.ERROR);
            }
        }
            /// <summary>
            /// Peek next row object, if instance have child then will retrun row object from last child
            /// </summary>
            /// <returns></returns>
            public RowCollectionRow PeekNext()
            {
                RowCollectionRow row = null;
                RowCollection rowCollection = null;

                //#1 child logic code
                if (this.rowCollection.HasChildrenControls == true)
                {
                    // reset curent row index for this instance
                    //if (this.curentRowIndex == -1)
                    //{
                    //this.curentRowIndex = this.startAt;
                    //}

                    // Fetch curent child instance
                    rowCollection = (RowCollection)this.rowCollection.FetchCurentChild();
                    // if child is not null then peek next row object
                    if (rowCollection != null)
                    {
                        row = this.PeekNext();
                        if (row == null)
                        {
                            if (this.rowCollection.curentRowIndex + 1 <= this.rowCollection.endAt)
                            {
                                this.rowCollection.curentRowIndex++;
                                this.rowCollection.ResetAllChildCurentRowIndex(-1);
                                rowCollection.curentRowIndex = -1;
                                row = this.PeekNext();
                            }
                            else
                            {
                                //
                                if (this.rowCollection.FetchNextChild() != null)
                                {
                                    this.rowCollection.curentRowIndex = -1; // 0;
                                    row = this.PeekNext();
                                }
                                else
                                {
                                    this.rowCollection.ResetNextChildStatus();
                                    //this.curentRowIndex = -1;
                                    //row = this.PeekNext();
                                }
                            }
                        }
                    }
                }
                //#1
                else
                {
                    int peekCurentRowIndex = this.rowCollection.curentRowIndex;
                    //#2 test
                    if (peekCurentRowIndex == -1)
                    {
                        peekCurentRowIndex = this.rowCollection.startAt;
                    }
                    else
                    {
                        peekCurentRowIndex = peekCurentRowIndex + this.rowCollection.increment;
                    }
                    //#2

                    if ((peekCurentRowIndex >= this.rowCollection.startAt && this.rowCollection.startAt <= this.rowCollection.endAt) || (peekCurentRowIndex <= this.rowCollection.startAt && this.rowCollection.startAt > this.rowCollection.endAt))
                    {
                        if ((peekCurentRowIndex <= this.rowCollection.endAt && this.rowCollection.startAt <= this.rowCollection.endAt) || (peekCurentRowIndex >= this.rowCollection.endAt && this.rowCollection.startAt > this.rowCollection.endAt))
                        {
                            row = this[peekCurentRowIndex];
                        }
                    }
                }
                return row;
            }
            public RowCollectionRow FetchNext()
            {
                RowCollectionRow row = null;
                RowCollection rowCollection = null;

                this.rowCollectionMenager.ActiveObjectInstance[this.rowCollection.DepthIndex] = this.ToString();

                //#1 child logic code
                if (this.rowCollection.HasChildrenControls == true)
                {
                    // reset curent row index for this instance
                    if (this.rowCollection.curentRowIndex == -1)
                    {
                        this.rowCollection.curentRowIndex = this.rowCollection.startAt;
                    }

                    rowCollection = (RowCollection)this.rowCollection.FetchCurentChild();
                    //if (rowCollection == null)
                    //{
                    //    rowCollection = (RowCollection)this.FetchNextChild();
                    //}
                    row = this.FetchNext();
                }
                //#1
                else
                {
                    //#2 test
                    if (this.rowCollection.curentRowIndex == -1)
                    {
                        this.rowCollection.curentRowIndex = this.rowCollection.startAt;
                    }
                    else
                    {
                        this.rowCollection.curentRowIndex = this.rowCollection.curentRowIndex + this.rowCollection.increment;
                    }
                    //#2

                    if ((this.rowCollection.curentRowIndex >= this.rowCollection.startAt && this.rowCollection.startAt <= this.rowCollection.endAt) || (this.rowCollection.curentRowIndex <= this.rowCollection.startAt && this.rowCollection.startAt > this.rowCollection.endAt))
                    {
                        if ((this.rowCollection.curentRowIndex <= this.rowCollection.endAt && this.rowCollection.startAt <= this.rowCollection.endAt) || (this.rowCollection.curentRowIndex >= this.rowCollection.endAt && this.rowCollection.startAt > this.rowCollection.endAt))
                        {
                            row = this[this.rowCollection.curentRowIndex];
                        }
                    }
                    //this.curentRowIndex = this.curentRowIndex + this.increment;
                }
                return row;
            }
 public ObjectCollectionRows(RowCollectionMenager rowCollectionMenager, RowCollection rowCollection)
 {
     this.rowCollection = rowCollection;
     this.rowCollectionMenager = rowCollectionMenager;
 }
        public RowCollectionFilterItem()
        {
            InitializeComponent();

            this.rowCollection = null;
        }