//修改 private void dvMain_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex >= 0 && dsUseInfo.Tables[0].Rows.Count > 0) { bsUseInfo.Position = e.RowIndex; IronLadleUseShowFrm Frm = new IronLadleUseShowFrm(); Frm.ShowDialogEx(Adapter.Session, bsUseInfo.Position, strSort, ref dsUseInfo); GC.Collect(); } }
//新增 private void btnAdd_Click(object sender, EventArgs e) { try { Adapter.Session.Get(CommDataMag.CommonData.CCURRENT_SHIFT_INFO_OBJ, "ShiftID", ref objShiftID); Adapter.Session.Get(CommDataMag.CommonData.CCURRENT_SHIFT_INFO_OBJ, "TeamID", ref objTeamID); //添加一行数据,对相应数据进行填充 DataRow newrow = dsUseInfo.Tables[0].NewRow(); newrow["Input_Time"] = DateTime.Now; newrow["IronLadleID"] = ""; newrow["Check_Time"] = DateTime.Now; newrow["IronLadle_Age"] = 0; newrow["Wall_TEMP"] = 0; newrow["Bottom_TEMP"] = 0; newrow["Stop_Reason"] = ""; if (objShiftID != null && objTeamID != null) { newrow["TeamID"] = objTeamID.ToString(); newrow["ShiftID"] = objShiftID.ToString(); } newrow["Operator"] = Adapter.Session.User; newrow["Note"] = ""; dsUseInfo.Tables[0].Rows.Add(newrow); bsUseInfo.MoveFirst();//光标移动到最后一行 while (((System.Data.DataRowView)(bsUseInfo.Current)).Row != newrow && bsUseInfo.Position != dsUseInfo.Tables[0].Rows.Count - 1) { bsUseInfo.MoveNext(); } IronLadleUseShowFrm Frm = new IronLadleUseShowFrm(); Frm.ShowDialogEx(Adapter.Session, bsUseInfo.Position, strSort, ref dsUseInfo); GC.Collect(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }