コード例 #1
0
        public List <SearchCorrespondenceModel> SearchCorrespondence(CorrespondenceSearchModel searchData)
        {
            try
            {
                using (var dbContext = new PMSEntities())
                {
                    var query = dbContext.tblCorrespondences.ToList();
                    if (query != null && query.Count > 0)
                    {
                        if (!string.IsNullOrEmpty(searchData.ProjectCode))
                        {
                            query = query.Where(i => i.ProjectCode == searchData.ProjectCode).ToList();
                        }
                        if (searchData.CorrespondenceType > 0)
                        {
                            query = query.Where(i => i.CorrespondenceType == searchData.CorrespondenceType).ToList();
                        }


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

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


                        if (query != null && query.Count > 0)
                        {
                            return(query.Select(i => new SearchCorrespondenceModel
                            {
                                Id = i.Id,
                                CorrespondenceId = i.CorrespondenceId,
                                CorrespondenceType = (i.CorrespondenceType == 1 ? "InWard" : "OutWard"),
                                ProjectCode = i.ProjectCode,
                                Department = i.Department,
                                Subject = i.Subject,
                                LetterNo = i.LetterNo,
                                LetterDate = i.LetterDate,
                                FilePath = i.FilePath
                            }).ToList());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(null);
        }
コード例 #2
0
 public List <SearchCorrespondenceModel> SearchCorrespondence(CorrespondenceSearchModel searchData)
 {
     return(_correspondenceRepository.SearchCorrespondence(searchData));
 }
コード例 #3
0
        public JsonResult SearchCorrespondence(CorrespondenceSearchModel correspondenceSearchModel)
        {
            var result = _correspondenceService.SearchCorrespondence(correspondenceSearchModel);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }