/// <summary>
        /// 增加字典明细项
        /// </summary>
        /// <param name="ctx">http请求信息</param>
        private void AddItemDetail(HttpContext ctx)
        {
            var entity = new CiItemDetailsEntity();
            var vUser  = Utils.UserInfo;

            entity            = this.GetPageItemDetailEntity(entity);
            entity.DeleteMark = 0;
            if (vUser != null)
            {
                entity.CreateBy     = vUser.RealName;
                entity.CreateUserId = vUser.Id;
            }
            var statusMessage = string.Empty;

            try
            {
                var returnValue = RDIFrameworkService.Instance.ItemDetailsService.Add(vUser, entity, out statusMessage);
                ctx.Response.Write(returnValue > 0
                    ? new JsonMessage {
                    Success = true, Data = "1", Message = statusMessage
                }.ToString()
                    : new JsonMessage {
                    Success = false, Data = "0", Message = statusMessage
                }.ToString());
            }
            catch (Exception ex)
            {
                ctx.Response.Write(new JsonMessage {
                    Success = false, Data = "-1", Message = RDIFrameworkMessage.MSG3020 + ex.Message
                }.ToString());
            }
        }
 public FrmEditDictionaryDetail(DataRow row)
 {
     InitializeComponent();
     currentItemDetailEntity = itemDetailService.GetEntity(base.UserInfo, row[CiItemDetailsTable.FieldId].ToString());
     isAdd = false;                  //修改数据
     btnSaveContinue.Visible = false;
     txtItemCode.Text        = currentItemDetailEntity.ItemCode;
     txtItemName.Text        = currentItemDetailEntity.ItemName;
     txtItemValue.Text       = currentItemDetailEntity.ItemValue;
     txtDescription.Text     = currentItemDetailEntity.Description;
     chkEnabled.Checked      = BusinessLogic.ConvertIntToBoolean(currentItemDetailEntity.Enabled);
 }
 public override void ShowEntity()
 {
     currenteEntity = RDIFrameworkService.Instance.ItemDetailsService.GetEntity(this.UserInfo, this.EntityId);
     if (currenteEntity != null)
     {
         this.txtItemCode.Text    = currenteEntity.ItemCode;
         this.txtItemName.Text    = currenteEntity.ItemName;
         this.txtItemValue.Text   = currenteEntity.ItemValue;
         this.txtDescription.Text = currenteEntity.Description;
         this.chkEnabled.Checked  = BusinessLogic.ConvertIntToBoolean(currenteEntity.Enabled);
     }
 }
 private CiItemDetailsEntity GetPageItemDetailEntity(CiItemDetailsEntity entity)
 {
     entity.ItemCode    = PublicMethod.GetString(getObj("ItemCode"));
     entity.ItemName    = PublicMethod.GetString(getObj("ItemName"));
     entity.ItemValue   = PublicMethod.GetString(getObj("ItemValue"));
     entity.Description = PublicMethod.GetString(getObj("Description"));
     entity.ItemId      = PublicMethod.GetString(getObj("vitemId"));
     entity.ParentId    = PublicMethod.GetString(getObj("vparentId"));
     entity.Enabled     = PublicMethod.GetString(getObj("Enabled")) == "on" ? 1 : 0;
     entity.IsPublic    = PublicMethod.GetString(getObj("IsPublic")) == "on" ? 1 : 0;
     entity.AllowEdit   = PublicMethod.GetString(getObj("AllowEdit")) == "on" ? 1 : 0;
     entity.AllowDelete = PublicMethod.GetString(getObj("AllowDelete")) == "on" ? 1 : 0;
     return(entity);
 }
        public override bool SaveEntity()
        {
            var itemDetailEntity = new CiItemDetailsEntity
            {
                ItemId      = currentItemId,
                ItemCode    = txtItemCode.Text.Trim(),
                ItemName    = txtItemName.Text.Trim(),
                ItemValue   = txtItemValue.Text.Trim(),
                Enabled     = chkEnabled.Checked ? 1 : 0,
                Description = txtDescription.Text.Trim(),
                AllowDelete = 1,
                AllowEdit   = 1,
                IsPublic    = 1,
                DeleteMark  = 0,
                ParentId    = null
            };

            if (base.UserInfo != null)
            {
                itemDetailEntity.CreateBy     = UserInfo.RealName;
                itemDetailEntity.CreateUserId = UserInfo.Id;
            }

            var statusMessage = string.Empty;
            var returnValue   = 0;

            try
            {
                returnValue = itemDetailService.Add(base.UserInfo, itemDetailEntity, out statusMessage);
            }
            catch (Exception ex)
            {
                base.ProcessException(ex);
            }

            if (returnValue > 0)
            {
                if (SystemInfo.ShowSuccessMsg)
                {
                    MessageBoxHelper.ShowSuccessMsg(statusMessage);
                }
                return(true);
            }
            else
            {
                MessageBoxHelper.ShowWarningMsg(statusMessage);
            }
            return(false);
        }