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; using SWGDBHelper; using System.Text.RegularExpressions; namespace SWGDBSysManager { public partial class frmAddCCCode : DevExpress.XtraEditors.XtraForm { string oldName = ""; public frmAddCCCode() { InitializeComponent(); } public void IntiData(string name, string code) { this.textCCCode.Text = code; this.textName.Text = name; oldName = name; this.textCCCode.Enabled = false; } public string CCCode { get { return this.textCCCode.Text; } } public string ClassifyName { get { return this.textName.Text; } } private void btnCancle_Click-114(object sender, EventArgs e) { this.Close();114xiuggai } private void btnSave_Click(object sender, EventArgs e) { if (!CheckConfirm()) { return; } if (oldName != "" && oldName == this.textName.Text) { DevHelper.ShowInfo("未做任何修改!"); return; } this.DialogResult = DialogResult.OK; } private bool CheckConfirm() { if (string.IsNullOrEmpty(this.textName.Text)) { DevHelper.ShowError("分类名称不能为空!"); return false; } if (string.IsNullOrEmpty(this.textCCCode.Text)) { DevHelper.ShowError("国标CC码不能为空!"); return false; } if (!Regex.IsMatch(this.textCCCode.Text, @"^\d{4}$")) { DevHelper.ShowError("国标CC码必须为四位数字!"); return false; } return true; } } }