Exemple #1
0
        /// <summary>编辑
        ///
        /// </summary>
        private void DoEdit()
        {
            string strMsg = CheckSelect("修改");

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

            if (model == null)
            {
                int intKeyID = int.Parse(drRowEdit.Cells[gridmrzId.Name].Value.ToString());
                model = m_CacheConfigDAL.GetModel(intKeyID);
            }
            if (model != null)
            {
                FrmCacheConfigSimpleDialog frmDialog = new FrmCacheConfigSimpleDialog(model, m_lstCacheConfig);
                if (frmDialog.ShowDialog() == DialogResult.OK)
                {
                    m_lstCacheConfig   = frmDialog.ListCacheConfig;
                    grdData.DataSource = m_lstCacheConfig;
                    grdData.Refresh();
                }
            }
        }
Exemple #2
0
        /// <summary>新增
        ///
        /// </summary>
        private void DoNew()
        {
            FrmCacheConfigSimpleDialog frmDialog = new FrmCacheConfigSimpleDialog(null, m_lstCacheConfig);

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