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(@"修改失败"); } } }
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(@"修改失败"); } } }
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(@"修改失败"); } } }
/// <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.只读); }
/// <summary>明细表行变化事件 /// /// </summary> /// <param name="sender">sender</param> /// <param name="e">e</param> private void objListViewDetail_SelectedIndexChanged(object sender, EventArgs e) { if (objListViewDetail.SelectedObjects.Count == 0) { return; } BseModule model = objListViewDetail.SelectedObjects[0] as BseModule; if (model != null) { EntityOperateManager.BindAll(this.grpDetail, model); } }
private void btnSave_Click(object sender, EventArgs e) { string strReturnMsg = CheckInput(); if (strReturnMsg != string.Empty) { MessageBox.Show(strReturnMsg); return; } //新增 if (m_BseDictionary == null) { BseDictionary model = EntityOperateManager.AddEntity <BseDictionary>(this.tabPage); model.ParentID = m_intParentId; int intReturn = m_BseDictionaryDAL.Add(model); if (intReturn > 0) { MessageBox.Show(@"添加成功"); model.Id = intReturn; m_lstBseDictionary.Add(model); ListBseDictionary = m_lstBseDictionary; this.DialogResult = DialogResult.OK; } else { MessageBox.Show(@"添加失败"); } } //修改 else { m_BseDictionary = EntityOperateManager.EditEntity(this.tabPage, m_BseDictionary); bool blnReturn = m_BseDictionaryDAL.Update(m_BseDictionary); if (blnReturn) { MessageBox.Show(@"修改成功"); ListBseDictionary = m_lstBseDictionary; this.DialogResult = DialogResult.OK; } else { MessageBox.Show(@"修改失败"); } } }
/// <summary>保存明细表 /// /// </summary> private void DoSaveDetail() { string strMsg = DoCheckDetail(EntityOperationType.只读明细); if (strMsg != string.Empty) { MessageBox.Show(strMsg); return; } switch (m_detailStatus) { case EntityOperationType.新增明细: BseModule model = EntityOperateManager.AddEntity <BseModule>(this.grpDetail); model.ProjectID = m_BseProject.ProjectID; int intReturn = m_BseModuleDAL.Add(model); if (intReturn > 0) { model.ModuleID = intReturn; m_lstBseModule.Add(model); ListBseModule = m_lstBseModule; objListViewDetail.SetObjects(m_lstBseModule); objListViewDetail.Refresh(); objListViewDetail.SelectedIndex = m_lstBseModule.Count - 1; } break; case EntityOperationType.修改明细: BseModule modelDetail = this.objListViewDetail.SelectedObjects[0] as BseModule; EntityOperateManager.EditEntity(this.grpDetail, modelDetail); bool blnReturn = m_BseModuleDAL.Update(modelDetail); if (blnReturn) { ListBseModule = m_lstBseModule; } break; } SetMode(EntityOperationType.只读明细); }
/// <summary>实体对象值显示至控件 /// /// </summary> /// <param name="model">model</param> private void DisplayData(CacheConfig model) { EntityOperateManager.BindAll(this.tabPage, model); }
/// <summary>实体对象值显示至控件 /// /// </summary> /// <param name="model">model</param> private void DisplayData(BseUrl model) { EntityOperateManager.BindAll(this.tabPage, model); }
/// <summary>实体对象值显示至控件 /// /// </summary> /// <param name="model">model</param> private void DisplayData(BseProject model) { EntityOperateManager.BindAll(this.grpMaster, model); }