コード例 #1
0
 public void GetListModelsInfoTest()
 {
     var queryParam = new ListModelsQueryParam
     {
         //AgeFrom=18,
         //ThruAge=19,
         //ThruAge=20,
         //WeightFrom=3,
         //WeightThru=5,
         //WeightEnumId="KG",
         //CategoryTypeId = "RUN_WAY",
         Pagination = new Pagination(0, 100)
     };
     var result = _queryService.GetListModelsInfo(queryParam);
 }
コード例 #2
0
        private IQueryable <PersonalInformation> ListPersonalInfos(ListModelsQueryParam queryParam)
        {
            var birthDateFromAge = DateTime.Now.AddYears(-queryParam.AgeFrom.Value);
            var birthDateThruAge = DateTime.Now.AddYears(-(queryParam.ThruAge.Value + 1));

            return(ModelManagementContext().PersonalInformations
                   .Where(t =>
                          (string.IsNullOrEmpty(queryParam.Status) || t.PersonId_User.StatusId == queryParam.Status) &&
                          (string.IsNullOrEmpty(queryParam.Sex) || t.Sex == queryParam.Sex) &&
                          (string.IsNullOrEmpty(queryParam.Complextion) ||
                           t.PersonId_PhysicalInformation.Complexion == queryParam.Complextion) &&
                          (string.IsNullOrEmpty(queryParam.CategoryTypeId) ||
                           t.Categories_PersonId.Any(c => c.CategoryTypeId == queryParam.CategoryTypeId)) &&
                          (string.IsNullOrEmpty(queryParam.HeightEnumId) ||
                           t.PersonId_PhysicalInformation.HeightEnumId == queryParam.HeightEnumId) &&
                          (queryParam.HeightFrom == null || t.PersonId_PhysicalInformation.Height >= queryParam.HeightFrom) &&
                          (queryParam.HeightThru == null || t.PersonId_PhysicalInformation.Height <= queryParam.HeightThru) &&
                          (string.IsNullOrEmpty(queryParam.WeightEnumId) ||
                           t.PersonId_PhysicalInformation.WeightEnumId == queryParam.WeightEnumId) &&
                          (queryParam.WeightFrom == null || t.PersonId_PhysicalInformation.Weight >= queryParam.WeightFrom) &&
                          (queryParam.WeightThru == null || t.PersonId_PhysicalInformation.Weight <= queryParam.WeightThru) &&

                          (queryParam.IsActive == null ||
                           (queryParam.IsActive.Value &&
                            t.PersonId_User.UserApplId_UserAppls.Any(
                                p => p.FromDate <= DateTime.Now && p.ThruDate >= DateTime.Now))) &&
                          (queryParam.AgeFrom == 0 ||
                           (t.DateOfBirth.Value.Year <= birthDateFromAge.Year &&
                            (birthDateFromAge.Year - t.DateOfBirth.Value.Year > 0
                          ? true
                          : t.DateOfBirth.Value.Month <= birthDateFromAge.Month)
                           )
                          ) &&
                          (queryParam.ThruAge == 0 ||
                           (t.DateOfBirth.Value.Year >= birthDateThruAge.Year &&
                            (t.DateOfBirth.Value.Year - birthDateThruAge.Year > 0
                          ? true
                          : t.DateOfBirth.Value.Month > birthDateThruAge.Month)
                           )
                          )


                          ));
        }
コード例 #3
0
        public QueryResult GetListPersonalInfo(ListModelsQueryParam queryParam)
        {
            var searchText    = queryParam.SearchText?.Trim();
            var personalInfos = ModelManagementContext().PersonalInformations
                                .Where(t =>
                                       (string.IsNullOrEmpty(searchText) ||
                                        (
                                            t.FirstName.Contains(searchText) ||
                                            t.LastName.Contains(searchText) ||
                                            t.FatherName.Contains(searchText) ||

                                            t.PersonId_User.UserNumber.Contains(searchText)
                                        )) &&
                                       (string.IsNullOrEmpty(queryParam.Sex) || t.Sex == queryParam.Sex)
                                       );

            return
                (Utility.QuerySuccessResult(
                     personalInfos.Paginate(t => t.FirstName, queryParam.Pagination)
                     .ToList()
                     .AsQueryable()
                     .ToList <PersonalInfoListModel>(), personalInfos.Count()));
        }
