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); }
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); }
public List <TeamSatisfactionEmployeeSummary> getSelectedQuarterSummary(int accountId, int year, int quarter) { TeamMembers member = authRepo.getLoggedInUser(); string query = ""; if (authRepo.getAdminRights() | authRepo.getTeamLeadRights(accountId)) { query = "SELECT [Id],[EmpId],[AccountId],[Year],[Quarter],[Rating] FROM [TeamSatisfactionEmployeeSummary] where AccountId='" + accountId + "' and Year='" + year + "' and Quarter='" + quarter + "' order by EmpId asc"; } else { query = "SELECT [Id],[EmpId],[AccountId],[Year],[Quarter],[Rating] FROM [TeamSatisfactionEmployeeSummary] where AccountId='" + accountId + "' and Year='" + year + "' and Quarter='" + quarter + "' and EmpId=" + member.Id + ""; } return(this._db.Query <TeamSatisfactionEmployeeSummary>(query).ToList()); }