private void AddRowX(iGrid _grid) { if (_grid.Rows.Cast <iGRow>().Count(j => j.Cells[0].Value == null) > 0) { _grid.Focus(); var _cell = _grid.Rows.Cast <iGRow>().Where(j => j.Cells[0].Value == null).Select(v => v.Cells[0]).FirstOrDefault(); if (_cell != null) { _cell.Selected = true; } return; } iGRow _row = null; _grid.Focus(); _row = _grid.Rows.Add(); _row.Cells[0].Col.Width = 290; _row.Cells[1].Col.Width = 22; _row.Font = new Font("verdana", 11, FontStyle.Regular); _row.ForeColor = Color.DarkBlue; _row.AutoHeight(); _row.Height += 1; _grid.SetCurCell(_grid.Rows.Count - 1, 0); SendKeys.Send("{ENTER}"); _grid.AutoResizeCols = false; }
/// <summary> /// 交换两个棋子,在布局阶段使用 /// </summary> /// <param name="one">第一个棋子</param> /// <param name="two">要交换位置的棋子</param> public void ExchageSelfChess(Chess one, Chess two) { iGrid tmpGrid = two.iGrid; two.SetNewGrid(one.iGrid); one.SetNewGrid(tmpGrid); }
void fGrid_VScrollBarCustomButtonClick(object sender, iGScrollBarCustomButtonClickEventArgs e) { iGrid fgrid = sender as iGrid; if (fgrid == null || fgrid.Rows.Count == 0) { return; } if (e.Index == 0) { //group and expandall if (fgrid.GroupObject.Count == 0) { SortAndGroup(fgrid); } } else if (e.Index == 1) { //Group and collapse all if (fgrid.GroupObject.Count == 0) { SortAndGroup(fgrid); } } else if (e.Index == 2) { //UnGroup } }
/// <summary> /// 恢复数据 /// </summary> void ResetData() { // 恢复对数据的应用 netDataReceive = null; netDataSend = null; if (chessCluster != null) { foreach (Chess item in chessCluster) { Destroy(item.gameObject); } } chessCluster = new List <Chess>();; selfChessCluster = new List <Chess>(); otherChessCluster = new List <Chess>(); selfStage = GameStage.None; otherStage = GameStage.None; FirstChess = null; if (SelectedIGrid != null) { SelectedIGrid.HideSelectedTag(); SelectedIGrid = null; } if (GoneIGrid != null) { GoneIGrid.HideGoneTag(); GoneIGrid = null; } }
Control IiGDropDownControl.GetDropDownControl(iGrid grid, System.Drawing.Font font, Type interfaceType) { m_grdMain = grid; Calendar.Font = font; Calendar.RightToLeft = grid.RightToLeft; return(Calendar); }
/// <summary> /// 隐藏GoneIGrid /// </summary> /// <param name="tmp"></param> public void ChangeGoneIGrid(iGrid tmp) { if (GoneIGrid != null) { GoneIGrid.HideGoneTag(); } tmp.ShowGoneTag(); GoneIGrid = tmp; }
/// <summary> /// 改变选中的棋子 /// </summary> /// <param name="tmp"></param> public void ChangeSelectedChess(iGrid tmp) { if (SelectedIGrid != null) { SelectedIGrid.HideSelectedTag(); } tmp.ShowSelectedTag(); SelectedIGrid = tmp; }
private void SortAndGroup(iGrid fGrid) { fGrid.BeginUpdate(); fGrid.GroupObject.Clear(); fGrid.SortObject.Clear(); fGrid.GroupObject.Add("svalue"); fGrid.SortObject.Add("svalue", iGSortOrder.Ascending); fGrid.Group(); fGrid.EndUpdate(); }
/// <summary> /// 移动棋子到目标网格 /// </summary> /// <param name="chess">要移动的棋子</param> /// <param name="igrid">目标网格</param> public void ChessMove(Chess chess, iGrid igrid) { // 走子轨迹 gm.ChangeGoneIGrid(chess.iGrid); gm.ChangeSelectedChess(igrid); chess.HidePath(); chess.SetNewGrid(igrid); gm.PlayChessMoveSound(); }
private void FillGrid() { ClearAllGrids(); if (datam.DATA_MEM_STATS == null) { return; } byte _index = 0; byte _counter = 0; iGrid _grid = null; iGRow _row = null; foreach (var g in m_grids) { g.BeginUpdate(); } foreach (var c in datam.DATA_MEM_STATS.Values.OrderBy(j => j.cat_index)) { _grid = m_grids[_index]; foreach (var t in c.TypeCollection.Values) { if (c.is_optional & t.count == 0) { continue; } _row = _grid.Rows.Add(); _row.ReadOnly = iGBool.True; _row.Font = new Font("verdana", 11, FontStyle.Regular); _row.Cells["name"].Value = t.type_name; _row.Cells["category"].Value = c.cat_name; _row.Cells["value"].Value = t.count == 0 ? null : t.count.ToStringNullable(); _row.Cells["svalue"].Value = c.cat_index; _row.Cells[1].ForeColor = Color.Black; _row.Cells[0].ForeColor = Color.DarkGreen; _row.AutoHeight(); } _counter++; if (_counter == 5 & _index != 2) { _index++; _counter = 0; } } SortAndGroup(); foreach (var g in m_grids) { g.Cols[0].Width = ((3 * g.ClientSize.Width) / 4); g.Cols[1].AutoWidth(); g.AutoResizeCols = false; g.EndUpdate(); } }
private void ClearGridCells(iGrid grid) { m_last_time_stamp = 0; if (grid == null) { foreach (var gr in new iGrid[] { fGrid, fGridnormal }) { var cell_list = from c in gr.Cols.Cast <iGCol>() where c.Index > 0 & c.Visible from k in c.Cells.Cast <iGCell>() where k.Value != null select k; foreach (var k in cell_list) { k.Value = null; k.AuxValue = null; if (k.ValueType == null) { k.ValueType = typeof(int); } if (k.Row.Level > 0) { k.Row.Visible = false; } } } } else { var cell_list = from c in grid.Cols.Cast <iGCol>() where c.Index > 0 & c.Visible from k in c.Cells.Cast <iGCell>() where k.Value != null select k; foreach (var k in cell_list) { k.Value = null; k.AuxValue = null; if (k.ValueType == null) { k.ValueType = typeof(int); } if (k.Row.Level > 0) { k.Row.Visible = false; } } } }
/// <summary> /// 为棋子设置新的网格点 /// </summary> /// <param name="tmpGrid">新的网格点</param> public void SetNewGrid(iGrid tmpGrid) { if (tmpGrid == null) { return; } if (iGrid != null) { iGrid.GetComponent <Button>().interactable = true; } tmpGrid.GetComponent <Button>().interactable = false; iGrid = tmpGrid; transform.SetParent(iGrid.transform); this.posID = iGrid.posID; transform.localPosition = Vector3.zero; }
private void fGrid_AfterAutoGroupRowCreated(object sender, iGAfterAutoGroupRowCreatedEventArgs e) { iGrid _grid = sender as iGrid; iGCell myGroupRowCell = _grid.RowTextCol.Cells[e.AutoGroupRowIndex]; myGroupRowCell.Row.AutoHeight(); ic.church_groupC _gp = _grid.Rows[e.GroupedRowIndex].Tag as ic.church_groupC; string _disp_str = string.Empty; if (_gp != null) { _disp_str = datam.DATA_CG_TYPES[_gp.cg_type_id].cg_type_name; } myGroupRowCell.Value = _disp_str; myGroupRowCell.AuxValue = _gp.cg_type_id; }
/// <summary> /// 在棋子可走路径添加网格 /// </summary> /// <param name="igrid"></param> void PathAdd(iGrid igrid) { if (igrid != null) { if (igrid.chess == null) { path.Add(igrid); } else { if (igrid.chess.team == this.enemyTeam) { path.Add(igrid); } } } }
void g_AfterAutoGroupRowCreated(object sender, iGAfterAutoGroupRowCreatedEventArgs e) { iGrid objfgrid = sender as iGrid; if (objfgrid == null) { return; } iGCell myGroupRowCell = objfgrid.RowTextCol.Cells[e.AutoGroupRowIndex]; myGroupRowCell.Row.AutoHeight(); myGroupRowCell.Row.Height = myGroupRowCell.Row.Height + 3; myGroupRowCell.Row.Selectable = false; iGCell myFirstCellInGroup = objfgrid.Cells[e.GroupedRowIndex, "category"]; myGroupRowCell.Row.Key = string.Format("GP{0}", objfgrid.Cells[e.GroupedRowIndex, "svalue"].Value.ToInt32()); myFirstCellInGroup.TextAlign = iGContentAlignment.MiddleCenter; myGroupRowCell.Value = string.Format("{0}", myFirstCellInGroup.Value.ToString()); }
private void fGrid_AfterAutoGroupRowCreated(object sender, iGAfterAutoGroupRowCreatedEventArgs e) { iGrid _grid = sender as iGrid; iGCell myGroupRowCell = _grid.RowTextCol.Cells[e.AutoGroupRowIndex]; myGroupRowCell.Row.AutoHeight(); ic.church_groupC _gp = _grid.Rows[e.GroupedRowIndex].Tag as ic.church_groupC; string _disp_str = null; var _cg_type = datam.DATA_CG_TYPES[_gp.cg_type_id]; if (_gp != null) { _disp_str = _cg_type.cg_type_name; } myGroupRowCell.Value = _cg_type.is_default ? string.Format("{0} (Default)", _disp_str) : _disp_str; myGroupRowCell.AuxValue = _gp.cg_type_id; myGroupRowCell.Row.Tag = _cg_type; myGroupRowCell.Row.Key = string.Format("gp-{0}", _cg_type.cg_type_id); }
private void fGrid_AfterAutoGroupRowCreated(object sender, iGAfterAutoGroupRowCreatedEventArgs e) { iGrid objfgrid = sender as iGrid; if (objfgrid == null) { return; } iGCell myGroupRowCell = objfgrid.RowTextCol.Cells[e.AutoGroupRowIndex]; myGroupRowCell.Row.AutoHeight(); myGroupRowCell.Row.Height = myGroupRowCell.Row.Height + 4; iGCell myFirstCellInGroup = objfgrid.Cells[e.GroupedRowIndex, m_group_col]; myGroupRowCell.Row.Key = string.Format("GP{0}", objfgrid.Cells[e.GroupedRowIndex, "svalue"].Value.ToInt32()); myGroupRowCell.Row.TextAlign = iGContentAlignment.MiddleLeft; myFirstCellInGroup.TextAlign = iGContentAlignment.MiddleCenter; myGroupRowCell.Value = string.Format("{0}", myFirstCellInGroup.Value.ToProperCase()); combofilter.Items.Add(myGroupRowCell.Text); m_GroupedRows.Add(myGroupRowCell.Row.Key); OtherGroups.Add(e.GroupedRowIndex - 1); }
/// <summary> /// 判断该玩网格是否可被棋子前往 /// </summary> /// <param name="igrid"></param> /// <returns></returns> public bool IGridCanBeMove(iGrid igrid) { if (gm.selfStage == GameStage.LayOut) { if (igrid.team == this.team) { return(true); } } if (gm.selfStage == GameStage.Doing) { if (path.Contains(igrid)) { return(true); } } return(false); }
public void Attach(iGrid grid) { fGrid = grid; fGrid.RequestEdit += new iGRequestEditEventHandler(FGrid_RequestEdit); fGrid.KeyPress += new KeyPressEventHandler(FGrid_KeyPress); fGrid.CellClick += new iGCellClickEventHandler(FGrid_CellClick); fGrid.CellMouseDown += new iGCellMouseDownEventHandler(FGrid_CellMouseDown); fGrid.CellMouseUp += new iGCellMouseUpEventHandler(FGrid_CellMouseUp); fGrid.CellMouseEnter += new iGCellMouseEnterLeaveEventHandler(FGrid_CellMouseEnter); fGrid.CellMouseLeave += new iGCellMouseEnterLeaveEventHandler(FGrid_CellMouseLeave); fGrid.RequestCellToolTipText += new iGRequestCellToolTipTextEventHandler(FGrid_RequestCellToolTipText); fGrid.CustomDrawCellForeground += new iGCustomDrawCellEventHandler(FGrid_CustomDrawCellForeground); fGrid.CustomDrawCellGetHeight += new iGCustomDrawCellGetHeightEventHandler(FGrid_CustomDrawCellGetHeight); fGrid.CustomDrawCellGetWidth += new iGCustomDrawCellGetWidthEventHandler(FGrid_CustomDrawCellGetWidth); foreach (iGCol col in fGrid.Cols) { if (IsButtonColumn(col.Index)) { col.CellStyle.CustomDrawFlags = iGCustomDrawFlags.Foreground; } } }
void iGridCategory_AfterCommitEdit(object sender, iGAfterCommitEditEventArgs e) { iGrid _grid = sender as iGrid; if (_grid.Rows[e.RowIndex].Cells[0].Value != null) { _grid.Rows[e.RowIndex].Cells[0].Value = _grid.Rows[e.RowIndex].Cells[0].Value.ToProperCase(); } if (sender == iGridCategory) { #region Item Category if (_grid.Rows[e.RowIndex].Cells[0].Value == null) { if (_grid.Rows[e.RowIndex].Tag != null) { var _category = _grid.Rows[e.RowIndex].Tag as ic.expense_catC; using (var xd = new xing()) { if (xd.ExecuteScalarInt("select TOP 1 exp_acc_id from acc_expense_accounts_tb where exp_cat_id=" + _category.exp_cat_id) == 0) { xd.SingleDeleteCommandExp("acc_expense_cat_tb", new string[] { "exp_cat_id" }, new int[] { _category.exp_cat_id }); xd.CommitTransaction(); } else { _grid.Rows[e.RowIndex].Cells[0].Value = _category.exp_cat_name; dbm.ErrorMessage("There Are Some Expense Accounts Which Are Attached To This Category", "Delete Operation Will Be Cancelled"); return; } } var _dp_item = (from r in (fGrid.Rows["item_cat"].Cells["desc"].DropDownControl as iGDropDownList).Items.Cast <fnn.iGComboItemEX>() where r.Tag == _category select r).FirstOrDefault(); if (_dp_item != null) { (fGrid.Rows["item_cat"].Cells["desc"].DropDownControl as iGDropDownList).Items.Remove(_dp_item); fGrid.Rows["item_cat"].Cells["desc"].AuxValue = null; fGrid.Rows["item_cat"].Cells["desc"].Value = null; } _grid.Rows[e.RowIndex].Tag = null; datam.DATA_EXPENSE_CATEGORY.Remove(_category.exp_cat_id); _grid.Rows.RemoveAt(e.RowIndex); } return; } else { if (_grid.Rows[e.RowIndex].Tag == null) { //insert if (datam.DATA_EXPENSE_CATEGORY.Values.FirstOrDefault(k => k.exp_cat_name.ToLower() == _grid.Rows[e.RowIndex].Cells[0].Text.ToLower()) != null) { dbm.ErrorMessage("Duplicate Entry Found", "Duplicate Error"); _grid.Rows[e.RowIndex].Cells[0].Value = null; return; } var _category = new ic.expense_catC(); using (var xd = new xing()) { _category.exp_cat_name = _grid.Rows[e.RowIndex].Cells[0].Text.ToProperCase(); _category.exp_cat_id = xd.SingleInsertCommandTSPInt("acc_expense_cat_tb", new string[] { "exp_cat_name", "exp_type", "fs_time_stamp", "lch_id" }, new object[] { _category.exp_cat_name, emm.export_type.insert.ToByte(), 0, datam.LCH_ID }); xd.CommitTransaction(); } _grid.Rows[e.RowIndex].Tag = _category; datam.DATA_EXPENSE_CATEGORY.Add(_category.exp_cat_id, _category); (fGrid.Rows["item_cat"].Cells["desc"].DropDownControl as iGDropDownList).Items.Add(new fnn.iGComboItemEX { Tag = _category, Text = _category.exp_cat_name, Value = _category.exp_cat_name }); } else { var _category = _grid.Rows[e.RowIndex].Tag as ic.expense_catC; _category.exp_cat_name = _grid.Rows[e.RowIndex].Cells[0].Value.ToStringNullable(); using (var xd = new xing()) { xd.SingleUpdateCommandALL("acc_expense_cat_tb", new string[] { "exp_cat_name", "exp_cat_id" }, new object[] { _category.exp_cat_name, _category.exp_cat_id }, 1); xd.CommitTransaction(); } //update } } #endregion } if (((e.RowIndex + 1) == _grid.Rows.Count)) { AddRowX(_grid); } }
private void InitializeTab1GridColumns() { #region Columns To Display string[] _cols = new string[] { "Description", "Jan", "Feb", "Mar", "April", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec", "Year\nTotal" }; iGCol myCol; int y = 1; var _grids = new object[] { fGrid }; foreach (var g in _grids) { iGrid _grid = (iGrid)g; y = 1; foreach (var c in _cols) { if (y > 1 & y < 14) { myCol = _grid.Cols.Add((y - 1).ToString(), string.Format("{0}", c)); myCol.AllowSizing = true; myCol.CellStyle.TextAlign = iGContentAlignment.MiddleCenter; myCol.CellStyle.FormatString = "{0:N0}"; myCol.CellStyle.ValueType = typeof(int); myCol.Width = 100; } else { if (y == 14) { myCol = _grid.Cols.Add("Total", string.Format("{0}", c)); myCol.AllowSizing = true; myCol.CellStyle.TextAlign = iGContentAlignment.MiddleCenter; myCol.CellStyle.FormatString = "{0:N0}"; myCol.CellStyle.ValueType = typeof(int); myCol.Width = 100; continue; } myCol = _grid.Cols.Add(c, c); myCol.AllowSizing = true; } myCol.IncludeInSelect = true; myCol.SortType = iGSortType.None; // myCol.ColHdrStyle.TextAlign = iGContentAlignment.MiddleCenter; myCol.ColHdrStyle.ForeColor = Color.Red; myCol.ColHdrStyle.Font = new Font("verdana", 9, FontStyle.Bold); y++; } _grid.Cols["Total"].CellStyle.FormatString = "{0:N0}"; _grid.Cols["Total"].CellStyle.BackColor = Color.WhiteSmoke; _grid.Cols.Add("Category", string.Empty).Visible = false; _grid.Cols.Add("SValue", string.Empty).Visible = false; _grid.Cols.Add("xsection", string.Empty).Visible = false; _grid.Cols.Add("parent_id", string.Empty).Visible = false; _grid.Cols.Add("has_children", string.Empty).Visible = false; myCol = _grid.Cols["SValue"]; myCol.SortType = iGSortType.ByValue; _grid.Header.Rows.Add(); _grid.Header.Cells[1, 1].SpanCols = 12; _grid.Header.Cells[1, 1].Value = "Monthly Departmental Expenses"; _grid.Header.Cells[1, 1].ForeColor = Color.Blue; _grid.DefaultRow.Height = _grid.GetPreferredRowHeight(true, false); _grid.DefaultAutoGroupRow.Height = _grid.DefaultRow.Height; _grid.Cols.AutoWidth(); } #endregion }
/// <summary> /// 游戏状态检测 /// </summary> void GameStateCheck() { if (selfStage == GameStage.Ready && otherStage == GameStage.Ready) { Debug.Log("生成棋子"); selfStage = otherStage = GameStage.LayOut; // 播放音效 PlayStartSound(); UpdateIGrids(); InitChessColor(team); chessCluster.AddRange(selfChessCluster); chessCluster.AddRange(otherChessCluster); gameUI.SetExplainText("布局阶段"); } if (selfStage == GameStage.Wait && otherStage == GameStage.Wait) { gameUI.SetExplainText("游戏开始"); // 重置棋子状态提醒标志 if (SelectedIGrid != null) { SelectedIGrid.HideSelectedTag(); SelectedIGrid = null; } if (GoneIGrid != null) { GoneIGrid.HideGoneTag(); GoneIGrid = null; } selfStage = otherStage = GameStage.Doing; // 同步棋盘数据, 把对方的棋盘设置为自己的棋盘 PlayStartSound(); PlayGameBGM(); foreach (NetChess item in netDataReceive.netChesses) { Chess chess = GetChessFromUID(item.u_id, otherChessCluster); Vector2 t_posID = new Vector2(item.posIDx, item.posIDy); chess.SetNewGrid(GetGrids(t_posID)); chess.State = ChessState.Hide; } // 初始化回合,红方先行 Round = Team.red; gameUI.SetExplainText("红方走"); } if (selfStage == GameStage.Over && otherStage == GameStage.Over) { // 游戏结束 } }
/// <summary> /// 网络信息处理 /// </summary> void On_NetMessageDeal(string info) { netDataReceive = JsonMapper.ToObject <NetData>(info); switch (netDataReceive.type) { case "Ready": otherStage = GameStage.Ready; if (team == Team.red) { netManager.discovery.StopBroadcast(); } break; case "Wait": otherStage = GameStage.Wait; break; case "Giveup": selfStage = otherStage = GameStage.Over; WinGame(); break; case "Doing": switch (netDataReceive.netChessActions.Action) { case "Move": Chess chess = GetGrids(new Vector2(netDataReceive.netChessActions.fromX, netDataReceive.netChessActions.fromY)).chess; iGrid igrid = GetGrids(new Vector2(netDataReceive.netChessActions.toX, netDataReceive.netChessActions.toY)); ChangeGoneIGrid(chess.iGrid); ChangeSelectedChess(igrid); chess.SetNewGrid(igrid); chess.State = ChessState.Show; // 播放音效 PlayChessMoveSound(); // 改变回合 ChangeGameRound(); break; case "Eat": Chess chessA = GetGrids(new Vector2(netDataReceive.netChessActions.fromX, netDataReceive.netChessActions.fromY)).chess; Chess chessB = GetGrids(new Vector2(netDataReceive.netChessActions.toX, netDataReceive.netChessActions.toY)).chess; chessA.State = ChessState.Show; chessB.Dead(); ChangeGoneIGrid(chessA.iGrid); ChangeSelectedChess(chessB.iGrid); chessA.SetNewGrid(chessB.iGrid); // Debug.Log("网络连接吃子后消息" + chessB.iGrid.posID); // 播放音效 PlayEatChessSound(); if (selfStage != GameStage.Over) { // 改变回合 ChangeGameRound(); } break; default: break; } break; case "Over": otherStage = GameStage.Over; break; default: break; } }
/// <summary> /// 该网格是否在游戏管理网格内 /// </summary> /// <param name="tmp"></param> /// <returns></returns> public bool hasTheIGrid(iGrid tmp) { return(iGridCluster.Contains(tmp)); }
void iGridCategory_AfterCommitEdit(object sender, iGAfterCommitEditEventArgs e) { iGrid _grid = sender as iGrid; if (_grid.Rows[e.RowIndex].Cells[0].Value != null) { _grid.Rows[e.RowIndex].Cells[0].Value = _grid.Rows[e.RowIndex].Cells[0].Value.ToProperCase(); } if (sender == iGridCategory) { #region Item Category if (_grid.Rows[e.RowIndex].Cells[0].Value == null) { if (_grid.Rows[e.RowIndex].Tag != null) { var _cg = _grid.Rows[e.RowIndex].Tag as ic.church_group_typeC; using (var xd = new xing()) { if (xd.ExecuteScalarInt("select TOP 1 cg_id from church_group_tb where cg_type_id=" + _cg.cg_type_id) == 0) { xd.SingleDeleteCommandExp("church_group_types_tb", new string[] { "cg_type_id" }, new int[] { _cg.cg_type_id }); xd.CommitTransaction(); } else { _grid.Rows[e.RowIndex].Cells[0].Value = _cg.cg_type_name; dbm.ErrorMessage("There Are Some Church Groups Which Are Attached To This Church Group Type", "Delete Operation Will Be Cancelled"); return; } } _grid.Rows[e.RowIndex].Tag = null; datam.DATA_CG_TYPES.Remove(_cg.cg_type_id); _grid.Rows.RemoveAt(e.RowIndex); this.Tag = 1; } return; } else { if (_grid.Rows[e.RowIndex].Tag == null) { //insert using (var xd = new xing()) { var ret_val = xd.ExecuteScalerInt(new string[] { "cg_type_name" }, string.Format("select count(cg_type_id) as cnt from church_group_types_tb where lower(cg_type_name)=@cg_type_name"), new object[] { _grid.Rows[e.RowIndex].Cells[0].Text.ToLower() }); if (ret_val > 0) { MessageBox.Show("You Have Already Entered This Item", "Duplicate Item Entry"); _grid.Rows[e.RowIndex].Cells[0].Value = null; return; } } var _cg = new ic.church_group_typeC(); using (var xd = new xing()) { _cg.cg_type_name = _grid.Rows[e.RowIndex].Cells[0].Text.ToProperCase(); _cg.cg_type_id = xd.SingleInsertCommandTSPInt("church_group_types_tb", new string[] { "cg_type_name", "fs_time_stamp", "lch_id" }, new object[] { _cg.cg_type_name, 0, datam.LCH_ID }); xd.CommitTransaction(); } _grid.Rows[e.RowIndex].Tag = _cg; datam.DATA_CG_TYPES.Add(_cg.cg_type_id, _cg); this.Tag = 1; } else { var _cg = _grid.Rows[e.RowIndex].Tag as ic.church_group_typeC; _cg.cg_type_name = _grid.Rows[e.RowIndex].Cells[0].Value.ToStringNullable(); using (var xd = new xing()) { xd.SingleUpdateCommandALL("church_group_types_tb", new string[] { "cg_type_name", "cg_type_id" }, new object[] { _cg.cg_type_name, _cg.cg_type_id }, 1); xd.CommitTransaction(); } this.Tag = 1; //update } Application.DoEvents(); using (var xd = new xing()) { datam.fill_church_group_types(xd); xd.CommitTransaction(); } } #endregion } if (((e.RowIndex + 1) == _grid.Rows.Count)) { AddRowX(_grid); } }