Exemplo n.º 1
0
 public void RemoveData(string tableName)
 {
     if (_data != null && !string.IsNullOrEmpty(tableName))
     {
         int n = -1;
         for (int i = 0; i < _data.Length; i++)
         {
             if (string.Compare(_data[i].TableName, tableName, StringComparison.OrdinalIgnoreCase) == 0)
             {
                 n = i;
                 break;
             }
         }
         if (n >= 0)
         {
             WebDataTable[] a = new WebDataTable[_data.Length - 1];
             for (int i = 0; i < _data.Length; i++)
             {
                 if (i < n)
                 {
                     a[i] = _data[i];
                 }
                 else if (i > n)
                 {
                     a[i - 1] = _data[i];
                 }
             }
             _data = a;
         }
     }
 }
Exemplo n.º 2
0
 public TreeNodeTabledData(WebDataTable table)
     : base(table)
 {
     Text               = table.TableName;
     ImageIndex         = 10;
     SelectedImageIndex = ImageIndex;
 }
Exemplo n.º 3
0
        private void buttonTable_Click(object sender, EventArgs e)
        {
            string newName = DlgSelectName.GetNewName(this, "Name for the new tabled data", getAllDataNames(), true);

            if (!string.IsNullOrEmpty(newName))
            {
                WebDataTable tbl = new WebDataTable(_dataset);
                tbl.TableName = newName;
                TreeNodeTabledData tnt = new TreeNodeTabledData(tbl);
                treeViewDataSet.Nodes[0].Nodes.Add(tnt);
                _changed = true;
                treeViewDataSet.Nodes[0].Expand();
                treeViewDataSet.SelectedNode = tnt;
            }
        }
Exemplo n.º 4
0
        //
        #region ICloneable Members

        public virtual WebDataTable Clone(WebPageDataSet dataset)
        {
            WebDataTable tbl = (WebDataTable)Activator.CreateInstance(this.GetType(), dataset);

            tbl.TableName  = TableName;
            tbl.PrimaryKey = PrimaryKey;
            if (Columns != null)
            {
                tbl.Columns = new WebDataColumn[Columns.Length];
                for (int i = 0; i < Columns.Length; i++)
                {
                    tbl.Columns[i] = Columns[i].Clone();
                }
            }
            if (DataRelations != null)
            {
                tbl.DataRelations = new WebDataRelation[DataRelations.Length];
                for (int i = 0; i < DataRelations.Length; i++)
                {
                    tbl.DataRelations[i] = DataRelations[i].Clone();
                }
            }
            if (Rows != null)
            {
                tbl.Rows = new Dictionary <string, WebPageDataRow[]>();
                foreach (KeyValuePair <string, WebPageDataRow[]> kv in Rows)
                {
                    WebPageDataRow[] dr;
                    if (kv.Value == null)
                    {
                        dr = new WebPageDataRow[] { };
                    }
                    else
                    {
                        dr = new WebPageDataRow[kv.Value.Length];
                        for (int i = 0; i < kv.Value.Length; i++)
                        {
                            dr[i] = kv.Value[i].Clone();
                        }
                    }
                    tbl.Rows.Add(kv.Key, dr);
                }
            }
            return(tbl);
        }
Exemplo n.º 5
0
        public void ReadFromXmlNode(IXmlCodeReader reader, XmlNode node)
        {
            XmlNodeList ns = node.SelectNodes(XML_Item);

            _data = new WebDataTable[ns.Count];
            for (int i = 0; i < ns.Count; i++)
            {
                int dt = XmlUtil.GetAttributeInt(ns[i], XMLATT_dtype);
                if (dt == 1)
                {
                    _data[i] = new WebDataTableSingleRow(this);
                }
                else
                {
                    _data[i] = new WebDataTable(this);
                }
                _data[i].ReadFromXmlNode(reader, ns[i]);
            }
        }
Exemplo n.º 6
0
        private void showData()
        {
            CultureInfo     cultrue = null;
            WebDataTable    table   = null;
            TreeNodeCulture tnc     = treeViewLanguages.SelectedNode as TreeNodeCulture;

            if (tnc != null)
            {
                cultrue = tnc.Culture;
                TreeNodeData tnd = treeViewDataSet.SelectedNode as TreeNodeData;
                if (tnd != null)
                {
                    table = tnd.Table;
                }
            }
            _currentProperty         = null;
            dataGridView1.DataSource = null;
            dataGridView1.DataBindings.Clear();
            dataGridView1.Columns.Clear();
            if (cultrue != null && table != null)
            {
                showCulture(cultrue);
                table.CurrentCulture = cultrue.Name;
                WebDataTableSingleRow singleRow = table as WebDataTableSingleRow;
                if (singleRow != null)
                {
                    propertyGrid1.SelectedObject = singleRow;
                    propertyGrid1.Visible        = true;
                    //
                    dataGridView1.Visible = false;
                }
                else
                {
                    dataGridView1.Visible    = true;
                    propertyGrid1.Visible    = false;
                    dataGridView1.DataSource = table.CreateDataTable(cultrue.Name);
                }
            }
            else
            {
                propertyGrid1.SelectedObject = null;
            }
        }
Exemplo n.º 7
0
 public TreeNodeData(WebDataTable table)
 {
     _table = table;
 }