/// <summary>
        /// 新增机构
        /// </summary>
        /// <param name="request">request</param>
        /// <returns></returns>
        public ServiceResult <bool> AddOrganization(AddOrganizationRequest request, TRightsUser loginInfo)
        {
            var result = new ServiceResult <bool>
            {
                ReturnCode = ReturnCodeType.Error
            };

            var currentTime = DateTime.Now;
            var item        = new TRightsOrganization
            {
                Name            = request.Name,
                ParentId        = request.ParentId,
                Code            = request.Code,
                Sort            = request.Sort,
                EnableFlag      = true,
                CreatedBy       = loginInfo.Id,
                CreatedTime     = currentTime,
                LastUpdatedBy   = loginInfo.Id,
                LastUpdatedTime = currentTime
            };
            var rs = orgDao.Insert(item);

            if (rs == true)
            {
                result.ReturnCode = ReturnCodeType.Success;
                result.Content    = true;
            }

            return(result);
        }
Example #2
0
        public ActionResult Add(AddOrganizationRequest request)
        {
            var flag = false;
            var msg  = string.Empty;

            var rs = _orgService.AddOrganization(request, loginInfo);

            if (rs.ReturnCode == ReturnCodeType.Success && rs.Content == true)
            {
                flag = true;
                msg  = "新增成功!";
            }
            else
            {
                msg = "新增失败!";
            }

            return(Json(new { success = flag, msg = msg }, JsonRequestBehavior.AllowGet));
        }
Example #3
0
        public ActionResult Add(AddOrganizationRequest request)
        {
            var flag = false;
            var msg  = string.Empty;

            using (var factory = new ChannelFactory <IRightsOrganizationService>("*"))
            {
                var client = factory.CreateChannel();
                var rs     = client.AddOrganization(request, loginInfo);
                if (rs.ReturnCode == ReturnCodeType.Success && rs.Content == true)
                {
                    flag = true;
                    msg  = "新增成功!";
                }
                else
                {
                    msg = "新增失败!";
                }
            }


            return(Json(new { success = flag, msg = msg }, JsonRequestBehavior.AllowGet));
        }