예제 #1
0
        //修改主信息
        private void dvMain_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (dvMain.RowCount > 0)
            {
                dsChange = dsMain.Clone();
                dsChange.Tables[0].ImportRow(((System.Data.DataRowView)(bsMain.Current)).Row);

                EquipAdjustMainFrm FrmMain = new EquipAdjustMainFrm();
                FrmMain.ShowDialogEx(Adapter.Session, ref dsChange);

                if (dsChange.Tables[0].Rows.Count > 0)
                {
                    dvMain.CurrentRow.Cells["locationDataGridViewTextBoxColumn"].Value    = dsChange.Tables[0].Rows[0]["Location"];
                    dvMain.CurrentRow.Cells["locationDesDataGridViewTextBoxColumn"].Value = dsChange.Tables[0].Rows[0]["Location_Des"];
                    dvMain.CurrentRow.Cells["meterDataGridViewTextBoxColumn"].Value       = dsChange.Tables[0].Rows[0]["Meter"];
                    dvMain.CurrentRow.Cells["meterSizeDataGridViewTextBoxColumn"].Value   = dsChange.Tables[0].Rows[0]["Meter_Size"];
                    dvMain.CurrentRow.Cells["rangeDataGridViewTextBoxColumn"].Value       = dsChange.Tables[0].Rows[0]["Range"];
                    dvMain.CurrentRow.Cells["precisionDataGridViewTextBoxColumn"].Value   = dsChange.Tables[0].Rows[0]["Precision"];
                    dvMain.CurrentRow.Cells["factoryDataGridViewTextBoxColumn"].Value     = dsChange.Tables[0].Rows[0]["Factory"];
                    dvMain.CurrentRow.Cells["measureIDDataGridViewTextBoxColumn"].Value   = dsChange.Tables[0].Rows[0]["Measure_ID"];
                    dvMain.CurrentRow.Cells["standardEquDataGridViewTextBoxColumn"].Value = dsChange.Tables[0].Rows[0]["Standard_Equ"];
                    dvMain.CurrentRow.Cells["scaleMinDataGridViewTextBoxColumn"].Value    = dsChange.Tables[0].Rows[0]["Scale_Min"];

                    dvMain.CurrentRow.Cells["operatorDataGridViewTextBoxColumn"].Value  = dsChange.Tables[0].Rows[0]["Operator"];
                    dvMain.CurrentRow.Cells["checkDateDataGridViewTextBoxColumn"].Value = dsChange.Tables[0].Rows[0]["Check_Date"];
                    dvMain.CurrentRow.Cells["resultDataGridViewTextBoxColumn"].Value    = dsChange.Tables[0].Rows[0]["Result"];
                }
                GC.Collect();
            }
        }
예제 #2
0
        //新增主信息
        private void btnAddMain_Click(object sender, EventArgs e)
        {
            try
            {
                //添加一行数据,对相应数据进行填充
                dsChange = dsMain.Clone();

                EquipAdjustMainFrm FrmMain = new EquipAdjustMainFrm();
                FrmMain.ShowDialogEx(Adapter.Session, ref dsChange);

                if (dsChange.Tables[0].Rows.Count > 0)
                {
                    DataRow row = dsChange.Tables[0].Rows[0];
                    dsMain.Tables[0].ImportRow(row);
                }
                GC.Collect();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }