コード例 #1
0
        public List <SurveyReportModel> GetSurveyReport(decimal surveyId)
        {
            List <SurveyReportModel> lst = new List <SurveyReportModel>();

            using (LBCData context = new LBCData(ConnectionHelper.getConnectionString()))
            {
                if (surveyId != 0)
                {
                    var list = (from entity in context.LBC_SURVEY_COMPLETED_VIEW
                                where entity.SURVEY_ID == surveyId
                                select entity).ToList();
                    foreach (LBC_SURVEY_COMPLETED_VIEW item in list)
                    {
                        lst.Add(MapModelFromLBC_SURVEY_COMPLETED_VIEW(item));
                    }
                }
                else
                {
                    var list = (from entity in context.LBC_SURVEY_COMPLETED_VIEW
                                select entity).ToList();
                    foreach (LBC_SURVEY_COMPLETED_VIEW item in list)
                    {
                        lst.Add(MapModelFromLBC_SURVEY_COMPLETED_VIEW(item));
                    }
                }
            }
            foreach (SurveyReportModel item in lst)
            {
                SurveyRepository _recognition = new SurveyRepository();
                item.QUESTIONS = _recognition.GetReportQuestions();
            }
            return(lst);
        }
コード例 #2
0
        public List <SurveyReportModel> GetSurveyReportByIdList(List <decimal> SurveyIdList)
        {
            List <SurveyReportModel> lst = new List <SurveyReportModel>();

            using (LBCData context = new LBCData(ConnectionHelper.getConnectionString()))
            {
                var list = (from entity in context.LBC_SURVEY_COMPLETED_VIEW
                            select entity).ToList();
                foreach (LBC_SURVEY_COMPLETED_VIEW item in list)
                {
                    lst.Add(MapModelFromLBC_SURVEY_COMPLETED_VIEW(item));
                }
            }
            List <SurveyReportModel> result = new List <SurveyReportModel>();

            if (SurveyIdList != null)
            {
                for (int i = 0; i < SurveyIdList.Count(); i++)
                {
                    var entry = lst.Where(q => q.SURVEY_ID == SurveyIdList[i]).FirstOrDefault();
                    if (entry != null)
                    {
                        result.Add(entry);
                    }
                }
            }
            else
            {
                result = lst;
            }


            foreach (SurveyReportModel item in result)
            {
                SurveyRepository _recognition = new SurveyRepository();
                item.QUESTIONS = _recognition.GetReportQuestions();
            }

            return(result);
        }