public override void update() { // add some objclass calls CswNbtMetaDataObjectClassProp locCodeOcp = _CswNbtSchemaModTrnsctn.createObjectClassProp( CswNbtMetaDataObjectClass.NbtObjectClass.LocationClass, "Location Code", CswNbtMetaDataFieldType.NbtFieldType.Text, IsUnique: true ); CswNbtMetaDataObjectClassProp allowInvOcp = _CswNbtSchemaModTrnsctn.createObjectClassProp( CswNbtMetaDataObjectClass.NbtObjectClass.LocationClass, "Allow Inventory", CswNbtMetaDataFieldType.NbtFieldType.Logical ); CswNbtMetaDataObjectClassProp storCompatOcp = _CswNbtSchemaModTrnsctn.createObjectClassProp( CswNbtMetaDataObjectClass.NbtObjectClass.LocationClass, "Storage Compatability", CswNbtMetaDataFieldType.NbtFieldType.ImageList ); CswDelimitedString listOpts = new CswDelimitedString( '\n' ); listOpts.FromArray( new string[] { "None", "Inorganic Acids", "Organic Acids", "Bases", "Oxidizing Inorganic Acids", "Oxidizers", "Toxics", "Flammables" } ); // storCompatOcp.ListOptions = listOpts.ToString(); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( storCompatOcp, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.listoptions, listOpts.ToString() ); CswDelimitedString valOpts = new CswDelimitedString( '\n' ); valOpts.FromArray( new string[] { "Images/cispro/0w.gif", "Images/cispro/1o.gif", "Images/cispro/2y.gif", "Images/cispro/3g.gif", "Images/cispro/4b.gif", "Images/cispro/5l.gif", "Images/cispro/6p.gif", "Images/cispro/7r.gif" } ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( storCompatOcp, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.valueoptions, valOpts.ToString() ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( storCompatOcp, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.textarearows, "32" ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( storCompatOcp, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.textareacols, "32" ); }//Update()
} //getDemoDataGrid() public static void getDemoDataNodesAsGrid(ICswResources CswResources, CswNbtDemoDataReturn Return, CswNbtDemoDataRequests.CswDemoNodesGridRequest Request) { CswNbtResources CswNbtResources = (CswNbtResources)CswResources; //Build table infrastructure DataTable GridTable = new DataTable("depdendentnodestable"); GridTable.Columns.Add(CswNbtDemoDataReturn.ColumnNames.NodeId, typeof(Int32)); GridTable.Columns.Add(CswNbtDemoDataReturn.ColumnNames.Name, typeof(string)); GridTable.Columns.Add(CswNbtDemoDataReturn.ColumnNames.Type, typeof(string)); GridTable.Columns.Add(CswNbtDemoDataReturn.ColumnNames.IsDemo, typeof(string)); // GridTable.Columns.Add( CswNbtDemoDataReturn.ColumnNames.Action, typeof( sbyte ) ); GridTable.Columns.Add(CswNbtDemoDataReturn.ColumnNames.MenuOptions, typeof(string)); string DependentNodesQuery = "select n.nodeid, t.nodetypeid, n.nodename as \"name\" ,n.isdemo \"Is Demo\", t.nodetypename as \"type\" "; DependentNodesQuery += "from nodes n "; DependentNodesQuery += "join nodetypes t on (n.nodetypeid=t.nodetypeid) "; //We have to cope with oracle's limit of 1000 on lists //as per case 29811 DependentNodesQuery += " where "; List <string> AllNodeIds = Request.NodeIds; int NumberoFInClauses = (AllNodeIds.Count / 1000) + 1; //we _only_ want the whole-number result here for (int idx = 0; idx < NumberoFInClauses; idx++) { if (idx > 0) { DependentNodesQuery += " or "; } List <string> CurrentList = null; if (AllNodeIds.Count > 1000) { CurrentList = AllNodeIds.GetRange(0, 1000); AllNodeIds.RemoveRange(0, 1000); } else { CurrentList = AllNodeIds; } CswDelimitedString DepdendentNodeIds = new CswDelimitedString(','); DepdendentNodeIds.FromArray(CurrentList.ToArray()); DependentNodesQuery += " n.nodeid in (" + DepdendentNodeIds.ToString() + ") "; } DependentNodesQuery += "order by lower(n.nodename), lower(t.nodetypename)"; CswArbitrarySelect DependentNodesSelect = CswNbtResources.makeCswArbitrarySelect("select_depdendent_nodes", DependentNodesQuery); DataTable DepdendentNodesTableTable = DependentNodesSelect.getTable(); foreach (DataRow CurrentDependentNodeRow in DepdendentNodesTableTable.Rows) { DataRow NewGridRowOfDependentNodes = GridTable.NewRow(); GridTable.Rows.Add(NewGridRowOfDependentNodes); NewGridRowOfDependentNodes[CswNbtDemoDataReturn.ColumnNames.NodeId] = CurrentDependentNodeRow[CswNbtDemoDataReturn.ColumnNames.NodeId]; NewGridRowOfDependentNodes[CswNbtDemoDataReturn.ColumnNames.Name] = CurrentDependentNodeRow[CswNbtDemoDataReturn.ColumnNames.Name]; NewGridRowOfDependentNodes[CswNbtDemoDataReturn.ColumnNames.Type] = CurrentDependentNodeRow[CswNbtDemoDataReturn.ColumnNames.Type]; NewGridRowOfDependentNodes[CswNbtDemoDataReturn.ColumnNames.IsDemo] = ("1" == CurrentDependentNodeRow[CswNbtDemoDataReturn.ColumnNames.IsDemo].ToString()) ? "yes" : "no"; CswPrimaryKey cswPrimaryKey = new CswPrimaryKey(); cswPrimaryKey.FromString("nodes_" + CurrentDependentNodeRow[CswNbtDemoDataReturn.ColumnNames.NodeId].ToString()); CswNbtNodeKey CswNbtNodeKey = new CswNbtNodeKey(); CswNbtNodeKey.NodeId = cswPrimaryKey; CswNbtNodeKey.NodeTypeId = CswConvert.ToInt32(CurrentDependentNodeRow["nodetypeid"]); string menu_options = "{ "; menu_options += "\"nodeid\" : \"nodes_" + CurrentDependentNodeRow[CswNbtDemoDataReturn.ColumnNames.NodeId].ToString() + "\","; menu_options += "\"nodename\" : \" " + CurrentDependentNodeRow[CswNbtDemoDataReturn.ColumnNames.Name].ToString() + "\","; menu_options += "\"nodekey\" : \" " + CswNbtNodeKey.ToString() + "\""; menu_options += " }"; NewGridRowOfDependentNodes[CswNbtDemoDataReturn.ColumnNames.MenuOptions] = menu_options; }//iterate result rows CswNbtGrid Grid = new CswNbtGrid(CswNbtResources); Return.Data.Grid = Grid.DataTableToGrid(GridTable, IncludeEditFields: false); }//getDemoDataNodesAsGrid()