Esempio n. 1
0
        public ExcuteResultEnum AddNewBcUserInfo(BcUserInfoEntity entity, string roleIds = null)
        {
            if (
                EntityExecution.Count <BcUserInfoEntity>(
                    n => n.UserAccount == entity.UserAccount && n.DeleteFlag == false) > 0)
            {
                return(ExcuteResultEnum.IsExist);
            }

            using (TransactionScope ts = new TransactionScope())
            {
                entity.UserId     = null;
                entity.DeleteFlag = false;
                entity.Password   = Encryption.Encrypt(entity.Password);
                var id = EntityExecution.InsertWithIdentity(entity);
                if (!string.IsNullOrEmpty(roleIds))
                {
                    foreach (string roleId in roleIds.Split(','))
                    {
                        var userRoleEntity = new BcUserRoleEntity {
                            UserId = (int?)id, RoleId = int.Parse(roleId)
                        };
                        EntityExecution.Insert(userRoleEntity);
                    }
                }
                ts.Complete();
            }
            return(ExcuteResultEnum.Success);
        }
Esempio n. 2
0
 public ExcuteResultEnum AddNewBcUserRole(BcUserRoleEntity entity)
 {
     if (EntityExecution.Count <BcUserRoleEntity>(n => n.RoleId == entity.RoleId && n.UserId == entity.UserId) > 0)
     {
         return(ExcuteResultEnum.IsExist);
     }
     entity.Insert();
     return(ExcuteResultEnum.Success);
 }
Esempio n. 3
0
        public ExcuteResultEnum DeleteBcGroup(int groupId)
        {
            if (EntityExecution.Count <BcUserInfoEntity>(n => n.GroupId == groupId && n.DeleteFlag == false) > 0)
            {
                return(ExcuteResultEnum.IsOccupied);
            }

            BcGroupEntity entity = new BcGroupEntity()
            {
                GroupId = groupId
            };

            EntityExecution.Delete(entity);
            return(ExcuteResultEnum.Success);
        }
Esempio n. 4
0
        public ExcuteResultEnum DeleteBcRole(int roleId)
        {
            if (EntityExecution.Count <BcUserRoleEntity>(n => n.RoleId == roleId) > 0)
            {
                return(ExcuteResultEnum.IsOccupied);
            }

            BcRoleEntity entity = new BcRoleEntity()
            {
                RoleId = roleId
            };

            EntityExecution.Delete(entity);
            return(ExcuteResultEnum.Success);
        }
Esempio n. 5
0
        public ExcuteResultEnum DeleteBcUserInfo(int userId)
        {
            if (EntityExecution.Count <BcUserRoleEntity>(n => n.UserId == userId) > 0)
            {
                return(ExcuteResultEnum.IsOccupied);
            }

            var entity = GetSingleBcUserInfo(userId);

            if (new SysGlobalSettingBiz().IsSuperAdmin(entity.UserAccount))
            {
                return(ExcuteResultEnum.IsSuperAdmin);
            }

            entity.DeleteFlag = true;
            return(UpdateBcUserInfo(entity));
        }
Esempio n. 6
0
 public int GetCountByFatherNode(int?fatherNode)
 {
     return(EntityExecution.Count <SysMenuEntity>(n => n.FatherNode == fatherNode && n.DeleteFlag == false));
 }