public MessageReport Create(User_AuthGroup obj)
        {
            var re = new MessageReport();

            re.Message   = "Error";
            re.isSuccess = false;

            try
            {
                _User_AuthGroupRepository.Add(obj);

                Save();

                re.Message   = FunctionHelper.GetLocalizeDictionary("Home", "notification")["addSuccess"];
                re.isSuccess = true;
            }
            catch (Exception ex)
            {
                re.Message   = ex.Message;
                re.isSuccess = false;
            }

            return(re);
        }
Example #2
0
        /// <summary>
        /// tạo mới, cập nhật phân quyền nhóm thẻ
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="cardgroupIds"></param>
        public void CreateUserAuthGroup(string userid, string cardgroupIds)
        {
            var objsystem = _tblSystemConfigService.GetDefault();

            if (objsystem != null && objsystem.isAuthInView && !string.IsNullOrEmpty(userid))
            {
                var userauthgroup = _User_AuthGroupService.GetByUserId(userid);
                if (userauthgroup == null)
                {
                    userauthgroup = new User_AuthGroup
                    {
                        Id           = Common.GenerateId(),
                        UserId       = userid,
                        CardGroupIds = cardgroupIds
                    };
                    _User_AuthGroupService.Create(userauthgroup);
                }
                else
                {
                    userauthgroup.CardGroupIds = cardgroupIds;
                    _User_AuthGroupService.Update(userauthgroup);
                }
            }
        }