Example #1
0
        private void Paramenter_TextChanged(object sender, TextChangedEventArgs e)
        {
            string input = ((TextBox)sender).Text.Trim();
            string acronym;

            if (input != null && input.Length > 0)
            {
                acronym = CommonTool.CaptureUpperCase(input);
                cmdService.ShuffleList(acronym);
            }
            int count = this.RecList.Items.Count;

            if (count > 0)
            {
                this.Popup.IsOpen = true;
            }
            else
            {
                this.Popup.IsOpen = false;
            }
        }
Example #2
0
        private void Save(object sender, RoutedEventArgs e)
        {
            string name    = (this.Name.Text != null) ? this.Name.Text.Trim().Replace(" ", "") : null;
            string sql     = String.Format("SELECT count(*) from parameter where tag = '{0}'", name);
            int    nameCnt = accesser.GetCount(sql);

            sql = String.Format("SELECT count(*) from parameter where para = '{0}'", Parameter);
            int ParaCnt = accesser.GetCount(sql);

            if (name == null || name.Length == 0)
            {
                MessageBox.Show("请输入正确的变量名称以便保存");
            }
            else if (nameCnt > 0)
            {
                MessageBox.Show("名称已存在");
            }
            else if (ParaCnt > 0)
            {
                MessageBox.Show("参数已存在,不要重复保存");
            }
            else
            {
                sql = String.Format("insert into Parameter(tag,para,capital) values('{0}','{1}','{2}')", name, Parameter, CommonTool.CaptureUpperCase(name));
                int result = accesser.Update(sql);
                if (result == 1)
                {
                    MessageBox.Show("保存成功");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("保存失败!");
                    this.Close();
                }
            }
        }