Beispiel #1
0
        private void btn_editOperation_Click(object sender, EventArgs e)
        {
            try
            {
                if (gridViewOper.FocusedRowHandle < 0)
                {
                    DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("请选中一条记录");
                    return;
                }
                DataRow dataRow = gridViewOper.GetDataRow(gridViewOper.FocusedRowHandle);
                if (dataRow == null)
                {
                    DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("请选中一条记录");
                    return;
                }
                DataTable dataTableOper = this.gridControl2.DataSource as DataTable;
                DataTable dataTable     = new DataTable();
                dataTable = dataTableOper.Clone();
                dataTable.ImportRow(dataRow);

                OperInfo m_OperInfoFrom = new OperInfo(m_App, "edit", dataTable);

                m_OperInfoFrom.ShowDialog();
                if (m_OperInfoFrom.DialogResult == DialogResult.OK)
                {
                    m_OperInfoFrom.IemOperInfo = null;

                    dataTableOper.Rows.Remove(dataRow);
                    foreach (DataRow row in m_OperInfoFrom.DataOper.Rows)
                    {
                        dataTableOper.ImportRow(row);
                    }
                    gridControl2.BeginUpdate();
                    this.gridControl2.DataSource = dataTableOper;

                    gridControl2.EndUpdate();
                    m_App.PublicMethod.ConvertGridDataSourceUpper(gridViewOper);
                }
            }
            catch (Exception ex)
            {
                DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex);
            }
        }
Beispiel #2
0
        private void btn_addOperation_Click(object sender, EventArgs e)
        {
            try
            {
                OperInfo m_OperInfoFrom = new OperInfo(m_App, "new", null);
                m_OperInfoFrom.ShowDialog();
                if (m_OperInfoFrom.DialogResult == DialogResult.OK)
                {
                    m_OperInfoFrom.IemOperInfo = null;
                    DataTable dataTable = m_OperInfoFrom.DataOper;

                    DataTable dataTableOper = new DataTable();
                    if (this.gridControl2.DataSource != null)
                    {
                        dataTableOper = this.gridControl2.DataSource as DataTable;
                    }
                    if (dataTableOper.Rows.Count == 0)
                    {
                        dataTableOper = dataTable.Clone();
                    }
                    foreach (DataRow row in dataTable.Rows)
                    {
                        dataTableOper.ImportRow(row);
                    }
                    gridControl2.BeginUpdate();
                    this.gridControl2.DataSource = dataTableOper;

                    gridControl2.EndUpdate();
                    m_App.PublicMethod.ConvertGridDataSourceUpper(gridViewOper);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }