예제 #1
0
 //修改详细信息
 private void dvDetail_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e.RowIndex >= 0 && dsDetail.Tables[0].Rows.Count > 0)
     {
         bsDetail.Position = e.RowIndex;
         DisExcepitonalItemsShowFrm FrmDetail = new DisExcepitonalItemsShowFrm();
         FrmDetail.ShowDialogEx(Adapter.Session, strSortDetail, bsDetail.Position, ref dsDetail);
         GC.Collect();
     }
 }
예제 #2
0
        //新增详细信息
        private void btnAddDetail_Click(object sender, EventArgs e)
        {
            try
            {
                if (strCurIDObject == "" || strCurUnitID == "")
                {
                    return;
                }

                //添加一行数据,对相应数据进行填充
                DataRow newrow = dsDetail.Tables[0].NewRow();

                newrow["IDObject"]   = strCurIDObject;
                newrow["UnitID"]     = strCurUnitID;
                newrow["BeginTime"]  = DateTime.Now.ToString("HH:mm:ss");
                newrow["EndTime"]    = DateTime.Now.ToString("HH:mm:ss");
                newrow["TimeSpan"]   = 0;
                newrow["CreateTime"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                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();
                }
                DisExcepitonalItemsShowFrm FrmDetail = new DisExcepitonalItemsShowFrm();
                FrmDetail.ShowDialogEx(Adapter.Session, strSortDetail, bsDetail.Position, ref dsDetail);
                GC.Collect();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }