Gogs hace 3 años
padre
commit
ec1890e38d
Se han modificado 2 ficheros con 195 adiciones y 0 borrados
  1. 75 0
      frmAddCCCode.cs
  2. 120 0
      frmAddValue.cs

+ 75 - 0
frmAddCCCode.cs

@@ -0,0 +1,75 @@
+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(object sender, EventArgs e)
+        {
+            this.Close();
+        }
+
+        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;
+        }
+    }
+}

+ 120 - 0
frmAddValue.cs

@@ -0,0 +1,120 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using DevExpress.XtraEditors;
+using System.IO;
+using SWGDBHelper;
+
+namespace SWGDBSysManager
+{
+    public partial class frmAddValue : DevExpress.XtraEditors.XtraForm
+    {
+        Dictionary<string, string> mpGBCodes;
+        string mstrValue = "";
+        string mstrDescri = "";
+        string mstrStylePath = "";
+        public frmAddValue(Dictionary<string, string> pGBCodes)
+        {
+            InitializeComponent();
+            mpGBCodes = pGBCodes;
+            chB_DefaultStyle_CheckedChanged(null,null);
+        }
+
+        private void txtValue_EditValueChanged(object sender, EventArgs e)
+        {
+            string value = this.txtValue.Text.Trim();
+            if (mpGBCodes.ContainsKey(value))
+                this.txtDescri.Text = mpGBCodes[value];
+        }
+
+        private void btnOk_Click(object sender, EventArgs e)
+        {
+            mstrValue = this.txtValue.Text.Trim();
+            mstrDescri = this.txtDescri.Text.Trim();
+            if (this.btnEdStyle.Text == "")
+            {
+                DevHelper.ShowInfo(this, "请选择符号库!");
+                return;
+            }
+            mstrStylePath = this.btnEdStyle.Text;
+            this.DialogResult = DialogResult.OK;
+            this.Close();
+        }
+
+        private void btnCancel_Click(object sender, EventArgs e)
+        {
+            this.DialogResult = DialogResult.Cancel;
+            this.Close();
+        }
+
+        /// <summary>
+        /// 符号化字段的值
+        /// </summary>
+        public string FieldValue
+        {
+            get
+            {
+                return mstrValue;
+            }
+        }
+
+        /// <summary>
+        /// 字段值得描述
+        /// </summary>
+        public string ValueDesci
+        {
+            get
+            {
+                return mstrDescri;
+            }
+        }
+
+        /// <summary>
+        /// 符号库路径
+        /// </summary>
+        public string StylePath
+        {
+            get
+            {
+                return mstrStylePath;
+            }
+        }
+
+        private void btnEdStyle_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
+        {
+            OpenFileDialog dlg = new OpenFileDialog();
+            //dlg.RestoreDirectory = true;
+            dlg.InitialDirectory = Application.StartupPath + "\\Style\\";
+            dlg.CheckFileExists = true;
+            dlg.Multiselect = false;
+            dlg.ShowHelp = false;
+            dlg.Filter = "符号库文件(*.style)|*.style";
+            if (dlg.ShowDialog() == DialogResult.OK)
+            {
+                this.btnEdStyle.Text = dlg.FileName;
+            }
+        }
+
+        private void chB_DefaultStyle_CheckedChanged(object sender, EventArgs e)
+        {
+            btnEdStyle.Text = "";
+            if (chB_DefaultStyle.Checked)
+            {
+                if (File.Exists(Application.StartupPath + "\\Style\\DLGQ10K.style"))
+                {
+                    btnEdStyle.Text = Application.StartupPath + "\\Style\\DLGQ10K.style";
+                }
+                else
+                {
+                    DevHelper.ShowWaring("缺失系统文件:" + Application.StartupPath + "\\Style\\DLGQ10K.style");
+                    chB_DefaultStyle.Checked = false;
+                }
+            }
+            btnEdStyle.Enabled = !chB_DefaultStyle.Checked;
+        }
+    }
+}