Esempio n. 1
0
        private void btn_NewParam_Click(object sender, EventArgs e)
        {
            try
            {
                Parm_Type _new_pt = (Parm_Type)Enum.Parse(typeof(Parm_Type), cmb_ParamType.Text);
                string    _new_pn = txt_ParamName.Text;

                if (string.IsNullOrEmpty(_new_pn))
                {
                    MessageBox.Show("請填入參數名稱", "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                IEnumerable <Param> _exist_Param = List_Params.Where(p => p.ParamName.ToLower() == _new_pn.ToLower());
                if (_exist_Param.Any())
                {
                    MessageBox.Show("參數已存在", "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                List_Params.Add(new Param()
                {
                    ParamType = _new_pt, ParamName = _new_pn
                });

                txt_ParamName.Text = string.Empty;
            }
            catch (Exception ex)
            {
                Class_Log.Write_Log(Log_Type.Error, "btn_NewParam_Click", ex.ToString());
            }
        }
Esempio n. 2
0
 public Param()
 {
     _ParamType = Parm_Type.String;
     _ParamName = string.Empty;
 }