示例#1
0
        public OrgResponse GetOrgRandomResponseForMainPage()
        {
            var context = new SpecialistDataContext();

            return(context.GetTable <OrgResponse>().Where(x => x.ShortDescription != null)
                   .OrderBy(x => context.GetNewID()).FirstOrDefault());
        }
示例#2
0
        public List <Advice> GetRandomAdvices()
        {
            var context = new SpecialistDataContext();

            return(context.GetTable <Advice>().IsActive()
                   .OrderBy(x => context.GetNewID()).Take(CommonConst.AdviceCount).ToList());
        }
示例#3
0
        public List <Response> GetRandomForWebinar()
        {
            var context = new SpecialistDataContext();

            return(context.GetTable <Response>().IsActive()
                   .Where(x => x.IsWebinar)
                   .OrderBy(x => context.GetNewID()).Take(15).ToList());
        }
示例#4
0
        public Response GetRandomForMainPage(List <string> courseTCs)
        {
            var context  = new SpecialistDataContext();
            var response =
                context.GetTable <Response>().IsActive()
                .Where(x => x.Rating == ResponseRating.ForMain &&
                       courseTCs.Contains(x.Course_TC))
                .OrderBy(x => context.GetNewID()).FirstOrDefault();

            if (response != null)
            {
                return(response);
            }
            return(context.GetTable <Response>().IsActive()
                   .Where(x => x.Rating == ResponseRating.ForMain)
                   .OrderBy(x => context.GetNewID()).FirstOrDefault());
        }
示例#5
0
        public List <Response> GetRandomResponsesByCourse(string CourseTC, int rows)
        {
            var context = new SpecialistDataContext();

            return(context.GetTable <Response>().IsActive()
                   .Where(x => x.Type == RawQuestionnaireType.CourseComment).Where(r => r.Course_TC == CourseTC)
                   .OrderBy(x => context.GetNewID()).Take(rows).ToList());
        }