Exemplo n.º 1
0
 public ActionResult _AjaxList(GridCommand command, PostDOSearchModel searchModel)
 {
     SearchStatementModel searchStatementModel = PrepareSearchStatement(command, searchModel);
     GridModel<PostDO> gridlist = GetAjaxPageData<PostDO>(searchStatementModel, command);
     foreach (PostDO inv in gridlist.Data)
     {
         inv.StatusName = GetEnumDescription(inv.Status);
     }
   
     return PartialView(gridlist);
     //return PartialView(GetAjaxPageData<ReceiptMaster>(searchStatementModel, command));
 }
Exemplo n.º 2
0
        private SearchStatementModel PrepareSearchStatement(GridCommand command, PostDOSearchModel searchModel)
        {
            string whereStatement = "";

            IList<object> param = new List<object>();
            HqlStatementHelper.AddLikeStatement("OrderNo", searchModel.OrderNo, HqlStatementHelper.LikeMatchMode.Start, "p", ref whereStatement, param);
            HqlStatementHelper.AddLikeStatement("ReceiptNo", searchModel.ReceiptNo, HqlStatementHelper.LikeMatchMode.Start, "p", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("Status", searchModel.Status, "p", ref whereStatement, param);
          

            if (searchModel.StartDate != null & searchModel.EndDate != null)
            {
                HqlStatementHelper.AddBetweenStatement("CreateDate", searchModel.StartDate, searchModel.EndDate, "p", ref whereStatement, param);
            }
            else if (searchModel.StartDate != null & searchModel.EndDate == null)
            {
                HqlStatementHelper.AddGeStatement("CreateDate", searchModel.StartDate, "p", ref whereStatement, param);
            }
            else if (searchModel.StartDate == null & searchModel.EndDate != null)
            {
                HqlStatementHelper.AddLeStatement("CreateDate", searchModel.EndDate, "p", ref whereStatement, param);
            }
            string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors);
            if (command.SortDescriptors.Count == 0)
            {
                sortingStatement = " order by p.CreateDate desc";
            }
            SearchStatementModel searchStatementModel = new SearchStatementModel();
            searchStatementModel.SelectCountStatement = selectCountStatement;
            searchStatementModel.SelectStatement = selectStatement;
            searchStatementModel.WhereStatement = whereStatement;
            searchStatementModel.SortingStatement = sortingStatement;
            searchStatementModel.Parameters = param.ToArray<object>();

            return searchStatementModel;
        }
Exemplo n.º 3
0
 public ActionResult List(GridCommand command, PostDOSearchModel searchModel)
 {
     TempData["PostDOSearchModel"] = searchModel;
     ViewBag.PageSize = 20;
     return View();
 }