public IEnumerable <MenuInfo> GetMenuInfoByLoginID(string loginID)
        {
            using (SystemCoreContext entityContext = new SystemCoreContext())
            {
                var roleQuery = from a in entityContext.MenuRoleSet
                                join b in entityContext.UserRoleSet on a.RoleId equals b.RoleId
                                join c in entityContext.UserSetupSet on b.UserSetupId equals c.UserSetupId
                                where c.LoginID == loginID
                                select a;

                var menuIds = roleQuery.Select(c => c.MenuId).Distinct().ToArray();

                var query = from a in entityContext.MenuSet
                            join b in entityContext.ModuleSet on a.ModuleId equals b.ModuleId
                            join c in entityContext.MenuSet on a.ParentId equals c.MenuId into parents
                            from pt in parents.DefaultIfEmpty()

                            where b.Active && a.Active && menuIds.Contains(a.MenuId)
                            select new MenuInfo()
                {
                    Menu   = a,
                    Module = b,
                    Parent = pt
                };

                return(query.ToFullyLoaded());
            }
        }
Exemple #2
0
        protected override IEnumerable <AuditTrail> GetEntities(SystemCoreContext entityContext)
        {
            //return from e in entityContext.Set<AuditTrail>()
            //       select e;
            var query = (from e in entityContext.Set <AuditTrail>()
                         select e).Take(0);
            var results = query;

            return(results);
        }
Exemple #3
0
        protected override AuditTrail GetEntity(SystemCoreContext entityContext, int id)
        {
            var query = (from e in entityContext.Set <AuditTrail>()
                         where e.AuditTrailId == id
                         select e);

            var results = query.FirstOrDefault();

            return(results);
        }
Exemple #4
0
        protected override CompanySecurity GetEntity(SystemCoreContext entityContext, int id)
        {
            var query = (from e in entityContext.Set <CompanySecurity>()
                         where e.CompanySecurityId == id
                         select e);

            var results = query.FirstOrDefault();

            return(results);
        }
        protected override Database GetEntity(SystemCoreContext entityContext, int id)
        {
            var query = (from e in entityContext.Set <Database>()
                         where e.DatabaseId == id
                         select e);

            var results = query.FirstOrDefault();

            return(results);
        }
        protected override ErrorTracker GetEntity(SystemCoreContext entityContext, int id)
        {
            var query = (from e in entityContext.Set <ErrorTracker>()
                         where e.ErrorTrackerId == id
                         select e);

            var results = query.FirstOrDefault();

            return(results);
        }
Exemple #7
0
        protected override UserSession GetEntity(SystemCoreContext entityContext, int id)
        {
            var query = (from e in entityContext.Set <UserSession>()
                         where e.UserSessionId == id
                         select e);

            var results = query.FirstOrDefault();

            return(results);
        }
Exemple #8
0
        public UserSetup GetByLoginID(string loginID)
        {
            using (SystemCoreContext entityContext = new SystemCoreContext())
            {
                var query = from a in entityContext.UserSetupSet
                            where a.LoginID == loginID
                            select a;

                return(query.FirstOrDefault());
            }
        }
Exemple #9
0
        //public IEnumerable<AuditTrail> GetByAction(AuditAction action, DateTime fromDate, DateTime toDate)
        //{
        //    using (SystemCoreContext entityContext = new SystemCoreContext())
        //    {
        //        var query = from a in entityContext.AuditTrailSet
        //                    where a.RevisionStamp >= fromDate && a.RevisionStamp <= toDate && a.Actions == action
        //                    select a;

        //        return query.ToFullyLoaded();
        //    }
        //}


        public IEnumerable <AuditTrail> GetAuditTrailByTab(AuditAction action)
        {
            using (SystemCoreContext entityContext = new SystemCoreContext())
            {
                var query = from a in entityContext.AuditTrailSet
                            where a.Actions == action
                            select a;

                return(query.ToFullyLoaded());
            }
        }
Exemple #10
0
        public IEnumerable <AuditTrail> GetByTable(string tablename, DateTime fromDate, DateTime toDate)
        {
            using (SystemCoreContext entityContext = new SystemCoreContext())
            {
                var query = from a in entityContext.AuditTrailSet
                            where a.RevisionStamp >= fromDate && a.RevisionStamp <= toDate && a.TableName == tablename
                            select a;

                return(query.ToFullyLoaded());
            }
        }
Exemple #11
0
        public IEnumerable <CompanyUser> GetCompanyUsers(string loginID)
        {
            using (SystemCoreContext entityContext = new SystemCoreContext())
            {
                var query = from a in entityContext.CompanyUserSet
                            join b in entityContext.UserSetupSet on a.UserId equals b.UserSetupId
                            where b.LoginID == loginID
                            select a;


                return(query.ToFullyLoaded());
            }
        }
        public IEnumerable <ModuleInfo> GetModules()
        {
            using (SystemCoreContext entityContext = new SystemCoreContext())
            {
                var query = from a in entityContext.ModuleSet
                            join d in entityContext.SolutionSet on a.SolutionId equals d.SolutionId
                            select new ModuleInfo()
                {
                    Module   = a,
                    Solution = d
                };

                return(query.ToFullyLoaded());
            }
        }
        public IEnumerable <RoleInfo> GetRoles()
        {
            using (SystemCoreContext entityContext = new SystemCoreContext())
            {
                var query = from a in entityContext.RoleSet
                            join b in entityContext.SolutionSet on a.SolutionId equals b.SolutionId

                            select new RoleInfo()
                {
                    Role     = a,
                    Solution = b
                };

                return(query.ToFullyLoaded());
            }
        }
        public IEnumerable <DatabaseInfo> GetDatabases()
        {
            using (SystemCoreContext entityContext = new SystemCoreContext())
            {
                var query = from a in entityContext.DatabaseSet
                            join b in entityContext.SolutionSet on a.SolutionId equals b.SolutionId into parents
                            from pt in parents.DefaultIfEmpty()
                            select new DatabaseInfo()
                {
                    Database = a,
                    Solution = pt
                };

                return(query.ToFullyLoaded());
            }
        }
        public IEnumerable <CompanyModuleInfo> GetCompanyModules()
        {
            using (SystemCoreContext entityContext = new SystemCoreContext())
            {
                var query = from a in entityContext.CompanyModuleSet
                            join b in entityContext.CompanySet on a.CompanyCode equals b.Code
                            join c in entityContext.ModuleSet on a.ModuleName equals c.Name
                            select new CompanyModuleInfo()
                {
                    CompanyModule = a,
                    Company       = b,
                    Module        = c
                };

                return(query.ToFullyLoaded());
            }
        }
Exemple #16
0
        public IEnumerable <UserSessionInfo> GetUserSessions()
        {
            using (SystemCoreContext entityContext = new SystemCoreContext())
            {
                var query = from a in entityContext.UserSessionSet
                            join b in entityContext.UserSetupSet on a.UserId equals b.LoginID
                            join c in entityContext.DatabaseSet on a.DatabaseId equals c.DatabaseId
                            select new UserSessionInfo()
                {
                    UserSession = a,
                    UserSetup   = b,
                    Database    = c
                };

                return(query.ToFullyLoaded());
            }
        }
        // join b in entityContext.TeamSet on a.ParentCode equals b.Code into parents
        // from pt in parents.Where(c=>(a.Year==c.Year)).DefaultIfEmpty()

        public IEnumerable <MenuInfo> GetMenuInfo()
        {
            using (SystemCoreContext entityContext = new SystemCoreContext())
            {
                var query = from a in entityContext.MenuSet
                            join b in entityContext.ModuleSet on a.ModuleId equals b.ModuleId
                            join c in entityContext.MenuSet on a.ParentId equals c.MenuId into parents
                            from pt in parents.DefaultIfEmpty()
                            select new MenuInfo()
                {
                    Menu   = a,
                    Module = b,
                    Parent = pt
                };

                return(query.ToFullyLoaded());
            }
        }
        public IEnumerable <MenuRoleInfo> GetMenuRoleInfo()
        {
            using (SystemCoreContext entityContext = new SystemCoreContext())
            {
                var query = from a in entityContext.MenuRoleSet
                            join b in entityContext.MenuSet on a.MenuId equals b.MenuId
                            join c in entityContext.RoleSet on a.RoleId equals c.RoleId
                            join d in entityContext.SolutionSet on c.SolutionId equals d.SolutionId
                            select new MenuRoleInfo()
                {
                    MenuRole = a,
                    Menu     = b,
                    Role     = c,
                    Solution = d
                };

                return(query.ToFullyLoaded());
            }
        }
Exemple #19
0
        public IEnumerable <UserRoleInfo> GetUserRoleInfo()
        {
            using (SystemCoreContext entityContext = new SystemCoreContext())
            {
                var query = from a in entityContext.UserRoleSet
                            join b in entityContext.UserSetupSet on a.UserSetupId equals b.UserSetupId
                            join c in entityContext.RoleSet on a.RoleId equals c.RoleId
                            join d in entityContext.SolutionSet on c.SolutionId equals d.SolutionId
                            select new UserRoleInfo()
                {
                    UserRole  = a,
                    UserSetup = b,
                    Role      = c,
                    Solution  = d
                };

                return(query.ToFullyLoaded());
            }
        }
Exemple #20
0
        public IEnumerable <UserRoleInfo> GetUserRoleInfo(string solutionName, string loginID, List <string> roleNames)
        {
            using (SystemCoreContext entityContext = new SystemCoreContext())
            {
                var query = from a in entityContext.UserRoleSet
                            join b in entityContext.UserSetupSet on a.UserSetupId equals b.UserSetupId
                            join c in entityContext.RoleSet on a.RoleId equals c.RoleId
                            join d in entityContext.SolutionSet on c.SolutionId equals d.SolutionId
                            where d.Name == solutionName && b.LoginID == loginID && roleNames.Contains(c.Name)
                            select new UserRoleInfo()
                {
                    UserRole  = a,
                    UserSetup = b,
                    Role      = c,
                    Solution  = d
                };

                return(query.ToFullyLoaded());
            }
        }
        public IEnumerable <MenuRoleInfo> GetMenuRoleInfo(string loginID)
        {
            using (SystemCoreContext entityContext = new SystemCoreContext())
            {
                var query = from a in entityContext.MenuRoleSet
                            join b in entityContext.MenuSet on a.MenuId equals b.MenuId
                            join c in entityContext.RoleSet on a.RoleId equals c.RoleId
                            join d in entityContext.UserRoleSet on a.RoleId equals d.RoleId
                            join e in entityContext.UserSetupSet on d.UserSetupId equals e.UserSetupId
                            join f in entityContext.SolutionSet on c.SolutionId equals f.SolutionId
                            where e.LoginID == loginID
                            select new MenuRoleInfo()
                {
                    MenuRole = a,
                    Menu     = b,
                    Role     = c,
                    Solution = f
                };

                return(query.ToFullyLoaded());
            }
        }
 protected override IEnumerable <Database> GetEntities(SystemCoreContext entityContext)
 {
     return(from e in entityContext.Set <Database>()
            select e);
 }
 protected override Database UpdateEntity(SystemCoreContext entityContext, Database entity)
 {
     return((from e in entityContext.Set <Database>()
             where e.DatabaseId == entity.DatabaseId
             select e).FirstOrDefault());
 }
 protected override Database AddEntity(SystemCoreContext entityContext, Database entity)
 {
     return(entityContext.Set <Database>().Add(entity));
 }
Exemple #25
0
 protected override Client UpdateEntity(SystemCoreContext entityContext, Client entity)
 {
     return((from e in entityContext.Set <Client>()
             where e.ClientId == entity.ClientId
             select e).FirstOrDefault());
 }
Exemple #26
0
 protected override Client AddEntity(SystemCoreContext entityContext, Client entity)
 {
     return(entityContext.Set <Client>().Add(entity));
 }
Exemple #27
0
 protected override UserSession UpdateEntity(SystemCoreContext entityContext, UserSession entity)
 {
     return((from e in entityContext.Set <UserSession>()
             where e.UserSessionId == entity.UserSessionId
             select e).FirstOrDefault());
 }
Exemple #28
0
 protected override IEnumerable <UserSession> GetEntities(SystemCoreContext entityContext)
 {
     return(from e in entityContext.Set <UserSession>()
            select e);
 }
Exemple #29
0
 protected override AuditTrail UpdateEntity(SystemCoreContext entityContext, AuditTrail entity)
 {
     return((from e in entityContext.Set <AuditTrail>()
             where e.AuditTrailId == entity.AuditTrailId
             select e).FirstOrDefault());
 }
Exemple #30
0
 protected override AuditTrail AddEntity(SystemCoreContext entityContext, AuditTrail entity)
 {
     return(entityContext.Set <AuditTrail>().Add(entity));
 }