public async Task <ServiceResponse <PagedList <JobCandidatesView> > > GetJobCandidatesByStatus(int id, CustomPagingRequest request) { var response = new ServiceResponse <PagedList <JobCandidatesView> >(); try { var user = _context.Users.Find(LoggedInUser); var candidates = await(from x in _context.JobCandidates join j in _context.Openings on x.jobid equals j.id join s in _context.MasterData on x.status equals s.id join t in _context.MasterData on x.totalExp equals t.id into totalExps from t in totalExps.DefaultIfEmpty() join r in _context.MasterData on x.relavantExp equals r.id into relavantExps from r in relavantExps.DefaultIfEmpty() join b in _context.MasterData on x.bestWayToReach equals b.id into bestways from b in bestways.DefaultIfEmpty() join v in _context.MasterData on x.visaType equals v.id into visaTypes from v in visaTypes.DefaultIfEmpty() join h in _context.MasterData on x.highestQualification equals h.id into qualifications from h in qualifications.DefaultIfEmpty() join st in _context.State on x.state equals st.Id into states from st in states.DefaultIfEmpty() join ci in _context.Citys on x.city equals ci.Id into cities from ci in cities.DefaultIfEmpty() join cu in _context.Countries on j.country equals cu.Id join cr in _context.Users on x.createdBy equals cr.id join md in _context.Users on x.modifiedBy equals md.id into modifies from md in modifies.DefaultIfEmpty() where x.status == id && j.country == user.country select new JobCandidatesView() { jobid = x.jobid, firstName = x.firstName, id = x.id, lastName = x.lastName, middleName = x.middleName, phone = x.phone, resume = x.resume, status = s.id, statusName = s.name, email = x.email, fileName = x.fileName, jobName = j.jobid, anyOfferExist = x.anyOfferExist, bestTimeToReach = x.bestTimeToReach, bestWayToReach = x.bestWayToReach, city = x.city, educationDetails = x.educationDetails, expectedRatePerHour = x.expectedRatePerHour, highestQualification = x.highestQualification, relavantExp = x.relavantExp, rtr = x.rtr, skypeid = x.skypeid, state = x.state, totalExp = x.totalExp, visaType = x.visaType, totalExpName = t.name, relavantExpName = r.name, bestWayToReachName = b.name, highestQualificationName = h.name, visaTypeName = v.name, cityName = ci.Name, stateName = st.Name, countryCode = cu.Code, modifiedDate = x.modifiedDate, createdDate = x.createdDate, createdBy = x.createdBy, modifiedBy = x.modifiedBy, createdByName = Common.GetFullName(cr), modifiedByName = Common.GetFullName(md) }).AsQueryable().ToListAsync(); var query = (from x in _context.RecruitCare join y in _context.Openings on x.jobid equals y.id join s in _context.MasterData on x.status equals s.id join c in _context.Users on x.createdBy equals c.id join m in _context.Users on x.modifiedBy equals m.id into modifiedUsers from m in modifiedUsers.DefaultIfEmpty() join n in _context.MasterData on x.noticePeriod equals n.id into notices from n in notices.DefaultIfEmpty() join t in _context.MasterData on x.totalExp equals t.id join r in _context.MasterData on x.relavantExp equals r.id join b in _context.MasterData on x.bestWayToReach equals b.id into bestways from b in bestways.DefaultIfEmpty() join v in _context.MasterData on x.visaType equals v.id into visaTypes from v in visaTypes.DefaultIfEmpty() join h in _context.MasterData on x.highestQualification equals h.id into qualifications from h in qualifications.DefaultIfEmpty() join st in _context.State on x.state equals st.Id join ci in _context.Citys on x.city equals ci.Id join co in _context.Countries on y.country equals co.Id where x.status == id && y.country == user.country select new JobCandidatesView() { jobid = y.id, jobName = y.jobid, createdBy = x.createdBy, createdByName = Common.GetFullName(c), email = x.email, id = x.id, modifiedBy = x.modifiedBy, modifiedByName = Common.GetFullName(m), modifiedDate = x.modifiedDate, createdDate = x.createdDate.Value, firstName = x.firstName, lastName = x.lastName, middleName = x.middleName, phone = x.phone, status = x.status, statusName = s.name, fileName = x.fileName, anyOfferExist = x.anyOfferExist, bestTimeToReach = x.bestTimeToReach, bestWayToReach = x.bestWayToReach, city = x.city, educationDetails = x.educationDetails, expectedRatePerHour = x.expectedRatePerHour, highestQualification = x.highestQualification, relavantExp = x.relavantExp, rtr = x.rtr, skypeid = x.skypeid, state = x.state, totalExp = x.totalExp, visaType = x.visaType, totalExpName = t.name, relavantExpName = r.name, bestWayToReachName = b.name, highestQualificationName = h.name, visaTypeName = v.name, cityName = ci.Name, stateName = st.Name, countryCode = co.Code, currentCTC = x.currentCTC, expectedCTC = x.expectedCTC }).AsQueryable(); switch (request.sort) { case "jobid": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.id) : query.OrderBy(x => x.id)); break; case "jobName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.jobName) : query.OrderBy(x => x.jobName)); break; case "createdBy": case "createdByName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.createdBy) : query.OrderBy(x => x.createdBy)); break; case "createdDate": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.createdDate) : query.OrderBy(x => x.createdDate)); break; case "modifiedBy": case "modifiedName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.modifiedBy) : query.OrderBy(x => x.modifiedBy)); break; case "modifiedDate": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.modifiedDate) : query.OrderBy(x => x.modifiedDate)); break; case "id": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.id) : query.OrderBy(x => x.id)); break; case "email": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.email) : query.OrderBy(x => x.email)); break; case "firstName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.firstName) : query.OrderBy(x => x.firstName)); break; case "middleName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.middleName) : query.OrderBy(x => x.middleName)); break; case "lastName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.lastName) : query.OrderBy(x => x.lastName)); break; case "phone": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.phone) : query.OrderBy(x => x.phone)); break; case "status": case "statusName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.status) : query.OrderBy(x => x.status)); break; case "fileName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.fileName) : query.OrderBy(x => x.fileName)); break; case "anyOfferExist": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.anyOfferExist) : query.OrderBy(x => x.anyOfferExist)); break; case "bestWayToReach": case "bestWayToReachName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.bestWayToReach) : query.OrderBy(x => x.bestWayToReach)); break; case "bestTimeToReach": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.bestTimeToReach) : query.OrderBy(x => x.bestTimeToReach)); break; case "city": case "cityName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.city) : query.OrderBy(x => x.city)); break; case "educationDetails": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.educationDetails) : query.OrderBy(x => x.educationDetails)); break; case "expectedRatePerHour": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.expectedRatePerHour) : query.OrderBy(x => x.expectedRatePerHour)); break; case "highestQualification": case "highestQualificationName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.highestQualification) : query.OrderBy(x => x.highestQualification)); break; case "relavantExp": case "relavantExpName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.relavantExp) : query.OrderBy(x => x.relavantExp)); break; case "rtr": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.rtr) : query.OrderBy(x => x.rtr)); break; case "skypeid": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.skypeid) : query.OrderBy(x => x.skypeid)); break; case "state": case "stateName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.state) : query.OrderBy(x => x.state)); break; case "totalExp": case "totalExpName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.totalExp) : query.OrderBy(x => x.totalExp)); break; case "visaType": case "visaTypeName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.visaType) : query.OrderBy(x => x.visaType)); break; case "countryCode": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.countryCode) : query.OrderBy(x => x.countryCode)); break; case "currentCTC": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.currentCTC) : query.OrderBy(x => x.currentCTC)); break; case "expectedCTC": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.expectedCTC) : query.OrderBy(x => x.expectedCTC)); break; default: break; } response.Data = new PagedList <JobCandidatesView>( query, request); response.Success = true; response.Message = "Success"; } catch (Exception ex) { response.Success = false; response.Message = await CustomLog.Log(ex, _context); } return(response); }
public async Task <ActionResult> GetUsers(CustomPagingRequest request) { var response = new ServiceResponse <PagedList <UserView> >(); try { var query = (from x in _context.Users join y in _context.MasterData on x.roleId equals y.id join c in _context.Countries on x.country equals c.Id into countries from c in countries.DefaultIfEmpty() select new UserView() { id = x.id, email = x.email, firstName = x.firstName, lastName = x.lastName, middleName = x.middleName, role = y.name, userid = x.userid, roleId = x.roleId, countryName = c.Name, countryId = c.Id, active = x.active, modifiedDate = x.modifiedDate, createdDate = x.createdDate, createdBy = x.createdBy, modifiedBy = x.modifiedBy }).AsQueryable(); switch (request.sort) { case "id": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.id) : query.OrderBy(x => x.id)); break; case "email": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.email) : query.OrderBy(x => x.email)); break; case "firstName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.firstName) : query.OrderBy(x => x.firstName)); break; case "lastName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.lastName) : query.OrderBy(x => x.lastName)); break; case "middleName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.middleName) : query.OrderBy(x => x.middleName)); break; case "role": case "roleId": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.roleId) : query.OrderBy(x => x.roleId)); break; case "userid": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.userid) : query.OrderBy(x => x.userid)); break; case "countryName": case "countryId": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.countryId) : query.OrderBy(x => x.countryId)); break; case "active": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.active) : query.OrderBy(x => x.active)); break; case "modifiedDate": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.modifiedDate) : query.OrderBy(x => x.modifiedDate)); break; case "createdDate": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.createdDate) : query.OrderBy(x => x.createdDate)); break; case "createdBy": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.createdBy) : query.OrderBy(x => x.createdBy)); break; case "modifiedBy": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.modifiedBy) : query.OrderBy(x => x.modifiedBy)); break; default: break; } response.Data = new PagedList <UserView>( query, request); response.Success = true; response.Message = "Success"; } catch (Exception ex) { response.Message = await CustomLog.Log(ex, _context); response.Success = false; } return(Ok(response)); }
public async Task <ServiceResponse <PagedList <CityView> > > GetCitys(CustomPagingRequest request) { var response = new ServiceResponse <PagedList <CityView> >(); try { var query = (from x in _context.Citys join y in _context.State on x.State equals y.Id join z in _context.Countries on y.Country equals z.Id join c in _context.Users on x.createdBy equals c.id join m in _context.Users on x.modifiedBy equals m.id into modifies from m in modifies.DefaultIfEmpty() select new CityView() { modifiedBy = x.modifiedBy, countryName = z.Name, createdBy = x.createdBy, createdByName = Common.GetFullName(c), createdDate = x.createdDate, modifiedByName = Common.GetFullName(m), modifiedDate = x.modifiedDate, stateName = y.Name, Name = x.Name, Id = x.Id, State = x.State, country = y.Country }).AsQueryable(); switch (request.sort) { case "countryName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.country) : query.OrderBy(x => x.country)); break; case "modifiedBy": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.modifiedBy) : query.OrderBy(x => x.modifiedBy)); break; case "createdBy": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.createdBy) : query.OrderBy(x => x.createdBy)); break; case "createdDate": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.createdDate) : query.OrderBy(x => x.createdDate)); break; case "modifiedName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.modifiedBy) : query.OrderBy(x => x.modifiedBy)); break; case "modifiedDate": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.modifiedDate) : query.OrderBy(x => x.modifiedDate)); break; case "id": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.Id) : query.OrderBy(x => x.Id)); break; case "stateName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.State) : query.OrderBy(x => x.State)); break; default: break; } response.Data = new PagedList <CityView>( query, request); response.Success = true; response.Message = "Data Retrived"; } catch (Exception ex) { response.Success = false; response.Message = await CustomLog.Log(ex, _context); } return(response); }
public async Task <ActionResult <ServiceResponse <OpeningsList> > > GetOpeningsByCountry(string type, CustomPagingRequest request) { var response = new ServiceResponse <OpeningsList>(); try { var countries = _context.Countries.ToList(); var user = _context.Users.FirstOrDefault(x => x.id == LoggedInUser); if (user != null && user.roleId != (int)Roles.SuperAdmin) { countries = countries.Where(x => x.Id == user.country).ToList(); } switch (type) { case "in": countries = countries.Where(x => x.Code == "IN").ToList(); break; case "gl": countries = countries.Where(x => x.Code != "IN").ToList(); break; } var countryCodes = countries.Select(x => x.Id).ToList(); response.Data = new OpeningsList(); var query = (from o in _context.Openings join a in _context.Users on o.assaignedTo equals a.id into assaigns from a in assaigns.DefaultIfEmpty() join c in _context.Citys on o.city equals c.Id join cl in _context.ClientCodes on o.client equals cl.Id join co in _context.Users on o.contactName equals co.id into contacts from co in contacts.DefaultIfEmpty() join am in _context.Users on o.accountManager equals am.id into accounts from am in accounts.DefaultIfEmpty() join s in _context.MasterData on o.status equals s.id join cou in _context.Countries on o.country equals cou.Id join cr in _context.Users on o.createdBy equals cr.id join md in _context.Users on o.modifiedBy equals md.id into modifies from md in modifies.DefaultIfEmpty() where countryCodes.Contains(o.country) select new OpeningsListView() { id = o.id, accountManager = Common.GetFullName(am), account = o.accountManager, assaignedTo = Common.GetFullName(a), assaigned = o.assaignedTo, city = c.Name, client = cl.Name, contactName = Common.GetFullName(co), contact = o.contactName, jobid = o.id, jobName = o.jobid, jobtitle = o.jobtitle, status = s.name, targetdate = o.targetdate, canEdit = (user != null && user.roleId == (int)Roles.SuperAdmin) || (o.createdBy == LoggedInUser || o.modifiedBy == LoggedInUser), countryCode = cou.Code, createdByName = Common.GetFullName(cr), createdDate = o.createdDate, modifiedDate = o.modifiedDate, modifiedName = Common.GetFullName(md), createdBy = o.createdBy, modifiedBy = o.modifiedBy }).AsQueryable(); switch (request.sort) { case "accountManager": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.account) : query.OrderBy(x => x.account)); break; case "assaignedTo": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.assaigned) : query.OrderBy(x => x.assaigned)); break; case "city": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.city) : query.OrderBy(x => x.city)); break; case "client": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.client) : query.OrderBy(x => x.client)); break; case "contactName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.contact) : query.OrderBy(x => x.contact)); break; case "modifiedDate": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.modifiedDate) : query.OrderBy(x => x.modifiedDate)); break; case "id": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.id) : query.OrderBy(x => x.id)); break; case "jobName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.jobid) : query.OrderBy(x => x.jobid)); break; case "jobid": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.id) : query.OrderBy(x => x.id)); break; case "jobtitle": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.jobtitle) : query.OrderBy(x => x.jobtitle)); break; case "status": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.status) : query.OrderBy(x => x.status)); break; case "targetdate": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.targetdate) : query.OrderBy(x => x.targetdate)); break; case "createdByName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.createdBy) : query.OrderBy(x => x.createdBy)); break; case "createdDate": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.createdDate) : query.OrderBy(x => x.createdDate)); break; case "modifiedName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.modifiedBy) : query.OrderBy(x => x.modifiedBy)); break; default: break; } response.Data.Jobs = new PagedList <OpeningsListView>( query, request); response.Data.Candidates = await(from x in _context.JobCandidates join j in _context.Openings on x.jobid equals j.id join s in _context.MasterData on x.status equals s.id join t in _context.MasterData on x.totalExp equals t.id into totalExps from t in totalExps.DefaultIfEmpty() join r in _context.MasterData on x.relavantExp equals r.id into relavantExps from r in relavantExps.DefaultIfEmpty() join b in _context.MasterData on x.bestWayToReach equals b.id into bestways from b in bestways.DefaultIfEmpty() join v in _context.MasterData on x.visaType equals v.id into visaTypes from v in visaTypes.DefaultIfEmpty() join h in _context.MasterData on x.highestQualification equals h.id into qualifications from h in qualifications.DefaultIfEmpty() join st in _context.State on x.state equals st.Id into states from st in states.DefaultIfEmpty() join ci in _context.Citys on x.city equals ci.Id into cities from ci in cities.DefaultIfEmpty() join cu in _context.Countries on j.country equals cu.Id where response.Data.Jobs.List.Select(x => x.jobid).Contains(x.jobid) && (user != null && user.roleId == (int)Roles.SuperAdmin) || (x.createdBy == LoggedInUser || x.modifiedBy == LoggedInUser) select new JobCandidatesView() { jobid = x.jobid, firstName = x.firstName, id = x.id, lastName = x.lastName, middleName = x.middleName, phone = x.phone, resume = x.resume, status = s.id, statusName = s.name, email = x.email, fileName = x.fileName, jobName = j.jobid, anyOfferExist = x.anyOfferExist, bestTimeToReach = x.bestTimeToReach, bestWayToReach = x.bestWayToReach, city = x.city, educationDetails = x.educationDetails, expectedRatePerHour = x.expectedRatePerHour, highestQualification = x.highestQualification, relavantExp = x.relavantExp, rtr = x.rtr, skypeid = x.skypeid, state = x.state, totalExp = x.totalExp, visaType = x.visaType, totalExpName = t.name, relavantExpName = r.name, bestWayToReachName = b.name, highestQualificationName = h.name, visaTypeName = v.name, cityName = ci.Name, stateName = st.Name, countryCode = cu.Code, currentCTC = x.currentCTC, expectedCTC = x.expectedCTC }).ToListAsync(); response.Success = true; response.Message = "Success"; } catch (Exception ex) { response.Success = false; response.Message = await CustomLog.Log(ex, _context); } return(Ok(response)); }
public async Task <ServiceResponse <PagedList <RecruitCareView> > > GetRecruitCareByMe(CustomPagingRequest request) { var response = new ServiceResponse <PagedList <RecruitCareView> >(); try { var user = _context.Users.FirstOrDefault(x => x.id == LoggedInUser); var query = (from x in _context.RecruitCare join y in _context.Openings on x.jobid equals y.id join s in _context.MasterData on x.status equals s.id join c in _context.Users on x.createdBy equals c.id join m in _context.Users on x.modifiedBy equals m.id into modifiedUsers from m in modifiedUsers.DefaultIfEmpty() join n in _context.MasterData on x.noticePeriod equals n.id into notices from n in notices.DefaultIfEmpty() join t in _context.MasterData on x.totalExp equals t.id join r in _context.MasterData on x.relavantExp equals r.id join b in _context.MasterData on x.bestWayToReach equals b.id into bestways from b in bestways.DefaultIfEmpty() join v in _context.MasterData on x.visaType equals v.id into visaTypes from v in visaTypes.DefaultIfEmpty() join h in _context.MasterData on x.highestQualification equals h.id into qualifications from h in qualifications.DefaultIfEmpty() join st in _context.State on x.state equals st.Id join ci in _context.Citys on x.city equals ci.Id join co in _context.Countries on y.country equals co.Id where (user != null && user.roleId == (int)Roles.SuperAdmin) || (x.createdBy == LoggedInUser || x.modifiedBy == LoggedInUser) || (user != null && user.roleId == (int)Roles.TeamLead && y.country == user.country ? true : false) select new RecruitCareView() { jobid = y.id, jobName = y.jobid, comments = x.comments, createdBy = x.createdBy, createdByName = Common.GetFullName(c), email = x.email, id = x.id, modifiedBy = x.modifiedBy, modifiedName = Common.GetFullName(m), modifiedDate = x.modifiedDate, name = Common.GetFullName(x), createdDate = x.createdDate.Value, firstName = x.firstName, lastName = x.lastName, middleName = x.middleName, phone = x.phone, status = x.status, statusName = s.name, fileName = x.fileName, noticePeriod = x.noticePeriod, notice = n.name, anyOfferExist = x.anyOfferExist, bestTimeToReach = x.bestTimeToReach, bestWayToReach = x.bestWayToReach, city = x.city, educationDetails = x.educationDetails, expectedRatePerHour = x.expectedRatePerHour, highestQualification = x.highestQualification, relavantExp = x.relavantExp, rtr = x.rtr, skypeid = x.skypeid, state = x.state, totalExp = x.totalExp, visaType = x.visaType, totalExpName = t.name, relavantExpName = r.name, bestWayToReachName = b.name, highestQualificationName = h.name, visaTypeName = v.name, cityName = ci.Name, stateName = st.Name, countryCode = co.Code, currentCTC = x.currentCTC, expectedCTC = x.expectedCTC }).AsQueryable(); switch (request.sort) { case "jobName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.jobName) : query.OrderBy(x => x.jobName)); break; case "name": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.firstName) : query.OrderBy(x => x.firstName)); break; case "phone": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.phone) : query.OrderBy(x => x.phone)); break; case "statusName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.statusName) : query.OrderBy(x => x.statusName)); break; case "createdByName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(c => c.createdBy) : query.OrderBy(x => x.createdBy)); break; case "createdDate": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.createdDate) : query.OrderBy(x => x.createdDate)); break; case "modifiedName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.modifiedBy) : query.OrderBy(x => x.modifiedBy)); break; case "modifiedDate": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.modifiedDate) : query.OrderBy(x => x.modifiedDate)); break; case "notice": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.notice) : query.OrderBy(x => x.notice)); break; case "fileName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.fileName) : query.OrderBy(x => x.fileName)); break; case "email": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.email) : query.OrderBy(x => x.email)); break; case "comments": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.comments) : query.OrderBy(x => x.comments)); break; case "stateName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.state) : query.OrderBy(x => x.state)); break; case "cityName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.city) : query.OrderBy(x => x.city)); break; case "totalExpName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.totalExp) : query.OrderBy(x => x.totalExp)); break; case "relavantExpName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.relavantExp) : query.OrderBy(x => x.relavantExp)); break; case "bestWayToReachName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.bestWayToReach) : query.OrderBy(x => x.bestWayToReach)); break; case "visaTypeName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.visaType) : query.OrderBy(x => x.visaType)); break; case "highestQualificationName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.highestQualification) : query.OrderBy(x => x.highestQualification)); break; case "currentCTC": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.currentCTC) : query.OrderBy(x => x.currentCTC)); break; case "expectedCTC": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.expectedCTC) : query.OrderBy(x => x.expectedCTC)); break; default: query = query.OrderByDescending(x => x.createdDate); break; } response.Data = new PagedList <RecruitCareView>( query, request); response.Success = true; response.Message = "Success"; } catch (Exception ex) { response.Success = false; response.Message = await CustomLog.Log(ex, _context); } return(response); }
public async Task <ServiceResponse <PagedList <MasterDataView> > > GetMasterData(CustomPagingRequest request) { var response = new ServiceResponse <PagedList <MasterDataView> >(); try { var query = (from x in _context.MasterData join y in _context.MasterDataType on x.type equals y.id join c in _context.Users on x.createdBy equals c.id join m in _context.Users on x.modifiedBy equals m.id into modifies from m in modifies.DefaultIfEmpty() select new MasterDataView() { id = x.id, modifiedBy = x.modifiedBy, createdBy = x.createdBy, createdDate = x.createdDate, createdName = Common.GetFullName(c), modifiedName = Common.GetFullName(m), modifiedDate = x.modifiedDate, name = x.name, type = x.type, typeName = y.name }).AsQueryable(); switch (request.sort) { case "type": case "typeName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.type) : query.OrderBy(x => x.type)); break; case "modifiedBy": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.modifiedBy) : query.OrderBy(x => x.modifiedBy)); break; case "createdBy": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.createdBy) : query.OrderBy(x => x.createdBy)); break; case "createdDate": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.createdDate) : query.OrderBy(x => x.createdDate)); break; case "modifiedName": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.modifiedBy) : query.OrderBy(x => x.modifiedBy)); break; case "modifiedDate": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.modifiedDate) : query.OrderBy(x => x.modifiedDate)); break; case "id": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.id) : query.OrderBy(x => x.id)); break; case "name": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.name) : query.OrderBy(x => x.name)); break; default: break; } response.Data = new PagedList <MasterDataView>( query, request); response.Success = true; response.Message = "Data Retrived"; } catch (Exception ex) { response.Success = false; response.Message = await CustomLog.Log(ex, _context); } return(response); }
public async Task <ServiceResponse <PagedList <UserSessionView> > > GetUserSession(CustomPagingRequest request) { var response = new ServiceResponse <PagedList <UserSessionView> >(); try { var user = _context.Users.Find(LoggedInUser); var query = (from x in _context.UserSession join y in _context.Users on x.userid equals y.id where (y.roleId == (int)Roles.SuperAdmin) || ((y.roleId == (int)Roles.Recruiter) && y.country == user.country) select new UserSessionView() { userid = x.userid, sessionId = x.sessionId, inTime = x.inTime, name = Common.GetFullName(y), outTime = x.outTime, minutes = x.outTime == null ? 0 : (x.outTime.Value - x.inTime).TotalMinutes }).AsQueryable(); switch (request.sort) { case "userid": case "name": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.userid) : query.OrderBy(x => x.userid)); break; case "sessionId": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.sessionId) : query.OrderBy(x => x.sessionId)); break; case "inTime": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.inTime) : query.OrderBy(x => x.inTime)); break; case "outTime": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.outTime) : query.OrderBy(x => x.outTime)); break; case "minutes": query = (request.sortOrder == "Descending" ? query.OrderByDescending(x => x.minutes) : query.OrderBy(x => x.minutes)); break; default: break; } response.Data = new PagedList <UserSessionView>( query, request); response.Success = true; response.Message = "Retrived"; } catch (Exception ex) { response.Success = true; response.Message = await CustomLog.Log(ex, _context); } return(response); }