using Lskj.Core; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Lskj.Control.SiftColControl { public partial class FrmGridSiftProjectAdd : BaseForm { private string CustomColumKey; private string UserId; public string ProjectName { get { return this.projectEdit.Text; } } public int IsPub { get { return this.isPubCheck.Checked ? 0 : 1; } } public FrmGridSiftProjectAdd(string _customColumKey, string _userId) { this.CustomColumKey = _customColumKey; this.UserId = _userId; InitializeComponent(); } /// /// 确定按钮点击时 /// /// /// private void okBtn_Click(object sender, EventArgs e) { string sqlStr = @"select name from p_SysModuleSchemeTab where moduleId = '{0}' and operatorid = '{1}' and isPub = '0' union all select name from p_SysModuleSchemeTab where moduleId = '{0}' and isPub = '1'"; DataTable sourceTab = SqlHelper.ExecuteDataTable(string.Format(sqlStr, this.CustomColumKey, this.UserId)); if (sourceTab.Select().Where(n => n["name"].Equals(ProjectName)).Count() > 0) { MessageUtil.Show("方案名重复,请重新输入!"); return; } this.DialogResult = DialogResult.OK; } } }