public JsonResult SelectInterviews(int?interviewerId, InterviewFilter filter, DateTime?from, DateTime?to, DataTableAjaxPostModel model)
        {
            string sortBy  = "Date";
            bool   sortDir = true;

            if (model.order != null)
            {
                // in this example we just default sort on the 1st column
                sortBy  = model.columns[model.order[0].column].data;
                sortDir = model.order[0].dir.ToLower() == "asc";
            }


            int total;
            var interviews = _interviewsRepository.GetInterviews(interviewerId.Value, filter, out total, model.start, model.length, sortBy, sortDir);

            var dataItems = new DatatablesViewModel <InterviewRowItemViewModel>()
            {
                recordsTotal    = total,
                recordsFiltered = total,
                data            = interviews
            };

            return(Json(dataItems));
        }
Esempio n. 2
0
        public List <InterviewRowItemViewModel> GetInterviews(int interviewerId, InterviewFilter filter, out int total, int start = 0, int size = 10, string sortBy = "", bool sortDir = false)
        {
            var query = from i in Context.Interviews
                        join ivr in Context.Interviewers on i.InterviewerId equals ivr.Id
                        join ivw in Context.Interviewees on i.IntervieweeId equals ivw.Id
                        join sn in Context.Seniorities on i.SeniorityId equals sn.Id
                        join intech in Context.InterviewTechnologies on i.TechnologyId equals intech.Id
                        join status in Context.InterviewStatus on i.StatusId equals status.Id
                        join rt in Context.InterviewRatings on i.RatingId equals rt.Id
                        join stage in Context.InterviewStages on i.InterviewStageId equals stage.Id
                        where i.InterviewerId == interviewerId &&
                        (filter.StageIds.Count == 0 || filter.StageIds.Contains(i.InterviewStageId)) &&
                        (filter.TechnologyIds.Count == 0 || filter.TechnologyIds.Contains(i.TechnologyId)) &&
                        (filter.SeniorityIds.Count == 0 || filter.SeniorityIds.Contains(i.SeniorityId))
                        select new InterviewRowItemViewModel
            {
                Date            = i.Date,
                IntervieweeName = ivw.Name.Trim(),
                InterviewId     = i.Id,
                InterviewStage  = stage.Stage.Trim(),
                Rating          = rt.Rating,
                Seniority       = sn.SeniorityName.Trim(),
                Status          = status.Status.Trim(),
                Technology      = intech.Technology.Trim(),
                Attitude        = i.InterviewerAttitude.Trim(),
                Difficulty      = i.TaskDifficultyLevel.Trim(),
                Length          = i.InterviewLengthId,
                TestTask        = i.TestTask,
                Feedback        = i.NoteFromInterviewee.Trim(),
            };

            total = query.Count();
            var result = query.OrderBy(sortBy, sortDir).Skip(start).Take(size).ToList();

            return(result);
        }
Esempio n. 3
0
        /// <summary>
        /// This function gets the interview by the given filters
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        public Interview GetInterview(InterviewFilter filter)
        {
            var context = new dbDataContext();
            tbl_Interview interview = null;
            if (filter.Id > 0)
            {
                interview = context.tbl_Interviews.FirstOrDefault(t => t.InterviewId == filter.Id);
            }
            else if (filter.JobId > 0 && filter.InterviewType > 0)
            {
                interview = context.tbl_Interviews.FirstOrDefault(t => t.InterviewType == filter.InterviewType && t.JobId == filter.InterviewType);
            }

            if (interview != null)
            {
                return new Interview
                {
                    InterviewId = interview.InterviewId,
                    JobId = interview.JobId,
                    InterviewType = interview.InterviewType,
                    ConfirmationTemplateId = interview.ConfirmationTemplateId,
                    RequestTemplateId = interview.RequestTemplateId,
                    CreatedBy = interview.CreatedBy,
                    CreatedDate = interview.CreatedDate,
                    LastUpdatedBy = interview.LastUpdatedBy,
                    LastUpdatedDate = interview.LastUpdatedDate,
                };
            }
            return null;
        }
Esempio n. 4
0
 public ActionResult FilterAll(InterviewFilter filter)
 {
     return(Json(new InterviewQuestionnaire().FilterAll(filter), JsonRequestBehavior.AllowGet));
 }
 public Interview GetInterviewByFilters(InterviewFilter filter)
 {
     return new Interviews().GetInterview(filter);
 }