public static void DeleteList(ListProp listProp) { using (IDbConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString)) { connection.Open(); connection.Execute("DeleteList", new { List_ID = listProp.List_ID }, commandType: CommandType.StoredProcedure); } }
public static void InsertList(ListProp listProp) { using (IDbConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString)) { connection.Open(); DynamicParameters dp = new DynamicParameters(); dp.AddDynamicParams(new { Board_ID = listProp.Board_ID, List_Name = listProp.List_Name, List_Observing = listProp.List_Observing, List_Position = listProp.List_Position }); connection.Execute("InsertList", dp, commandType: CommandType.StoredProcedure); } }
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]; }