예제 #1
0
        public List <DataModel> GetListObjByLesson(TabName tabname, LessonModel lesson, bool isOnlyHard = false, bool isGetAll = false)
        {
            List <DataModel>  result     = new List <DataModel>();
            List <DataEntity> listEntity = CommonDAO.GetDataByLesson(tabname, lesson.LessonName);

            foreach (DataEntity entity in listEntity)
            {
                DataModel model = CommonUtils.MappingData <DataModel>(entity);
                model.IsHard = !string.IsNullOrEmpty(entity.Hard);
                model.IsLock = !string.IsNullOrEmpty(entity.Lock);

                if (isGetAll)
                {
                    result.Add(model);
                }
                else if (isOnlyHard)
                {
                    if (model.IsHard)
                    {
                        result.Add(model);
                    }
                }
                else if (!model.IsLock)
                {
                    result.Add(model);
                }
            }

            return(result);
        }