public async Task <ProjectUrlData> GetUrlByProject(int projectId)
        {
            ProjectUrlData result = await _controller.QuerySingleOrDefaultAsync <ProjectUrlData>(
                "SELECT * " +
                "FROM IPR.tProjectUrl p " +
                "WHERE p.ProjectId = @ProjectId",
                new { ProjectId = projectId });

            return(result);
        }
        public async Task <bool> VerifyGrantLevelByUserId(int grantLevel, int aclId, int userId, Operator op)
        {
            int result = 0;

            if (op == Operator.SuperiorOrEqual)
            {
                result = await _controller.QuerySingleOrDefaultAsync <int>
                             ("select * from CK.vAclActor a where a.ActorId = @ActorId and a.AclId = @Acl and a.GrantLevel >= @GrantLevel",
                             new { ActorId = userId, Acl = aclId, GrantLevel = grantLevel });
            }
            else if (op == Operator.InferiorOrEqual)
            {
                result = await _controller.QuerySingleOrDefaultAsync <int>
                             ("select * from CK.vAclActor a where a.ActorId = @ActorId and a.AclId = @Acl and a.GrantLevel <= @GrantLevel",
                             new { ActorId = userId, Acl = aclId, GrantLevel = grantLevel });
            }
            else if (op == Operator.Equal)
            {
                result = await _controller.QuerySingleOrDefaultAsync <int>
                             ("select * from CK.vAclActor a where a.ActorId = @ActorId and a.AclId = @Acl and a.GrantLevel = @GrantLevel",
                             new { ActorId = userId, Acl = aclId, GrantLevel = grantLevel });
            }
            else if (op == Operator.StrictlyInferior)
            {
                result = await _controller.QuerySingleOrDefaultAsync <int>
                             ("select * from CK.vAclActor a where a.ActorId = @ActorId and a.AclId = @Acl and a.GrantLevel < @GrantLevel",
                             new { ActorId = userId, Acl = aclId, GrantLevel = grantLevel });
            }
            else if (op == Operator.StrictlySuperior)
            {
                result = await _controller.QuerySingleOrDefaultAsync <int>
                             ("select * from CK.vAclActor a where a.ActorId = @ActorId and a.AclId = @Acl and a.GrantLevel > @GrantLevel",
                             new { ActorId = userId, Acl = aclId, GrantLevel = grantLevel });
            }


            if (result == 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
        public async Task <TimedUserData> GetAllTimedUserByUserId(int userId)
        {
            TimedUserData result = await _controller.QuerySingleOrDefaultAsync <TimedUserData>("select * from IPR.tTimedUser tu where tu.UserId = @UserId", new { UserId = userId });

            return(result);
        }
Exemple #4
0
        public async Task <int> IsProjectJudgedByJury(int projectId, int juryId)
        {
            int result = await _controller.QuerySingleOrDefaultAsync <int>("select JuryId from IPR.tEvaluates WHERE JuryId = @JuryId and ProjectId = @ProjectId", new { @JuryId = juryId, @ProjectId = projectId });

            return(result);
        }
        public async Task <int> VerifyGroupUser(int idUser, int idGroup)
        {
            int isExist = await _controller.QuerySingleOrDefaultAsync <int>("select ActorId from CK.tActorProfile where GroupId = @GroupId and ActorId = @ActorId;", new { GroupId = idGroup, ActorId = idUser });

            return(isExist);
        }
        public async Task <PeriodData> GetLastPeriodBySchool(int schoolId)
        {
            PeriodData result = await _controller.QuerySingleOrDefaultAsync <PeriodData>("SELECT TOP(1) OrderedChild = ChildOrderByKey.ToString(), ChildId, ZoneId, BegDate, EndDate FROM CK.vZoneDirectChildren JOIN IPR.tTimePeriod  on ChildId = TimePeriodId WHERE ZoneId = @ZoneId ORDER BY ChildOrderByKey DESC; ", new { ZoneId = schoolId });

            return(result);
        }
Exemple #7
0
        public async Task <int> GetSpecificIdGroupByZoneIdAndGroupName(int zoneId, string groupName)
        {
            int result = await _controller.QuerySingleOrDefaultAsync <int>("SELECT GroupId FROM CK.tGroup where GroupName = @GroupName AND ZoneId =@ZoneId;", new { ZoneId = zoneId, GroupName = groupName });

            return(result);
        }