//新增信息 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 = dsMain.Tables[0].NewRow(); newrow["InPut_Time"] = DateTime.Now; if (objShiftID != null && objTeamID != null) { newrow["TeamID"] = objTeamID.ToString(); newrow["ShiftID"] = objShiftID.ToString(); } newrow["Operator"] = Adapter.Session.User; dsMain.Tables[0].Rows.Add(newrow); bsMain.MoveFirst();// while (((System.Data.DataRowView)(bsMain.Current)).Row != newrow && bsMain.Position != dsMain.Tables[0].Rows.Count - 1) { bsMain.MoveNext(); } VacTubeUseMagShowFrm frm = new VacTubeUseMagShowFrm(); frm.ShowDialogEx(Adapter.Session, bsMain.Position, strSortMain, ref dsMain); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
//修改信息 private void dvMain_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0 && dsMain.Tables[0].Rows.Count > 0) { bsMain.Position = e.RowIndex; VacTubeUseMagShowFrm frm = new VacTubeUseMagShowFrm(); frm.ShowDialogEx(Adapter.Session, bsMain.Position, strSortMain, ref dsMain); } }