public static CustomList<Menu> GetMenuType() { ConnectionManager conManager = new ConnectionManager(ConnectionName.SysMan); CustomList<Menu> MenuCollection = new CustomList<Menu>(); IDataReader reader = null; String sql = String.Format("Select distinct MenuType from Menu"); try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { Menu newMenu = new Menu(); newMenu.SetDataForMenuType(reader); MenuCollection.Add(newMenu); } return MenuCollection; } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) reader.Close(); } }
public static CustomList<Menu> GetAllMenuByApplicationID(int applicationID) { ConnectionManager conManager = new ConnectionManager(ConnectionName.SysMan); CustomList<Menu> MenuCollection = new CustomList<Menu>(); IDataReader reader = null; String sql = String.Format("Select * from Menu Where ApplicationID = '" + applicationID + "'and FormName is not NULL"); try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { Menu newMenu = new Menu(); newMenu.SetData(reader); MenuCollection.Add(newMenu); } MenuCollection.InsertSpName = "spInsertMenu"; MenuCollection.UpdateSpName = "spUpdateMenu"; MenuCollection.DeleteSpName = "spDeleteMenu"; return MenuCollection; } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) reader.Close(); } }
public static CustomList<Menu> GetAllMenuItemsByUserCode(string UserCode) { ConnectionManager conManager = new ConnectionManager(ConnectionName.SysMan); CustomList<Menu> MenuCollection = new CustomList<Menu>(); IDataReader reader = null; conManager.OpenDataReader(out reader, "spWebGetMenuAndAccessRights", UserCode); try { while (reader.Read()) { Menu newMenu = new Menu(); newMenu.SetData(reader); MenuCollection.Add(newMenu); } MenuCollection.InsertSpName = "spInsertMenu"; MenuCollection.UpdateSpName = "spUpdateMenu"; MenuCollection.DeleteSpName = "spDeleteMenu"; return MenuCollection; } catch (Exception ex) { throw (ex); } finally { if (conManager != null) { conManager.CloseConnection(); conManager.Dispose(); } if (reader != null && !reader.IsClosed) reader.Close(); } }
public static Menu GetAllAccessRightsOfAPage(string UserCode, int ObjectID) { ConnectionManager conManager = new ConnectionManager(ConnectionName.SysMan); IDataReader reader = null; conManager.OpenDataReader(out reader, "spWebGetMenuAndAccessRights", UserCode, ObjectID); try { Menu menu = new Menu(); while (reader.Read()) { menu.SetData(reader); } return menu; } catch (Exception ex) { throw (ex); } finally { if (conManager != null) { conManager.CloseConnection(); conManager.Dispose(); } if (reader != null && !reader.IsClosed) reader.Close(); } }