Пример #1
0
        public List <SearchBGsResponseModel> Search(BGsSearchModel searchData)
        {
            try
            {
                using (var dbContext = new PMSEntities())
                {
                    var query = dbContext.tblBGsDatas.ToList();
                    if (query != null && query.Count > 0)
                    {
                        if (!string.IsNullOrEmpty(searchData.ProjectCode))
                        {
                            query = query.Where(i => i.ProjectCode == searchData.ProjectCode).ToList();
                        }

                        if (!string.IsNullOrEmpty(searchData.ProjectName))
                        {
                            query = query.Where(i => i.ProjectName == searchData.ProjectName).ToList();
                        }

                        if (!string.IsNullOrEmpty(searchData.WONo))
                        {
                            query = query.Where(i => i.WONo.Contains(searchData.WONo)).ToList();
                        }

                        if (!string.IsNullOrEmpty(searchData.BGNo))
                        {
                            query = query.Where(i => i.BGNo.Contains(searchData.BGNo)).ToList();
                        }

                        if (query != null && query.Count > 0)
                        {
                            return(query.Select(i => new SearchBGsResponseModel
                            {
                                Id = i.Id,
                                BGsId = i.BGsId,
                                ProjectCode = i.ProjectCode,
                                ProjectName = i.ProjectName,
                                WONo = i.WONo,
                                BGNo = i.BGNo,
                                BGDate = i.BGDate,
                                FilePath = i.FilePath
                            }).ToList());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(null);
        }
Пример #2
0
        public JsonResult SearchBGs(BGsSearchModel searchModel)
        {
            var result = _bgsService.Search(searchModel);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
 public List <SearchBGsResponseModel> Search(BGsSearchModel searchData)
 {
     return(_bgsRepository.Search(searchData));
 }