private void dvDetail_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0 && dsDetail.Tables[0].Rows.Count > 0) { bsDetail.Position = e.RowIndex; VacTubeRepairShowFrm FrmDetail = new VacTubeRepairShowFrm(); FrmDetail.ShowDialogEx(Adapter.Session, bsDetail.Position, strSortDetail, ref dsDetail); GC.Collect(); } }
private void btnAddDetail_Click(object sender, EventArgs e) { try { if (strBuildID == "") { return; } 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 = dsDetail.Tables[0].NewRow(); newrow["Input_Time"] = DateTime.Now; newrow["Build_ID"] = strBuildID; newrow["VacTube_Name"] = strName; newrow["VacTube_Id"] = strID; if (objShiftID != null && objTeamID != null) { newrow["TeamID"] = objTeamID.ToString(); newrow["ShiftID"] = objShiftID.ToString(); } newrow["Repair_Per"] = Adapter.Session.User; newrow["Note"] = ""; dsDetail.Tables[0].Rows.Add(newrow); bsDetail.MoveFirst(); while ((bsDetail.Current as System.Data.DataRowView).Row != newrow || bsDetail.Position < dsDetail.Tables[0].Rows.Count - 1) { bsDetail.MoveNext(); } VacTubeRepairShowFrm FrmDetail = new VacTubeRepairShowFrm(); FrmDetail.ShowDialogEx(Adapter.Session, bsDetail.Position, strSortDetail, ref dsDetail); GC.Collect(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }