Beispiel #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);
        }
        public async Task <long> PromoteStagedDataAsync(EntityExecution entityExecution, Entity entity, DataMart dataMart, CancellationToken cancellationToken)
        {
            // no op: Databus takes care of this
            await Task.CompletedTask;

            return(Convert.ToInt64(0));
        }
Beispiel #3
0
        private List <SysEnumNameEntity> SetSysEnumNameListCache()
        {
            var list = EntityExecution.SelectAll <SysEnumNameEntity>();

            DataCache.SetCache(CacheKey, list);
            return(list);
        }
Beispiel #4
0
        public List <SysMenuEntity> GetSysMenuListByFatherNode(int fatherNode = 0)
        {
            List <SysMenuEntity> list =
                EntityExecution.SelectAll <SysMenuEntity>(n => n.DeleteFlag == false && n.FatherNode == fatherNode);

            list = list.OrderBy(n => n.Seq).ToList();
            return(list);
        }
Beispiel #5
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);
 }
Beispiel #6
0
        public void DeleteBcUserRole(int userId, int roleId)
        {
            BcUserRoleEntity entity = new BcUserRoleEntity()
            {
                UserId = userId, RoleId = roleId
            };

            EntityExecution.Delete(entity);
        }
Beispiel #7
0
        public void DeleteBcLogError(int id)
        {
            BcLogErrorEntity entity = new BcLogErrorEntity()
            {
                Id = id
            };

            EntityExecution.Delete(entity);
        }
Beispiel #8
0
        public void DeleteBcAutoCode(int id)
        {
            BcAutoCodeEntity entity = new BcAutoCodeEntity()
            {
                Id = id
            };

            EntityExecution.Delete(entity);
        }
Beispiel #9
0
        public BcUserInfoEntity GetSingleBcUserInfo(int userId)
        {
            var entity = EntityExecution.SelectOne <BcUserInfoEntity>(n => n.UserId == userId);

            if (entity != null)
            {
                entity.Password = Encryption.Decrypt(entity.Password);
            }
            return(entity);
        }
Beispiel #10
0
        public void DeleteSysPageFuncPoint(string pageUrl)
        {
            SysPageFuncPointEntity entity = new SysPageFuncPointEntity()
            {
                PageUrl = pageUrl
            };

            EntityExecution.Delete(entity);
            SetSysPageFuncPointListCache();
        }
Beispiel #11
0
        public void DeleteSysEnumName(string type, string value)
        {
            SysEnumNameEntity entity = new SysEnumNameEntity()
            {
                Type = type, Value = value
            };

            EntityExecution.Delete(entity);
            SetSysEnumNameListCache();
        }
Beispiel #12
0
        public void DeleteBcPermission(int permissionId, int permissionType, string moduleId, string funcPointId)
        {
            var entity = new BcPermissionEntity();

            entity.UserRoleId     = permissionId;
            entity.PermissionType = permissionType;
            entity.ModuleId       = moduleId;
            entity.FuncPointId    = funcPointId;
            EntityExecution.Delete(entity);
        }
Beispiel #13
0
        public void DeleteSysRelation(string moduleId, string funcPointId)
        {
            SysRelationEntity entity = new SysRelationEntity()
            {
                ModuleId = moduleId, FuncPointId = funcPointId
            };

            EntityExecution.Delete(entity);
            SetSysRelationListCache();
        }
Beispiel #14
0
        public EmployeeEntity GetEmployeeEntity(string id)
        {
            var entity           = EntityExecution.SelectOne <EmployeeEntity>(n => n.EMPLOYEE_ID == id);
            var restaurantEntity = new RestaurantBiz().GetRestaurantEntity(entity.RESTAURANT_ID);

            if (restaurantEntity != null)
            {
                entity.RESTAURANT_NAME = restaurantEntity.RESTAURANT_NAME;
            }
            return(entity);
        }
        public List <FoodEntity> GetFoodEntityList(FoodEntity condition_entity)
        {
            GenericWhereEntity <FoodEntity> where_entity = new GenericWhereEntity <FoodEntity>();

            if (condition_entity.FOOD_ID != null)
            {
                where_entity.Where(n => (n.FOOD_ID == condition_entity.FOOD_ID));
            }
            if (condition_entity.RESTAURANT_ID != null)
            {
                where_entity.Where(n => (n.RESTAURANT_ID == condition_entity.RESTAURANT_ID));
            }
            return(EntityExecution.SelectAll(where_entity));
        }
        public List <FoodTypeEntity> GetFoodTypeEntityList(FoodTypeEntity condition_entity)
        {
            GenericWhereEntity <FoodTypeEntity> where_entity = new GenericWhereEntity <FoodTypeEntity>();

            if (condition_entity.FOOD_TYPE_ID != null)
            {
                where_entity.Where(n => (n.FOOD_TYPE_ID == condition_entity.FOOD_TYPE_ID));
            }
            if (condition_entity.FOOD_TYPE_NAME != null)
            {
                where_entity.Where(n => (n.FOOD_TYPE_NAME == condition_entity.FOOD_TYPE_NAME));
            }
            return(EntityExecution.SelectAll(where_entity));
        }
Beispiel #17
0
        public List <EmployeeEntity> GetEmployeeEntityList(EmployeeEntity condition_entity)
        {
            GenericWhereEntity <EmployeeEntity> where_entity = new GenericWhereEntity <EmployeeEntity>();

            if (condition_entity.EMPLOYEE_ID != null)
            {
                where_entity.Where(n => (n.EMPLOYEE_ID == condition_entity.EMPLOYEE_ID));
            }
            if (!string.IsNullOrEmpty(condition_entity.PASSWORD))
            {
                where_entity.Where(n => (n.PASSWORD == condition_entity.PASSWORD));
            }
            return(EntityExecution.SelectAll(where_entity));
        }
Beispiel #18
0
        public List <RestaurantEntity> GetRestaurantEntityList(RestaurantEntity condition_entity)
        {
            GenericWhereEntity <RestaurantEntity> where_entity = new GenericWhereEntity <RestaurantEntity>();

            if (condition_entity.RESTAURANT_ID != null)
            {
                where_entity.Where(n => (n.RESTAURANT_ID == condition_entity.RESTAURANT_ID));
            }
            if (condition_entity.RESTAURANT_NAME != null)
            {
                where_entity.Where(n => (n.RESTAURANT_NAME == condition_entity.RESTAURANT_NAME));
            }
            return(EntityExecution.SelectAll(where_entity));
        }
Beispiel #19
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);
        }
Beispiel #20
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);
        }
Beispiel #21
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));
        }
Beispiel #22
0
        private List <SysRelationEntity> SetSysRelationListCache()
        {
            var listSysRelationEntity      = EntityExecution.SelectAll <SysRelationEntity>();
            var listSysModuleEnumEntity    = new SysModuleEnumBiz().GetSysModuleEnumList();
            var listSysFuncPointEnumEntity = new SysFuncPointEnumBiz().GetSysFuncPointEnumList();
            var query = from sysRelationEntity in listSysRelationEntity
                        join sysModuleEnumEntity in listSysModuleEnumEntity on sysRelationEntity.ModuleId equals
                        sysModuleEnumEntity.Name
                        join sysFuncPointEnumEntity in listSysFuncPointEnumEntity on sysRelationEntity.FuncPointId equals
                        sysFuncPointEnumEntity.Name
                        select new SysRelationEntity()
            {
                ModuleId      = sysRelationEntity.ModuleId,
                FuncPointId   = sysRelationEntity.FuncPointId,
                Permissions   = sysRelationEntity.Permissions,
                ModuleName    = sysModuleEnumEntity.Description,
                FuncPointName = sysFuncPointEnumEntity.Description,
            };

            listSysRelationEntity = query.ToList <SysRelationEntity>();
            foreach (SysRelationEntity sysRelationEntity in listSysRelationEntity)
            {
                if (!string.IsNullOrEmpty(sysRelationEntity.Permissions))
                {
                    sysRelationEntity.PermissionList     = new List <string>();
                    sysRelationEntity.PermissionListName = new List <string>();
                    var list = sysRelationEntity.Permissions.Split(',').ToList();
                    foreach (string s in list)
                    {
                        if (!string.IsNullOrEmpty(s))
                        {
                            sysRelationEntity.PermissionList.Add(s);
                            sysRelationEntity.PermissionListName.Add(SysEnumNameExBiz.GetDescription <SysFuncPointEnum>(s));
                        }
                    }
                    if (sysRelationEntity.PermissionListName.Count > 0)
                    {
                        sysRelationEntity.PermissionsName = string.Join(",",
                                                                        sysRelationEntity.PermissionListName.ToArray());
                    }
                }
            }
            DataCache.SetCache(CacheKey, listSysRelationEntity);
            return(listSysRelationEntity);
        }
Beispiel #23
0
        private List <SysPageFuncPointEntity> SetSysPageFuncPointListCache()
        {
            var listSysPageFuncPointEntity = EntityExecution.SelectAll <SysPageFuncPointEntity>().OrderBy(n => n.PageUrl);
            var listSysFuncPointEnumEntity = new SysFuncPointEnumBiz().GetSysFuncPointEnumList();
            var query = from sysPageFuncPointEntity in listSysPageFuncPointEntity
                        join sysFuncPointEnumEntity in listSysFuncPointEnumEntity on sysPageFuncPointEntity.FuncPointId equals
                        sysFuncPointEnumEntity.Name
                        select new SysPageFuncPointEntity()
            {
                PageUrl       = sysPageFuncPointEntity.PageUrl,
                FuncPointId   = sysPageFuncPointEntity.FuncPointId,
                FuncPointName = sysFuncPointEnumEntity.Description,
            };
            var list = query.ToList <SysPageFuncPointEntity>();

            DataCache.SetCache(CacheKey, list);
            return(list);
        }
        public List <OrderListEntity> GetOrderListEntityList(OrderListEntity condition_entity)
        {
            GenericWhereEntity <OrderListEntity> where_entity = new GenericWhereEntity <OrderListEntity>();

            if (condition_entity.LIST_ID != null)
            {
                where_entity.Where(n => (n.LIST_ID == condition_entity.LIST_ID));
            }
            if (condition_entity.ORDER_ID != null)
            {
                where_entity.Where(n => (n.ORDER_ID == condition_entity.ORDER_ID));
            }
            if (condition_entity.FOOD_ID != null)
            {
                where_entity.Where(n => (n.FOOD_ID == condition_entity.FOOD_ID));
            }
            return(EntityExecution.SelectAll(where_entity));
        }
        public List <OrderMainEntity> GetOrderMainEntityList(OrderMainEntity condition_entity)
        {
            GenericWhereEntity <OrderMainEntity> where_entity = new GenericWhereEntity <OrderMainEntity>();

            if (condition_entity.ORDER_ID != null)
            {
                where_entity.Where(n => (n.ORDER_ID == condition_entity.ORDER_ID));
            }
            if (condition_entity.RESTAURANT_ID != null)
            {
                where_entity.Where(n => (n.RESTAURANT_ID == condition_entity.RESTAURANT_ID));
            }
            if (condition_entity.TABLE_ID != null)
            {
                where_entity.Where(n => (n.TABLE_ID == condition_entity.TABLE_ID));
            }
            if (condition_entity.ORDER_FLAG != null)
            {
                where_entity.Where(n => (n.ORDER_FLAG == condition_entity.ORDER_FLAG));
            }
            return(EntityExecution.SelectAll(where_entity));
        }
Beispiel #26
0
        public LoginStatusEnum DoLogin(string userAccount, string password)
        {
            var entity =
                EntityExecution.SelectOne <BcUserInfoEntity>(n => n.UserAccount == userAccount && n.DeleteFlag == false);

            if (entity == null)
            {
                return(LoginStatusEnum.UserNotExist);
            }

            if (entity.Password != Encryption.Encrypt(password))
            {
                return(LoginStatusEnum.PasswordError);
            }

            if ((bool)!entity.ActivityFlag)
            {
                return(LoginStatusEnum.UserDisabled);
            }

            return(LoginStatusEnum.Success);
        }
Beispiel #27
0
 public ExcuteResultEnum UpdateBcUserInfo(BcUserInfoEntity entity, string roleIds = null)
 {
     entity.Password = Encryption.Encrypt(entity.Password);
     using (TransactionScope ts = new TransactionScope())
     {
         entity.Update();
         EntityExecution.Delete <BcUserRoleEntity>(n => n.UserId == entity.UserId);
         if (!string.IsNullOrEmpty(roleIds))
         {
             foreach (string roleId in roleIds.Split(','))
             {
                 var userRoleEntity = new BcUserRoleEntity
                 {
                     UserId = entity.UserId,
                     RoleId = int.Parse(roleId)
                 };
                 EntityExecution.Insert(userRoleEntity);
             }
         }
         ts.Complete();
     }
     return(ExcuteResultEnum.Success);
 }
