public bool Insert(MenuEntityType menuentitytype) { int autonumber = 0; MenuEntityTypeDAC menuentitytypeComponent = new MenuEntityTypeDAC(); bool endedSuccessfuly = menuentitytypeComponent.InsertNewMenuEntityType( ref autonumber, menuentitytype.Name); if(endedSuccessfuly) { menuentitytype.MenuEntityTypeId = autonumber; } return endedSuccessfuly; }
public MenuEntityType GetByID(int _menuEntityTypeId) { MenuEntityTypeDAC _menuEntityTypeComponent = new MenuEntityTypeDAC(); IDataReader reader = _menuEntityTypeComponent.GetByIDMenuEntityType(_menuEntityTypeId); MenuEntityType _menuEntityType = null; while(reader.Read()) { _menuEntityType = new MenuEntityType(); if(reader["MenuEntityTypeId"] != DBNull.Value) _menuEntityType.MenuEntityTypeId = Convert.ToInt32(reader["MenuEntityTypeId"]); if(reader["Name"] != DBNull.Value) _menuEntityType.Name = Convert.ToString(reader["Name"]); _menuEntityType.NewRecord = false; } reader.Close(); return _menuEntityType; }
public List<MenuEntityType> GetAll() { MenuEntityTypeDAC _menuEntityTypeComponent = new MenuEntityTypeDAC(); IDataReader reader = _menuEntityTypeComponent.GetAllMenuEntityType().CreateDataReader(); List<MenuEntityType> _menuEntityTypeList = new List<MenuEntityType>(); while(reader.Read()) { if(_menuEntityTypeList == null) _menuEntityTypeList = new List<MenuEntityType>(); MenuEntityType _menuEntityType = new MenuEntityType(); if(reader["MenuEntityTypeId"] != DBNull.Value) _menuEntityType.MenuEntityTypeId = Convert.ToInt32(reader["MenuEntityTypeId"]); if(reader["Name"] != DBNull.Value) _menuEntityType.Name = Convert.ToString(reader["Name"]); _menuEntityType.NewRecord = false; _menuEntityTypeList.Add(_menuEntityType); } reader.Close(); return _menuEntityTypeList; }
public bool Update(MenuEntityType menuentitytype ,int old_menuEntityTypeId) { MenuEntityTypeDAC menuentitytypeComponent = new MenuEntityTypeDAC(); return menuentitytypeComponent.UpdateMenuEntityType( menuentitytype.Name, old_menuEntityTypeId); }