public bool DeleteAction(OVRBKActionInfo obOVRBKActionInfo) { int iResult = GVAR.g_ManageDB.DeleteMatchAction(obOVRBKActionInfo); if (iResult <= 0) { return(false); } return(true); }
public void UpdateActionList(ref List <OVRBKActionInfo> lstAction, int iListIndex) { string[] listColumn = new string[5]; if (dgvAction.Columns.Count <= 0) { InitActionGridHeader(); } //加入列头描述 for (int i = 0; i < 5; i++) { listColumn[i] = dgvAction.Columns[i].HeaderText; } if (iListIndex < 0) //全部更新 { dgvAction.Rows.Clear(); for (int i = 0; i < lstAction.Count; i++) { OVRBKActionInfo tmpAction = lstAction.ElementAt(i); DataGridViewRow dr = new DataGridViewRow(); dr.CreateCells(dgvAction); dr.Selected = false; dr.Cells[0].Value = GVAR.g_ManageDB.GetPeriodName(tmpAction.MatchID, tmpAction.MatchSplitID); dr.Cells[1].Value = tmpAction.ActionTime; if (tmpAction.TeamPos == 1) { dr.Cells[2].Value = m_CCurMatch.m_CHomeTeam.TeamName; } else if (tmpAction.TeamPos == 2) { dr.Cells[2].Value = m_CCurMatch.m_CVisitTeam.TeamName; } dr.Cells[3].Value = tmpAction.PlayerName; dr.Cells[4].Value = tmpAction.ActionDes; ////////////////////////////////// //比较列的长度 for (int j = 0; j < 5; j++) { string strValue = ""; if (dr.Cells[j].Value != null) { strValue = dr.Cells[j].Value.ToString(); } if (strValue.Length > listColumn[j].Length) { listColumn[j] = strValue; } } dgvAction.Rows.Add(dr); } } //////////////////////////////// //设置列宽 for (int i = 0; i < 5; i++) { System.Drawing.SizeF sf = dgvAction.CreateGraphics().MeasureString(listColumn[i], dgvAction.Font); dgvAction.Columns[i].Width = System.Convert.ToInt32(sf.Width + 25f); } /////////////////////////// //焦点在最后一行 if (dgvAction.Rows.Count > 0) { dgvAction.Rows[dgvAction.Rows.Count - 1].Selected = true; dgvAction.FirstDisplayedScrollingRowIndex = dgvAction.Rows.Count - 1; } }