예제 #1
0
        private PagedList<Contract> QueryListData(ContractSearch searchModel)
        {
            int recordCount = 0;
            int pageSize = ConstantManager.PageSize;
            ContractService service = new ContractService();

            string Group = searchModel.IsAsc ? searchModel.SortBy : searchModel.SortBy + " Descending";

            IList<Contract> allEntities = service.QueryByPage(this.GetSearchFilter(searchModel), Group, pageSize, searchModel.PageIndex + 1, out recordCount);

            var formCondition = "var condition=" + JsonConvert.SerializeObject(searchModel);
            return new PagedList<Contract>(allEntities, searchModel.PageIndex, pageSize, recordCount, "Id", "Id", formCondition);
        }
예제 #2
0
        private void LoadSearchViewBag(ContractSearch searchModel)
        {
            #region sort
            ViewBag.IsAsc = !searchModel.IsAsc;
            ViewBag.SortBy = searchModel.SortBy;
            #endregion
                var datadictionaryService = new DataDictionaryService();
                if (!searchModel.ContractTypeId.HasValue)
                {
                    ViewBag.ContractTypeId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.ContractTypeId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.ContractTypeId);
                }

                if (!searchModel.AgreementTypeId.HasValue)
                {
                    ViewBag.AgreementTypeId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.AgreementTypeId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.AgreementTypeId);
                }

                if (!searchModel.ContractRelationId.HasValue)
                {
                    ViewBag.ContractRelationId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.ContractRelationId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.ContractRelationId);
                }
        }
예제 #3
0
 public ActionResult SearchListPartialView(ContractSearch searchModel)
 {
     #region sort
     ViewBag.IsAsc = !searchModel.IsAsc;
     ViewBag.SortBy = searchModel.SortBy;
     #endregion
     return PartialView("SearchListPartialView",this.QueryListData(searchModel));
 }
예제 #4
0
        private Expression<Func<Contract, bool>> GetSearchFilter(ContractSearch searchModel)
        {
            Expression<Func<Contract, bool>> filter = p => p.IsActive=="1" ;
                 if (searchModel.ContractTypeId.HasValue)
                 {
                    filter = filter.And(q => q.ContractTypeId == searchModel.ContractTypeId.Value);
                 }
                 if (searchModel.AgreementTypeId.HasValue)
                 {
                    filter = filter.And(q => q.AgreementTypeId == searchModel.AgreementTypeId.Value);
                 }
                 if (searchModel.ContractRelationId.HasValue)
                 {
                    filter = filter.And(q => q.ContractRelationId == searchModel.ContractRelationId.Value);
                 }

            return filter;
        }
예제 #5
0
 //
 // GET: /Contract/
 //[PermissionFilter]
 public ViewResult Index(ContractSearch searchModel)
 {
     this.LoadSearchViewBag(searchModel);
     return View(this.QueryListData(searchModel));
 }