コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string strReturnMsg = CheckInput();

            if (strReturnMsg != string.Empty)
            {
                MessageBox.Show(strReturnMsg);
                return;
            }
            //新增
            if (m_BseProject == null)
            {
                string strNameValue = txtEditName.Text.Trim()
                ;
                if (m_BseProjectDAL.CalcCount("Name='" + strNameValue + "'") > 0)
                {
                    MessageBox.Show(@"项目名称已经存在");
                    return;
                }

                BseProject model     = EntityOperateManager.AddEntity <BseProject>(this.tabPage);
                int        intReturn = m_BseProjectDAL.Add(model);
                if (intReturn > 0)
                {
                    MessageBox.Show(@"添加成功");
                    model.ProjectID = intReturn;
                    m_lstBseProject.Add(model);
                    ListBseProject    = m_lstBseProject;
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show(@"添加失败");
                }
            }
            //修改
            else
            {
                string strNameValue = txtEditName.Text.Trim()
                ;
                if (m_BseProjectDAL.CalcCount(" ProjectID !=" + m_BseProject.ProjectID + "   and  Name='" + strNameValue + "'") > 0)
                {
                    MessageBox.Show(@"项目名称已经存在");
                    return;
                }

                m_BseProject = EntityOperateManager.EditEntity(this.tabPage, m_BseProject);
                bool blnReturn = m_BseProjectDAL.Update(m_BseProject);
                if (blnReturn)
                {
                    MessageBox.Show(@"修改成功");
                    ListBseProject    = m_lstBseProject;
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show(@"修改失败");
                }
            }
        }
コード例 #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string strReturnMsg = CheckInput();

            if (strReturnMsg != string.Empty)
            {
                MessageBox.Show(strReturnMsg);
                return;
            }
            //新增
            if (m_CacheConfig == null)
            {
                string strTableNameValueNew = cboEditTableName.SelectedValue.ToString().Trim();
                if (m_CacheConfigDAL.CalcCount("TableName='" + strTableNameValueNew + "'") > 0)
                {
                    MessageBox.Show(@"表名已经存在");
                    return;
                }

                CacheConfig model = EntityOperateManager.AddEntity <CacheConfig>(this.tabPage);
                model.CacheChekGuid  = Guid.NewGuid().ToString();
                model.CacheTableName = Guid.NewGuid().ToString();
                int intReturn = m_CacheConfigDAL.Add(model);
                if (intReturn > 0)
                {
                    MessageBox.Show(@"添加成功");
                    model.Id = intReturn;
                    m_lstCacheConfig.Add(model);
                    ListCacheConfig   = m_lstCacheConfig;
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show(@"添加失败");
                }
            }
            //修改
            else
            {
                string strTableNameValueEdit = cboEditTableName.SelectedValue.ToString().Trim();
                if (m_CacheConfigDAL.CalcCount(" Id !=" + m_CacheConfig.Id + "   and  TableName='" + strTableNameValueEdit + "'") > 0)
                {
                    MessageBox.Show(@"表名已经存在");
                    return;
                }

                m_CacheConfig = EntityOperateManager.EditEntity(this.tabPage, m_CacheConfig);
                bool blnReturn = m_CacheConfigDAL.Update(m_CacheConfig);
                if (blnReturn)
                {
                    MessageBox.Show(@"修改成功");
                    ListCacheConfig   = m_lstCacheConfig;
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show(@"修改失败");
                }
            }
        }
コード例 #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string strReturnMsg = CheckInput();

            if (strReturnMsg != string.Empty)
            {
                MessageBox.Show(strReturnMsg);
                return;
            }
            //新增
            if (m_CacheSetting == null)
            {
                string strSetKeyValueNew = txtEditSetKey.Text.Trim();
                if (m_CacheSettingDAL.CalcCount("SetKey='" + strSetKeyValueNew + "'") > 0)
                {
                    MessageBox.Show(@"设置键已经存在");
                    return;
                }

                CacheSetting model     = EntityOperateManager.AddEntity <CacheSetting>(this.tabPage);
                int          intReturn = m_CacheSettingDAL.Add(model);
                if (intReturn > 0)
                {
                    MessageBox.Show(@"添加成功");
                    model.Id = intReturn;
                    m_lstCacheSetting.Add(model);
                    ListCacheSetting  = m_lstCacheSetting;
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show(@"添加失败");
                }
            }
            //修改
            else
            {
                string strSetKeyValueEdit = txtEditSetKey.Text.Trim();
                if (m_CacheSettingDAL.CalcCount(" Id !=" + m_CacheSetting.Id + "   and  SetKey='" + strSetKeyValueEdit + "'") > 0)
                {
                    MessageBox.Show(@"设置键已经存在");
                    return;
                }

                m_CacheSetting = EntityOperateManager.EditEntity(this.tabPage, m_CacheSetting);
                bool blnReturn = m_CacheSettingDAL.Update(m_CacheSetting);
                if (blnReturn)
                {
                    MessageBox.Show(@"修改成功");
                    ListCacheSetting  = m_lstCacheSetting;
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show(@"修改失败");
                }
            }
        }
