//新增信息 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; newrow["On_Time"] = DateTime.Now; if (objShiftID != null && objTeamID != null) { newrow["On_TeamID"] = objTeamID.ToString(); newrow["On_ShiftID"] = objShiftID.ToString(); } newrow["On_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(); } HotSypUseMagShowFrm frm = new HotSypUseMagShowFrm(); frm.ShowDialogEx(Adapter.Session, bsMain.Position, strSort, ref dsMain); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
//修改信息 private void dvM_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0 && dsMain.Tables[0].Rows.Count > 0) { bsMain.Position = e.RowIndex; HotSypUseMagShowFrm frm = new HotSypUseMagShowFrm(); frm.ShowDialogEx(Adapter.Session, bsMain.Position, strSort, ref dsMain); } }