public JsonResult SaveCategory(CategoryViewModel model)
        {
            OThinker.Organization.OrgCategory data = null;
            bool         result       = false;
            string       message      = string.Empty;
            ActionResult actionResult = new ActionResult(true, "");

            return(ExecuteFunctionRun(() =>
            {
                actionResult = VlidateCode(model.Code);//验证编码合法性
                if (!actionResult.Success)
                {
                    return Json(actionResult, JsonRequestBehavior.AllowGet);
                }

                if (!string.IsNullOrEmpty(model.ObjectID))
                {
                    data = this.Engine.Organization.GetCategoryByCode(model.Code);
                    if (data != null)
                    {
                        data.DisplayName = model.DisplayName;
                        data.Description = model.Description;
                        result = this.Engine.Organization.UpdateOrgCategory(data);
                    }
                    else
                    {
                        message = "EditCategory.UpdatingCategoryIDNull";
                    }
                }
                else
                {
                    // 判断对象编码是否已经存在
                    if (this.Engine.Organization.GetCategoryByCode(model.Code) != null)
                    {
                        message = "msgGlobalString.CodeDuplicate";
                    }
                    else
                    {
                        data = new OThinker.Organization.OrgCategory()
                        {
                            Code = model.Code,
                            DisplayName = model.DisplayName,
                            Description = model.Description
                        };
                        result = this.Engine.Organization.AddOrgCategory(data);
                    }
                }

                actionResult = new ActionResult(result, result ? "msgGlobalString.SaveSucced" : message);
                return Json(actionResult, JsonRequestBehavior.DenyGet);
            }));
        }
        public JsonResult GetCategoryDetailByID(string id)
        {
            return(ExecuteFunctionRun(() =>
            {
                OThinker.Organization.OrgCategory categorySource = this.Engine.Organization.GetCategoryByCode(id);
                if (categorySource == null)
                {
                    return Json(new CategoryViewModel(), JsonRequestBehavior.AllowGet);
                }

                //分类列表数据
                var category = new
                {
                    ObjectID = categorySource.ObjectID,
                    Code = categorySource.Code,
                    DisplayName = categorySource.DisplayName,
                    Description = categorySource.Description
                };

                return Json(category, JsonRequestBehavior.AllowGet);
            }));
        }