コード例 #4
0
        /// <summary>保存主表
        ///
        /// </summary>
        private void DoSave()
        {
            string strMsg = DoCheckMaster();

            if (strMsg != string.Empty)
            {
                MessageBox.Show(strMsg);
                return;
            }
            switch (m_masterStatus)
            {
            case EntityOperationType.新增:
                string strNameValueNew = txtEditName.Text.Trim();
                if (m_BseProjectDAL.CalcCount("Name='" + strNameValueNew + "'") > 0)
                {
                    MessageBox.Show(@"名称已经存在");
                    return;
                }

                BseProject model     = EntityOperateManager.AddEntity <BseProject>(this.grpMaster);
                int        intReturn = m_BseProjectDAL.Add(model);
                if (intReturn > 0)
                {
                    m_BseProject    = model;
                    model.ProjectID = intReturn;
                    m_lstBseProject.Add(model);
                    ListBseProject = m_lstBseProject;
                    //清空明细列表
                    m_lstBseModule.Clear();
                    objListViewDetail.SetObjects(m_lstBseModule);
                    objListViewDetail.Refresh();
                }
                break;

            case EntityOperationType.修改:
                string strNameValueEdit = txtEditName.Text.Trim();
                if (m_BseProjectDAL.CalcCount(" ProjectID !=" + m_BseProject.ProjectID + "   and  Name='" + strNameValueEdit + "'") > 0)
                {
                    MessageBox.Show(@"名称已经存在");
                    return;
                }

                m_BseProject = EntityOperateManager.EditEntity(this.grpMaster, m_BseProject);
                bool blnReturn = m_BseProjectDAL.Update(m_BseProject);
                if (blnReturn)
                {
                    ListBseProject = m_lstBseProject;
                }
                break;
            }
            SetMode(EntityOperationType.只读);
        }
コード例 #5
0
 /// <summary>执行查询
 ///
 /// </summary>
 private void DoQueryData()
 {
     try
     {
         btnQuery.Enabled = false;
         string strWhere = GetSearchSql();
         m_lstBseProject   = m_BseProjectDAL.GetListArray("*", "ProjectID", "ASC", Pager.PageSize, Pager.PageIndex, strWhere);
         Pager.RecordCount = m_BseProjectDAL.CalcCount(strWhere);
         Pager.InitPageInfo();
         grdData.DataSource = m_lstBseProject;
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         btnQuery.Enabled = true;
     }
 }
コード例 #6
0
 /// <summary>执行查询
 ///
 /// </summary>
 private void DoQueryData()
 {
     try
     {
         btnQuery.Enabled = false;
         string strWhere = GetSearchSql();
         m_lstBseProject   = m_BseProjectDAL.GetListArray("*", "ProjectID", "ASC", Pager.PageSize, Pager.PageIndex, strWhere);
         Pager.RecordCount = m_BseProjectDAL.CalcCount(strWhere);
         Pager.InitPageInfo();
         objListViewMaster.SetObjects(m_lstBseProject);
         if (m_lstBseProject.Count > 0)
         {
             objListViewMaster.SelectedIndex = 0;
         }
     }
     finally
     {
         btnQuery.Enabled = true;
     }
 }
コード例 #7
0
 /// <summary>执行查询
 ///
 /// </summary>
 private void DoQueryData()
 {
     try
     {
         btnQuery.Enabled = false;
         string strWhere = GetSearchSql();
         m_lstBseDictionary = m_BseDictionaryDAL.GetListArray("*", "Id", "ASC", Pager.PageSize, Pager.PageIndex, strWhere);
         Pager.RecordCount  = m_BseDictionaryDAL.CalcCount(strWhere);
         Pager.InitPageInfo();
         dataTreeListView.DataSource = m_lstBseDictionary;
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         btnQuery.Enabled = true;
     }
 }