Beispiel #1
0
        private void initialiseGrid()
        {
            //Add a default set if there are no user defined columns
            Hashtable atts = new Hashtable();

            atts[1.0] = "Name";
            atts[2.0] = "Type";
            atts[3.0] = "Owner";

            //Add a default set if there are no user defined columns
            Hashtable titles = new Hashtable();

            titles[1.0] = "Name of Item";
            titles[2.0] = "Type of Item";
            titles[3.0] = "Owner of Item";

            //Get Design World
            DbElement worldElement = MDB.CurrentMDB.GetFirstWorld(Aveva.Pdms.Database.DbType.Design);

            //Find all Equipment elements
            TypeFilter          filter = new TypeFilter(DbElementTypeInstance.EQUIPMENT);
            DBElementCollection coll   = new DBElementCollection(worldElement, filter);

            //Collect the items
            Hashtable items = new Hashtable();
            int       i     = 1;

            foreach (DbElement ele in coll)
            {
                items.Add((double)i, ele);
                i++;
            }

            //Set Grid Name
            string tableName = "Example Grid";

            //Create a data source and bind it to the Grid Control
            NetDataSource dataSource;

            dataSource = new NetDataSource(tableName, atts, titles, items);
            this.netGridControl1.BindToDataSource(dataSource);

            //Display the default PDMS graphical icons in the grid with the equipment item names
            this.netGridControl1.setNameColumnImage();
        }
        private void initialiseGrid()
        {
            //Add a default set if there are no user defined columns
            Hashtable atts = new Hashtable();
            atts[1.0] = "Name";
            atts[2.0] = "Type";
            atts[3.0] = "Owner";

            //Add a default set if there are no user defined columns
            Hashtable titles = new Hashtable();
            titles[1.0] = "Name of Item";
            titles[2.0] = "Type of Item";
            titles[3.0] = "Owner of Item";

            //Get Design World
            DbElement worldElement = MDB.CurrentMDB.GetFirstWorld(Aveva.Pdms.Database.DbType.Design);

            //Find all Equipment elements
            TypeFilter filter = new TypeFilter(DbElementTypeInstance.EQUIPMENT);
            DBElementCollection coll = new DBElementCollection(worldElement, filter);

            //Collect the items
            Hashtable items = new Hashtable();
            int i = 1;
            foreach (DbElement ele in coll)
            {
                items.Add((double)i, ele);
                i++;
            }

            //Set Grid Name
            string tableName = "Example Grid";

            //Create a data source and bind it to the Grid Control
            NetDataSource dataSource;
            dataSource = new NetDataSource(tableName, atts, titles, items);
            this.netGridControl1.BindToDataSource(dataSource);

            //Display the default PDMS graphical icons in the grid with the equipment item names
            this.netGridControl1.setNameColumnImage();
        }