Exemplo n.º 1
0
        /// <summary>
        /// 添加字典类型
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            try
            {
                if (!this.dxValidationProvider1.Validate())
                {
                    return;
                }

                this.simpleButton2.Enabled = false;

                var typeEntity = new DictionaryType
                {
                    Name    = this.txtTypeName.Text.Trim(),
                    Remarks = this.txtTypeRemarks.Text.Trim(),
                };

                if (_dictionaryService.GetDictionaryTypeIdByName(typeEntity.Name) > 0)
                {
                    DXMessage.ShowTips("该类型已经存在!");
                    this.simpleButton2.Enabled = true;
                    return;
                }

                _dictionaryService.AddDictionaryType(typeEntity);

                ResetTypeInput();

                this.BindDictionary();
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
            finally
            {
                this.simpleButton2.Enabled = true;
            }
        }