public void GetListPersonalInfoTest()
 {
     var queryParam = new ListPersonalInfoQueryParam
     {
         SearchText = "a",
         Pagination = new Pagination(0, 100)
     };
     var result = _queryService.GetListPersonalInfo(queryParam);
 }
        public void ListPersonsTest()
        {
            var queryParam = new ListPersonalInfoQueryParam();

            //queryParam.AgeFrom = 25;
            //queryParam.ThruAge = 26;
            //queryParam.UserNumber = "sbi";
            //queryParam.CategoryTypeIds = new List<string> { "MODELING" };
            //queryParam.CategoryTypeIds = new System.Collections.Generic.List<string>() { "FILM", "MODELING" };
            queryParam.HeightFrom = 1.56;
            queryParam.HeightThru = 1.56;
            queryParam.HeightUom  = "METER";

            var result = _queryService.ListSearchPersonalInfos(queryParam);

            Assert.IsNotNull(result);
        }
Esempio n. 3
0
        public GetPersonalInfoListModel GetListPersonalInfo(ListPersonalInfoQueryParam queryParam)
        {
            var searchText    = queryParam.SearchText?.Trim();
            var personalInfos = _context.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(new GetPersonalInfoListModel
            {
                PersonalInfoList = personalInfos.Paginate(t => t.FirstName, queryParam.Pagination).ToList().AsQueryable().ToList <PersonalInfoListModel>(),
                TotalCount = personalInfos.Count()
            });
        }
Esempio n. 4
0
        public GetListSearchPersonalInfos ListSearchPersonalInfos(ListPersonalInfoQueryParam queryParam)
        {
            var birthDateFromAge = DateTime.Now.AddYears(-queryParam.AgeFrom);
            var birthDateThruAge = DateTime.Now.AddYears(-(queryParam.ThruAge + 1));

            var personalInfos = _context.PersonalInformations.Where(t => t.PersonId_User.StatusId != null &&
                                                                    (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
                                                                      )
                                                                     )
                                                                    )
                                                                    &&
                                                                    (string.IsNullOrEmpty(queryParam.Sex) ||
                                                                     t.Sex == queryParam.Sex) &&
                                                                    (string.IsNullOrEmpty(queryParam.FirstName) ||
                                                                     t.FirstName.ToLower()
                                                                     .Contains(queryParam.FirstName.ToLower())) &&
                                                                    (string.IsNullOrEmpty(queryParam.Complexion) ||
                                                                     t.PersonId_PhysicalInformation.Complexion ==
                                                                     queryParam.Complexion) &&
                                                                    (string.IsNullOrEmpty(queryParam.UserNumber) ||
                                                                     t.PersonId_User.UserNumber.ToLower()
                                                                     .Contains(queryParam.UserNumber.ToLower())) &&
                                                                    (queryParam.CategoryTypeIds.Count == 0 ||
                                                                     t.Categories_PersonId
                                                                     .Any(l =>
                                                                          queryParam.CategoryTypeIds.Contains(
                                                                              l.CategoryTypeId))) &&
                                                                    (queryParam.HeightFrom == null || (
                                                                         t.PersonId_PhysicalInformation.Height >=
                                                                         queryParam.HeightFrom &&
                                                                         t.PersonId_PhysicalInformation.HeightEnumId ==
                                                                         queryParam.HeightUom
                                                                         )
                                                                    ) &&
                                                                    (queryParam.HeightThru == null || (
                                                                         t.PersonId_PhysicalInformation.Height <=
                                                                         queryParam.HeightThru &&
                                                                         t.PersonId_PhysicalInformation.HeightEnumId ==
                                                                         queryParam.HeightUom)
                                                                    ));

            return(new GetListSearchPersonalInfos()
            {
                PersonalInfos = personalInfos.Paginate(t => t.PersonId_User.UserNumber, queryParam.Pagination.Page, queryParam.Pagination.PageSize).OrderBy(t => t.FirstName).ToList().AsQueryable().ToList <PersonalInformationQueryModel>(),
                TotalCount = personalInfos.Count()
            });
        }
Esempio n. 5
0
 public GetPersonalInfoListModel GetListPersonalInfo(ListPersonalInfoQueryParam queryParam)
 {
     return(_query.GetListPersonalInfo(queryParam));
 }
Esempio n. 6
0
 public GetListSearchPersonalInfos ListSearchPersonalInfos(ListPersonalInfoQueryParam queryParam)
 {
     return(_query.ListSearchPersonalInfos(queryParam));
 }
Esempio n. 7
0
 public GetPersonalInfoListModel GetListPersonalInfo(ListPersonalInfoQueryParam queryParam)
 {
     return(_modelManagementQueryServices.GetListPersonalInfo(queryParam));
 }
Esempio n. 8
0
 public GetListSearchPersonalInfos ListSearchPersonalInfos(ListPersonalInfoQueryParam queryParam)
 {
     return(_modelManagementQueryServices.ListSearchPersonalInfos(queryParam));
 }