public bool UpdateBoard(int boardId, int groupId, int index, string title, int mode, bool star, String background) { BoardDAL board = new BoardDAL(); return(board.UpdateBoard(boardId, groupId, index, title, mode, star, background)); }
public bool InsertBoard(int index, string title, int mode, bool star, String background) { BoardDAL board = new BoardDAL(); int _star = star ? 1 : 0; return(board.InsertBoard(index, title, mode, _star, background)); }
/// <summary> /// Description: This method calls method in DAL layer to retrieve all the list of categories for board from database /// </summary> /// <returns>List of Categories for board</returns> public List <CategoryDBO> GetAllBoardCategories() { // Instantiate BoardDAL object BoardDAL lBoardDAL = new BoardDAL(); List <CategoryDBO> lCategoryList = lBoardDAL.GetAllBoardCategories(); return(lCategoryList); }
/// <summary> /// Description: This method calls method in DAL layer to find and return the list of specific posts required by user /// </summary> /// <param name="category">category name that a user specified </param> /// <param name="searchString">search string that a user specified </param> /// <returns>List of posts that are in the same category and contains searchString that user specified.</returns> public List <BoardDBO> GetAllBoards(string category, string searchString) { // Instantiate BoardDAL object BoardDAL lBoardDAL = new BoardDAL(); List <BoardDBO> oBoardList = lBoardDAL.GetAllBoards(category, searchString); return(oBoardList); }
/// <summary> /// Description: This method calls method in DAL layer to find and returns the post with specific id /// </summary> /// <param name="id">A unique Board Id</param> /// <returns>BoardDBO object with the specific id</returns> public BoardDBO FindBoardByBoardID(int id) { // Instantiate BoardDAL object BoardDAL lBoardDAL = new BoardDAL(); BoardDBO oBoard = lBoardDAL.FindBoardByBoardID(id); return(oBoard); }
/// <summary> /// Description: This method calls method in DAL layer to remove the board in database by boardID and return bool value. /// </summary> /// <param name="iBoardID">A unique BoardIDPK to find the post to be removed </param> /// <returns>If the post is successfully removed, return True. Otherwise, false.</returns> public bool RemoveBoardByBoardID(int iBoardID) { // Instantiate BoardDAL object BoardDAL lBoardDAL = new BoardDAL(); bool lResult = lBoardDAL.RemoveBoardByBoardID(iBoardID); return(lResult); }
/// <summary> /// Description: This method calls method in DAL layer to insert data into database and return integer value. /// </summary> /// <param name="iBoard"> A BoardDBO object with all the information to be inserted into database </param> /// <returns>If the parameter iBoard is successfully inserted into database, return Inserted.IDPK. Otherwise, 0</returns> public int CreateBoard(BoardDBO lBoardDBO) { // Instantiate BoardDAL object BoardDAL lBoardDAL = new BoardDAL(); int lResult = lBoardDAL.CreateBoard(lBoardDBO); return(lResult); }
/// <summary> /// Description: This methods calls method in DAL layer to check if the user who resquested to edit a post has the same user id. /// </summary> /// <param name="iBoardIDPK"> A unique Board ID </param> /// <param name="iUserIDPK"> A unique User ID</param> /// <returns>If it is the same user, return true. Otherwise, false </returns> public bool FindBoolSameUserByUserIDAndBoardID(int iBoardIDPK, int iUserIDPK) { // Instantiate BoardDAL object BoardDAL lBoardDAL = new BoardDAL(); bool lResult = lBoardDAL.FindBoolSameUserByUserIDAndBoardID(iBoardIDPK, iUserIDPK); return(lResult); }
/// <summary> /// Description: This method calls method in DAL layer to update a post in the database by BoardIDPK and returns bool value. /// </summary> /// <param name="iBoardDBO">A post to be updated.</param> /// <returns>If the post is successfully updated, return True. Otherwise, false</returns> public bool UpdateBoardByBoardID(BoardDBO iBoardDBO) { // Instantiate BoardDAL object BoardDAL lBoardDAL = new BoardDAL(); bool lResult = lBoardDAL.UpdateBoardByBoardID(iBoardDBO); return(lResult); }
/// <summary> /// Description: This method calls method in DAL layer to retrieve all the posts written by specific user by a unique UserID /// </summary> /// <param name="id">A unique ID for user</param> /// <returns>List of posts that the user has written.</returns> public List <BoardDBO> GetAllBoardsByUserID(int id) { // Instantiate DAL object BoardDAL lBoardDAL = new BoardDAL(); List <BoardDBO> lBoardList = lBoardDAL.GetAllBoardsByUserID(id); return(lBoardList); }
/// <summary> /// Inserts a new board to the table /// </summary> /// <param name="dalObject">Board to insert</param> /// <returns>The generated id of the board inserted in the database</returns> public override long Insert(DalObject dalObject) { using (var connection = new SQLiteConnection(_connectionString)) { BoardDAL board = (BoardDAL)dalObject; long output = -1; SQLiteCommand command = new SQLiteCommand(null, connection); SQLiteDataReader dataReader = null; try { connection.Open(); command.CommandText = $"INSERT INTO {boardsTable} ({BoardDAL.userCreatorColumn}) " + $"VALUES (@creatorIdVal); SELECT {DalController.seqCol} FROM {DalController.SqlSeq} WHERE {DalController.seqName}='{boardsTable}';"; SQLiteParameter userIdParam = new SQLiteParameter(@"creatorIdVal", board.CreatorID); command.Parameters.Add(userIdParam); command.Prepare(); dataReader = command.ExecuteReader(); if (dataReader.Read()) { output = (long)dataReader.GetValue(0); } } catch (Exception e) { log.Error($"Failed to insert board to database{board.Id}", e); } finally { if (dataReader != null) { dataReader.Close(); } command.Dispose(); connection.Close(); } return(output); } }
public void delete() { BoardDAL.deleteBoard(this.Id); }
public int GetMaxID() { BoardDAL board = new BoardDAL(); return(board.GetMaxID()); }
public Board GetBoard(int id) { BoardDAL board = new BoardDAL(); return(board.GetBoard(id)); }
public List <Board> GetAllBoard() { BoardDAL board = new BoardDAL(); return(board.GetAllBoard()); }
public void SetTotalLimit(int newLimit) { this.totalLimit = newLimit; BoardDAL.UpdateLimit(this.Id, newLimit); }
//============================================================ public bool AddUser(int idUser, int idBoard) { BoardDAL board = new BoardDAL(); return(board.AddUser(idUser, idBoard)); }
/// <summary> /// Converts reader to board dal /// </summary> /// <param name="reader"></param> /// <returns>BoardDAL</returns> protected override DalObject ConvertReaderToObject(SQLiteDataReader reader) { BoardDAL board = new BoardDAL((long)reader.GetValue(0), (long)reader.GetValue(1)); return(board); }
public void save() { BoardDAL.saveBoard(this.toStruct()); }
public bool DeleteBoard(int id) { BoardDAL board = new BoardDAL(); return(board.DeleteBoard(id)); }
public static Board GetBoard(int boardID) { return(new Board(BoardDAL.getBoard(boardID))); }
public List <Board> GetAllBoard(int idUser) { BoardDAL board = new BoardDAL(); return(board.GetAllBoard(idUser)); }
public Hashtable getBoards(List <int> MyBoards) { return(BoardDAL.boardsNameId(MyBoards)); }