Esempio n. 1
0
        /// <summary>
        /// 添加字典信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void simpleButton4_Click(object sender, EventArgs e)
        {
            try
            {
                if (!this.dxValidationProvider2.Validate())
                {
                    return;
                }

                this.simpleButton4.Enabled = false;

                var infoEntity = new DictionaryInfo
                {
                    Name    = this.txtInfoName.Text.Trim(),
                    TypeId  = int.Parse((this.cbType.SelectedItem as ComboBoxItemModel).Value),
                    Remarks = txtInfoRemarks.Text.Trim()
                };

                if (_dictionaryService.IsExistedDictionaryInfo(infoEntity.TypeId, infoEntity.Name))
                {
                    DXMessage.ShowTips("该字典名称已经存在!");
                    this.simpleButton2.Enabled = true;
                    return;
                }

                _dictionaryService.AddDictionaryInfo(infoEntity);

                ResetInfoInput();

                BindDictionaryInfo(infoEntity.TypeId);
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
            finally
            {
                this.simpleButton4.Enabled = true;
            }
        }