/// <summary> /// Retrieve a session data item /// </summary> public CswNbtSessionDataItem getSessionDataItem( CswNbtSessionDataId SessionDataId ) { CswTableSelect SessionDataSelect = _CswNbtResources.makeCswTableSelect( "getSessionDataItem_select", "session_data" ); DataTable SessionDataTable = SessionDataSelect.getTable( "sessiondataid", SessionDataId.get() ); CswNbtSessionDataItem ret = null; if( SessionDataTable.Rows.Count > 0 ) { ret = new CswNbtSessionDataItem( _CswNbtResources, SessionDataTable.Rows[0] ); } return ret; }
}//ctor /// <summary> /// Constructor: from String /// </summary> public CswNbtTreeKey(string KeyString) { if (CswNbtViewId.isViewIdString(KeyString)) { _KeyString = new CswNbtViewId(KeyString).ToString(); } else if (CswNbtSessionDataId.isSessionDataIdString(KeyString)) { _KeyString = new CswNbtSessionDataId(KeyString).ToString(); } }//ctor
} // removeSessionData(CswNbtView) /// <summary> /// Remove a view from the session view cache /// </summary> public void removeSessionData( CswNbtSessionDataId SessionDataId ) { if( SessionDataId != null ) { CswTableUpdate SessionDataUpdate = _CswNbtResources.makeCswTableUpdate( "removeSessionData_update", SessionDataTableName ); DataTable SessionDataTable = SessionDataUpdate.getTable( SessionDataColumn_PrimaryKey, SessionDataId.get() ); //DataRow SessionDataRow = null; if( SessionDataTable.Rows.Count > 0 ) { SessionDataTable.Rows[0].Delete(); SessionDataUpdate.update( SessionDataTable ); } } } // removeSessionData(CswNbtSessionDataId)
} // constructor private CswNbtView _getView(string ViewId) { CswNbtView ReturnVal = null; if (CswNbtViewId.isViewIdString(ViewId)) { CswNbtViewId realViewid = new CswNbtViewId(ViewId); ReturnVal = _CswNbtResources.ViewSelect.restoreView(realViewid); } else if (CswNbtSessionDataId.isSessionDataIdString(ViewId)) { CswNbtSessionDataId SessionViewid = new CswNbtSessionDataId(ViewId); ReturnVal = _CswNbtResources.ViewSelect.getSessionView(SessionViewid); } return(ReturnVal); } // _getView()
}//restoreViews() /// <summary> /// Get a CswNbtView from the session view collection /// </summary> public CswNbtView getSessionView(CswNbtSessionDataId SessionViewId) { if (SessionViewId == null) { throw new CswDniException("CswNbtViewSelect.getSessionView(): SessionViewId is null"); } CswNbtSessionDataItem SessionDataItem = _CswNbtResources.SessionDataMgr.getSessionDataItem(SessionViewId); if (null == SessionDataItem || SessionDataItem.DataType != CswEnumNbtSessionDataType.View) { throw new CswDniException("CswNbtViewSelect.getSessionView(): SessionViewId (" + SessionViewId.get() + ") is not a view"); } return(SessionDataItem.View); } // getSessionView()
} // getQuickLaunchJson() private void _addQuickLaunchProp( DataRow Row, ViewSelect.Response.Category Category ) { Int32 ItemId = CswConvert.ToInt32( Row[SessionDataColumn_PrimaryKey] ); CswEnumNbtSessionDataType SessionType = CswConvert.ToString( Row[SessionDataColumn_SessionDataType] ); string Name = Row[SessionDataColumn_Name].ToString(); CswNbtSessionDataId SessionDataId = new CswNbtSessionDataId( ItemId ); if( SessionType == CswEnumNbtSessionDataType.Action ) { Int32 ActionId = CswConvert.ToInt32( Row[SessionDataColumn_ActionId] ); CswNbtAction Action = _CswNbtResources.Actions[ActionId]; _addQuickLaunchAction( Category, Name, SessionDataId, Action ); } else if( SessionType == CswEnumNbtSessionDataType.View ) { //Int32 ViewId = CswConvert.ToInt32( Row[SessionDataColumn_ViewId] ); _addQuickLaunchView( Category, Name, SessionDataId, Row[SessionDataColumn_ViewMode].ToString() ); } else if( SessionType == CswEnumNbtSessionDataType.Search ) { _addQuickLaunchSearch( Category, Name, SessionDataId ); } } // _addQuickLaunchProp()
private void _addQuickLaunchSearch( ViewSelect.Response.Category Category, string Text, CswNbtSessionDataId SessionDataId ) { Category.items.Add( new ViewSelect.Response.Item( CswEnumNbtViewItemType.Search ) { name = Text, itemid = SessionDataId.ToString(), iconurl = CswNbtMetaDataObjectClass.IconPrefix16 + "magglass.png" } ); }
private void _addQuickLaunchAction( ViewSelect.Response.Category Category, string Text, CswNbtSessionDataId SessionDataId, CswNbtAction Action ) { Category.items.Add( new ViewSelect.Response.Item( CswEnumNbtViewItemType.Action ) { name = Text, itemid = SessionDataId.ToString(), iconurl = CswNbtMetaDataObjectClass.IconPrefix16 + Action.IconFileName, url = CswConvert.ToString( Action.Url ) } ); }
} // _addQuickLaunchProp() private void _addQuickLaunchView( ViewSelect.Response.Category Category, string Text, CswNbtSessionDataId SessionDataId, string ViewMode ) { Category.items.Add( new ViewSelect.Response.Item( CswEnumNbtViewItemType.View ) { name = Text, itemid = SessionDataId.ToString(), iconurl = "Images/view/view" + ViewMode.ToString().ToLower() + ".gif", mode = ViewMode } ); }
/// <summary> /// Remove a view from the session view cache /// </summary> public void removeSessionView(CswNbtSessionDataId SessionViewId) { _CswNbtResources.SessionDataMgr.removeSessionData(SessionViewId); } // removeSessionView()