public IQueryable <V_EmployeeSurveySubject> GetSubjectViewListByMasterID(string masterId) { EmployeeSurveyViewDal employeeSurveyViewDal = new EmployeeSurveyViewDal(); var s = from subject in employeeSurveyViewDal.GetSubjectList() where subject.REQUIREMASTERID == masterId join ans in employeeSurveyViewDal.GetAnswerList() on new { subject.REQUIREMASTERID, subject.SUBJECTID } equals new { ans.REQUIREMASTERID, ans.SUBJECTID } into answer select new V_EmployeeSurveySubject { SubjectInfo = subject, AnswerList = answer }; if (s.Count() > 0) { return(s); } return(null); }
//参与调查时用 ||平台审核进入时用 public IQueryable <V_EmployeeSurvey> Get_ESurvey(string requireMasterID) { EmployeeSurveyViewDal employeeSurveyViewDal = new EmployeeSurveyViewDal(); var vanswer = (from answ in employeeSurveyViewDal.GetAnswerList() orderby answ.CODE ascending select answ); var m = from master in employeeSurveyViewDal.GetMasterList() join sub in (from subject in employeeSurveyViewDal.GetSubjectList() join ans in vanswer on new { subject.REQUIREMASTERID, subject.SUBJECTID } equals new { ans.REQUIREMASTERID, ans.SUBJECTID } into answer orderby subject.SUBJECTID ascending select new V_EmployeeSurveySubject { SubjectInfo = subject, AnswerList = answer } ) on master.REQUIREMASTERID equals sub.SubjectInfo.REQUIREMASTERID into subject where master.REQUIREMASTERID == requireMasterID select new V_EmployeeSurvey { RequireMaster = master, SubjectViewList = subject }; // m = m.Where(ent => ent.RequireMaster.REQUIREMASTERID == requireMasterID); return(m); }
//审核通过的调查方案 public IQueryable <V_EmployeeSurvey> Get_ESurveyChecked(int pageIndex, int pageSize, string sort, string filterString, object[] paras, ref int pageCount, string userId, List <string> guidStringList, string checkState) { EmployeeSurveyViewDal employeeSurveyViewDal = new EmployeeSurveyViewDal(); DateTime d = DateTime.Parse(paras[0].ToString()).Date; DateTime d2 = DateTime.Parse(paras[1].ToString()).AddDays(1); var m = from master in employeeSurveyViewDal.GetMasterList() join sub in (from subject in employeeSurveyViewDal.GetSubjectList() join ans in (from answ in employeeSurveyViewDal.GetAnswerList() orderby answ.CREATEDATE select answ) on new { subject.REQUIREMASTERID, subject.SUBJECTID } equals new { ans.REQUIREMASTERID, ans.SUBJECTID } into answer select new V_EmployeeSurveySubject { SubjectInfo = subject, AnswerList = answer } ) on master.REQUIREMASTERID equals sub.SubjectInfo.REQUIREMASTERID into subject select new V_EmployeeSurvey { RequireMaster = master, SubjectViewList = subject }; m = m.Where(ent => ent.RequireMaster.CHECKSTATE == checkState && ent.RequireMaster.CREATEDATE >= d && ent.RequireMaster.CREATEDATE < d2); return(m); }