public static void InsertBoard(BoardProp boardProp) { using (IDbConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString)) { connection.Open(); connection.Execute("InsertBoard", new { Board_Name = boardProp.Board_Name, Board_Position = boardProp.Board_Position }, commandType: CommandType.StoredProcedure); } }
public static void DeleteBoard(BoardProp boardProp) { using (IDbConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString)) { connection.Open(); connection.Execute("DeleteBoard", new { Board_ID = boardProp.Board_ID }, commandType: CommandType.StoredProcedure); } }
public static void UpdateBoard(BoardProp boardProp) { using (IDbConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString)) { connection.Open(); DynamicParameters dp = new DynamicParameters(); dp.AddDynamicParams(new { Board_ID = boardProp.Board_ID, Board_Name = boardProp.Board_Name, Board_Position = boardProp.Board_Position }); connection.Execute("UpdateBoard", dp, commandType: CommandType.StoredProcedure); } }
private void ButtonAddBoard_Click(object sender, EventArgs e) { Boards NewBoard = new Boards(); NewBoard.Size = new Size(175, 42); NewBoard.NameBoard = "Board (" + (listBoards.Count + 1) + ")"; NewBoard.BoardName.Text = NewBoard.NameBoard; NewBoard.DoubleClick += NewBoard_Click; NewBoard.BoardName.Click += BoardName_Click; NewBoard.Deleted += NewBoard_Deleted; listBoards.Add(NewBoard); flowLayoutPanelBoardList.Controls.Remove(ButtonAddBoard); flowLayoutPanelBoardList.Controls.Add(NewBoard); flowLayoutPanelBoardList.Controls.Add(ButtonAddBoard); Data.BoardProp boardProp = new Data.BoardProp(); boardProp.Board_Name = NewBoard.NameBoard; boardProp.Board_Position = listBoards.Count - 1; Data.DataService.InsertBoard(boardProp); boardProps = Data.DataService.GetAllBoard(); NewBoard.boardProp = boardProps[boardProps.Count - 1]; }
private void ButtonAddList_Click(object sender, EventArgs e) { int Locate = -1; for (int i = 0; i < listBoards.Count; i++) { if (listBoards[i].BackColor == Color.LightBlue) { Locate = i; break; } } ButtonAddList.Location = new Point(ButtonAddList.Location.X + 300, ButtonAddList.Location.Y); Lists NewList = new Lists(); NewList.TextboxListName.Text = "List (" + (listBoards[Locate].list.Count + 1) + ")"; NewList.NameLists = NewList.TextboxListName.Text; NewList.Location = new Point(ButtonAddList.Location.X - 300, 0); NewList.Deleted += NewList_Deleted; NewList.SecondFormShowed += NewList_SecondFormShowed; NewList.SecondFormClosed += NewList_SecondFormClosed; listBoards[Locate].list.Add(NewList); ListListPanel.Controls.Add(NewList); Data.BoardProp boardProp = new Data.BoardProp(); boardProp = listBoards[Locate].boardProp; Data.ListProp listProp = new Data.ListProp(); listProp.Board_ID = boardProp.Board_ID; listProp.List_Name = NewList.TextboxListName.Text; listProp.List_Observing = false; listProp.List_Position = listBoards[Locate].list.Count - 1; Data.DataService.InsertList(listProp); listBoards[Locate].listProps = Data.DataService.GetListByBoardID(boardProp.Board_ID); NewList.listProp = listBoards[Locate].listProps[listBoards[Locate].listProps.Count - 1]; }