//修改主信息 private void dvMain_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex >= 0 && dsMain.Tables[0].Rows.Count > 0) { bsMain.Position = e.RowIndex; ComLadleTieShowFrm FrmMain = new ComLadleTieShowFrm(); FrmMain.ShowDialogEx(Adapter.Session, strSortMain, bsMain.Position, ref dsMain); GC.Collect(); } }
//新增主信息 private void btnAddMain_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 = dsMain.Tables[0].NewRow(); newrow["Input_Time"] = DateTime.Now; newrow["Tie_Start_Time"] = DateTime.Now; //newrow["Tie_End_Time"] = DateTime.Now; //newrow["Doff_Mod_Time"] = DateTime.Now; //newrow["Fire_Start_Time"] = DateTime.Now; //newrow["Fire_End_Time"] = DateTime.Now; //newrow["Thr_Ladle_Time"] = DateTime.Now; if (objShiftID != null && objTeamID != null) { newrow["TeamID"] = objTeamID.ToString(); newrow["ShiftID"] = objShiftID.ToString(); } newrow["Operator"] = Adapter.Session.User; newrow["Note"] = ""; dsMain.Tables[0].Rows.Add(newrow); bsMain.MoveFirst(); while ((bsMain.Current as System.Data.DataRowView).Row != newrow || bsMain.Position < dsMain.Tables[0].Rows.Count - 1) { bsMain.MoveNext(); } ComLadleTieShowFrm FrmMain = new ComLadleTieShowFrm(); FrmMain.ShowDialogEx(Adapter.Session, strSortMain, bsMain.Position, ref dsMain); GC.Collect(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }