public List <Project> getAdminalPanelActiveProjects()
        {
            string         initialQuery = "";
            List <Project> projects     = new List <Project>();
            TeamMembers    member       = authRepo.getLoggedInUser();

            if (authRepo.getAdminRights())
            {
                initialQuery = "SELECT * FROM [Project] WHERE Enabled=1 order by Name asc";
                projects     = this._db.Query <Project>(initialQuery).ToList();
            }
            else if (authRepo.getTeamLeadRightsForAnyAccount())
            {
                initialQuery = "SELECT * FROM [Project] WHERE Enabled=1 and AccountId In(select distinct (e.AccountId) from EmployeeProjects e,Account ac where e.AccountId=ac.Id and ((e.EmpId=" + member.Id + " and e.Lead=1) or ac.AccountOwner=" + member.Id + ")) order by Name asc";
                projects     = this._db.Query <Project>(initialQuery).ToList();
            }
            return(projects);
        }
Beispiel #2
0
        public List <Account> getAdminPanelActiveAccounts()
        {
            string initialQuery = "";
            //set.getThreshold();
            List <Account> accounts = new List <Account>();
            TeamMembers    member   = authRepo.getLoggedInUser();

            if (authRepo.getAdminRights())
            {
                initialQuery = "SELECT * FROM [Account] WHERE Availability=1 order by AccountName asc";
                accounts     = this._db.Query <Account>(initialQuery).ToList();
            }
            else if (authRepo.getTeamLeadRightsForAnyAccount())
            {
                initialQuery = "SELECT a.* FROM [Account] a WHERE Availability=1 and ((a.Id In(select distinct (e.AccountId) from EmployeeProjects e where e.EmpId=" + member.Id + " and e.Lead=1)) or a.AccountOwner=" + member.Id + ") order by a.AccountName asc";
                accounts     = this._db.Query <Account>(initialQuery).ToList();
            }

            return(accounts);
        }