Beispiel #28
0
 public List <BcGroupEntity> GetBcGroupList()
 {
     return(EntityExecution.SelectAll <BcGroupEntity>());
 }
Beispiel #29
0
 public BcGroupEntity GetSingleBcGroup(int groupId)
 {
     return(EntityExecution.SelectOne <BcGroupEntity>(n => n.GroupId == groupId));
 }
Beispiel #30
0
        public BcUserInfoEntity GetBcUserInfoWithPermission(string userAccount)
        {
            var entity =
                EntityExecution.SelectOne <BcUserInfoEntity>(
                    n => n.UserAccount == userAccount && n.ActivityFlag == true && n.DeleteFlag == false);

            //获取用户的角色
            var userRoleList = new BcUserRoleBiz().GetBcUserRoleList(entity.UserId);

            entity.RoleList = new List <BcRoleEntity>();
            foreach (BcUserRoleEntity userRoleEntity in userRoleList)
            {
                entity.RoleList.Add(new BcRoleEntity()
                {
                    RoleId   = userRoleEntity.RoleId,
                    RoleName = userRoleEntity.RoleName
                });
            }

            //获取用户是否为超级管理员
            entity.IsSuperAdmin = new SysGlobalSettingBiz().IsSuperAdmin(entity.UserAccount);

            //获取用户的权限
            if (entity.IsSuperAdmin)
            {
                //如果是超级管理员,获取所有权限
                entity.PermisionList = new List <PermissionEntity>();
                var sysRelationList = new SysRelationBiz().GetEnabledSysRelationList();
                foreach (SysRelationEntity sysRelationEntity in sysRelationList)
                {
                    entity.PermisionList.Add(new PermissionEntity()
                    {
                        ModuleId       = sysRelationEntity.ModuleId,
                        FuncPointId    = sysRelationEntity.FuncPointId,
                        PermissionList = sysRelationEntity.PermissionList
                    });
                }
            }
            else
            {
                //如果不是超级管理员,获取用户权限和角色权限
                var bcPermissionBiz = new BcPermissionBiz();

                //1、获取用户权限
                entity.PermisionList = new List <PermissionEntity>();
                var bcUserPermissionList = bcPermissionBiz.GetEnabledBcPermissionList(2, entity.UserId);
                foreach (BcPermissionEntity bcPermissionEntity in bcUserPermissionList)
                {
                    entity.PermisionList.Add(new PermissionEntity()
                    {
                        ModuleId       = bcPermissionEntity.ModuleId,
                        FuncPointId    = bcPermissionEntity.FuncPointId,
                        PermissionList = bcPermissionEntity.Permissions.Split(',').ToList()
                    });
                }

                //2、获取角色权限
                foreach (BcRoleEntity bcRoleEntity in entity.RoleList)
                {
                    var bcRolePermissionList = bcPermissionBiz.GetEnabledBcPermissionList(1, bcRoleEntity.RoleId);
                    foreach (BcPermissionEntity bcPermissionEntity in bcRolePermissionList)
                    {
                        var list =
                            entity.PermisionList.Where(
                                n =>
                                n.ModuleId == bcPermissionEntity.ModuleId &&
                                n.FuncPointId == bcPermissionEntity.FuncPointId).ToList();
                        if (list.Count > 0)
                        {
                            var pcList = bcPermissionEntity.Permissions.Split(',').ToList();
                            foreach (string s in pcList)
                            {
                                if (!list[0].PermissionList.Contains(s))
                                {
                                    list[0].PermissionList.Add(s);
                                }
                            }
                        }
                        else
                        {
                            entity.PermisionList.Add(new PermissionEntity()
                            {
                                ModuleId       = bcPermissionEntity.ModuleId,
                                FuncPointId    = bcPermissionEntity.FuncPointId,
                                PermissionList = bcPermissionEntity.Permissions.Split(',').ToList()
                            });
                        }
                    }
                }
            }

            //根据用户权限,获取用户的菜单列表
            entity.MenuList = new SysMenuBiz().GetEnabledSysMenuListByPermission(entity.PermisionList);

            return(entity);
        }