Exemple #1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                this.btnOk.Enabled = false;

                if (!InputCheck())
                {
                    return;
                }

                //添加
                if (!this._isEdit)
                {
                    var reasonContent = new DecisionReasonContent();

                    reasonContent.CategoryId = int.Parse(this.treeListLookUpEdit1.SelectedValue());
                    reasonContent.Content    = this.memoContent.Text.Trim();
                    reasonContent.Title      = this.txtTitle.Text.Trim();
                    reasonContent.Remarks    = null;

                    _IDService.AddIDReasonContent(reasonContent);
                }
                //修改
                else
                {
                    var reasonContent = _IDService.GetIDReasonContent(ContentId);
                    reasonContent.CategoryId = int.Parse(this.treeListLookUpEdit1.SelectedValue());
                    reasonContent.Content    = this.memoContent.Text.Trim();
                    reasonContent.Title      = this.txtTitle.Text.Trim();

                    _IDService.UpdateIDReasonContent(reasonContent);
                }

                var categoryId = int.Parse(this.treeListLookUpEdit1.SelectedValue());

                RefreshEvent?.Invoke(categoryId);

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