Beispiel #1
0
 public bool SearchCriminal(SearchCriminalModel objModel)
 {
     if (objModel != null)
     {
         new Thread(() => SendEmailWithListOfCriminal(objModel)).Start();
         return true;
     }
     return false;
 }
Beispiel #2
0
        private IEnumerable<CriminalEntity> FilterCriminals(SearchCriminalModel objModel)
        {
            IEnumerable<CriminalEntity> criminals = null;
            if (!string.IsNullOrEmpty(objModel.Name))
                criminals = _criminalServices.GetAllCriminals().Where(x => x.FName.Trim().ToLower().Equals(objModel.Name.Trim().ToLower()) || x.LName.Trim().ToLower().Equals(objModel.Name.Trim().ToLower()));

            if (criminals == null) return criminals;

            if (objModel.MinAge != null)
                criminals = criminals.Where(x => x.Age > objModel.MinAge);

            if (criminals == null) return criminals;

            if (objModel.MaxAge != null)
                criminals = criminals.Where(x => x.Age < objModel.MaxAge);

            if (criminals == null) return criminals;

            if (!string.IsNullOrEmpty(objModel.Sex))
                criminals = criminals.Where(x => x.Sex.Trim().ToLower().Equals(objModel.Sex.Trim().ToLower()));

            if (criminals == null) return criminals;

            if (objModel.MinHeight != null)
                criminals = criminals.Where(x => x.Height > objModel.MinHeight);

            if (criminals == null) return criminals;

            if (objModel.MaxHeight != null)
                criminals = criminals.Where(x => x.Height < objModel.MaxHeight);

            if (criminals == null) return criminals;

            if (objModel.MinWeight != null)
                criminals = criminals.Where(x => x.Weight > objModel.MinWeight);

            if (criminals == null) return criminals;

            if (objModel.MaxWeigth != null)
                criminals = criminals.Where(x => x.Weight < objModel.MaxWeigth);

            if (criminals == null) return criminals;

            if (!string.IsNullOrEmpty(objModel.Nationality))
                criminals = criminals.Where(x => x.Nationality.Trim().ToLower().Equals(objModel.Nationality.Trim().ToLower()));

            return criminals;
        }
Beispiel #3
0
        private void SendEmailWithListOfCriminal(SearchCriminalModel objModel)
        {
            var criminals = FilterCriminals(objModel);

            if (criminals != null) CreatePDFFiles(criminals);
        }