Exemplo n.º 1
0
        public ActionResult EditAddress(string data)
        {
            AjaxResult result = new AjaxResult
            {
                Success = true,
                Message = "保存成功",
                Data    = null
            };
            Address addInfo = string.IsNullOrWhiteSpace(data) ? null : Newtonsoft.Json.JsonConvert.DeserializeObject <Address>(data, new JsonSerializerSettings
            {
                MissingMemberHandling = MissingMemberHandling.Ignore,
                NullValueHandling     = NullValueHandling.Ignore,
                DefaultValueHandling  = DefaultValueHandling.Ignore
            });

            if (CurrUser.CompanySysNo > 0)
            {
                addInfo.CompanySysNo  = CurrUser.CompanySysNo;
                addInfo.EditUserName  = CurrUser.UserDisplayName;
                addInfo.EditUserSysNo = CurrUser.UserSysNo;
            }
            if (addInfo.Name == "#")
            {
                CompanyService.CreateRootAddress(addInfo.CompanySysNo);
            }
            else
            {
                if (addInfo.SysNo <= 0 && (!addInfo.ParentSysNo.HasValue || addInfo.ParentSysNo.Value <= 0))
                {
                    throw new BusinessException("父级节点不存在,请选择正确的父级节点。");
                }
                CompanyService.EditAddress(addInfo);
            }
            return(Json(result));
        }