Ejemplo n.º 1
0
        /// <summary>编辑
        ///
        /// </summary>
        private void DoEdit()
        {
            string strMsg = CheckSelect("修改");

            if (strMsg != string.Empty)
            {
                MessageBox.Show(strMsg);
                return;
            }
            DataGridViewRow drRowEdit = grdData.SelectedRows[0];
            CacheTables     model     = drRowEdit.Tag as   CacheTables;

            if (model == null)
            {
                int intKeyID = int.Parse(drRowEdit.Cells[gridmrzId.Name].Value.ToString());
                model = m_CacheTablesDAL.GetModel(intKeyID);
            }
            if (model != null)
            {
                FrmCacheTablesSimpleDialog frmDialog = new       FrmCacheTablesSimpleDialog(model, m_lstCacheTables);
                if (frmDialog.ShowDialog() == DialogResult.OK)
                {
                    m_lstCacheTables   = frmDialog.ListCacheTables;
                    grdData.DataSource = m_lstCacheTables;
                    grdData.Refresh();
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>新增
        ///
        /// </summary>
        private void DoNew()
        {
            FrmCacheTablesSimpleDialog frmDialog = new   FrmCacheTablesSimpleDialog(null, m_lstCacheTables);

            if (frmDialog.ShowDialog() == DialogResult.OK)
            {
                m_lstCacheTables = frmDialog.ListCacheTables;
                if (grdData.DataSource != null)
                {
                    this.BindingContext[grdData.DataSource].SuspendBinding();
                }
                grdData.DataSource = null;
                grdData.DataSource = m_lstCacheTables;
                this.BindingContext[grdData.DataSource].ResumeBinding();
            }
        }