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];
            CacheSetting    model     = drRowEdit.Tag as   CacheSetting;

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

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