コード例 #4
0
        public GetModelsInfoListModel GetListModelsInfo(ListModelsQueryParam queryParam)
        {
            var birthDateFromAge = DateTime.Now.AddYears(-queryParam.AgeFrom.Value);
            var birthDateThruAge = DateTime.Now.AddYears(-(queryParam.ThruAge.Value + 1));

            var modelsInfo = _context.PersonalInformations
                             .Where(t =>

                                    (string.IsNullOrEmpty(queryParam.Sex) || t.Sex == queryParam.Sex) &&
                                    (string.IsNullOrEmpty(queryParam.Complextion) || t.PersonId_PhysicalInformation.Complexion == queryParam.Complextion) &&
                                    (string.IsNullOrEmpty(queryParam.CategoryTypeId) || t.Categories_PersonId.Any(c => c.CategoryTypeId == queryParam.CategoryTypeId)) &&
                                    (string.IsNullOrEmpty(queryParam.HeightEnumId) || t.PersonId_PhysicalInformation.HeightEnumId == queryParam.HeightEnumId) &&
                                    (queryParam.HeightFrom == null || t.PersonId_PhysicalInformation.Height >= queryParam.HeightFrom) &&
                                    (queryParam.HeightThru == null || t.PersonId_PhysicalInformation.Height <= queryParam.HeightThru) &&
                                    (string.IsNullOrEmpty(queryParam.WeightEnumId) || t.PersonId_PhysicalInformation.WeightEnumId == queryParam.WeightEnumId) &&
                                    (queryParam.WeightFrom == null || t.PersonId_PhysicalInformation.Weight >= queryParam.WeightFrom) &&
                                    (queryParam.WeightThru == null || t.PersonId_PhysicalInformation.Weight <= queryParam.WeightThru) &&
                                    (queryParam.AgeFrom == 0 ||
                                     (t.DateOfBirth.Value.Year <= birthDateFromAge.Year &&
                                      (birthDateFromAge.Year - t.DateOfBirth.Value.Year > 0 || t.DateOfBirth.Value.Month <= birthDateFromAge.Month)
                                     )
                                    ) &&
                                    (queryParam.ThruAge == 0 ||
                                     (t.DateOfBirth.Value.Year >= birthDateThruAge.Year &&
                                      (t.DateOfBirth.Value.Year - birthDateThruAge.Year > 0 || t.DateOfBirth.Value.Month > birthDateThruAge.Month)
                                     )
                                    )


                                    );

            return(new GetModelsInfoListModel
            {
                ModelList = modelsInfo.Paginate(t => t.FirstName, queryParam.Pagination).ToList().AsQueryable().ToList <ModelsInfoListModel>(),
                TotalCount = modelsInfo.Count()
            });
        }
コード例 #5
0
 public GetModelsInfoListModel GetListModelsInfo(ListModelsQueryParam queryParam)
 {
     return(_query.GetListModelsInfo(queryParam));
 }
コード例 #6
0
 public GetModelsInfoListModel GetListModelsInfo(ListModelsQueryParam queryParam)
 {
     return(_modelManagementQueryServices.GetListModelsInfo(queryParam));
 }
コード例 #7
0
        public QueryResult ListModelslInfo(ListModelsQueryParam queryParam)
        {
            var personalInfo = ListPersonalInfos(queryParam).ToList().AsQueryable();

            return(Utility.QuerySuccessResult(personalInfo.Paginate(t => t.FirstName, queryParam.Pagination).ToList <ModelsInfoListModel>(), personalInfo.Count()));
        }