public List<MenuEntity> GetAllByDisplayType(string displayType) { MenuEntityDAC _menuEntityComponent = new MenuEntityDAC(); IDataReader reader = _menuEntityComponent.GetAllMenuEntity("DisplayType = '" + displayType + "'").CreateDataReader(); List<MenuEntity> _menuEntityList = new List<MenuEntity>(); while (reader.Read()) { if (_menuEntityList == null) _menuEntityList = new List<MenuEntity>(); MenuEntity _menuEntity = new MenuEntity(); if (reader["MenuEntityId"] != DBNull.Value) _menuEntity.MenuEntityId = Convert.ToInt32(reader["MenuEntityId"]); if (reader["MenuName"] != DBNull.Value) _menuEntity.MenuName = Convert.ToString(reader["MenuName"]); if (reader["ContentEntityId"] != DBNull.Value) _menuEntity.ContentEntityId = Convert.ToInt32(reader["ContentEntityId"]); if (reader["DisplayType"] != DBNull.Value) _menuEntity.DisplayType = Convert.ToString(reader["DisplayType"]); _menuEntity.NewRecord = false; _menuEntityList.Add(_menuEntity); } reader.Close(); return _menuEntityList; }
public MenuEntity GetByID(int _menuEntityId) { MenuEntityDAC _menuEntityComponent = new MenuEntityDAC(); IDataReader reader = _menuEntityComponent.GetByIDMenuEntity(_menuEntityId); MenuEntity _menuEntity = null; while(reader.Read()) { _menuEntity = new MenuEntity(); if(reader["MenuEntityId"] != DBNull.Value) _menuEntity.MenuEntityId = Convert.ToInt32(reader["MenuEntityId"]); if(reader["MenuName"] != DBNull.Value) _menuEntity.MenuName = Convert.ToString(reader["MenuName"]); if(reader["ContentEntityId"] != DBNull.Value) _menuEntity.ContentEntityId = Convert.ToInt32(reader["ContentEntityId"]); if (reader["DisplayType"] != DBNull.Value) _menuEntity.DisplayType = Convert.ToString(reader["DisplayType"]); _menuEntity.NewRecord = false; } reader.Close(); return _menuEntity; }
public bool Update(MenuEntity menuentity ,int old_menuEntityId) { MenuEntityDAC menuentityComponent = new MenuEntityDAC(); return menuentityComponent.UpdateMenuEntity( menuentity.MenuName, menuentity.ContentEntityId, menuentity.DisplayType, old_menuEntityId); }
public bool Insert(MenuEntity menuentity) { int autonumber = 0; MenuEntityDAC menuentityComponent = new MenuEntityDAC(); bool endedSuccessfuly = menuentityComponent.InsertNewMenuEntity( ref autonumber, menuentity.MenuName, menuentity.ContentEntityId, menuentity.DisplayType); if(endedSuccessfuly) { menuentity.MenuEntityId = autonumber; } return endedSuccessfuly; }