コード例 #1
0
        public ActionResult _AjaxList(GridCommand command, MrpExPlanItemRateSearchModel searchModel)
        {
            var prodLineExList = this.genericMgr.FindAll<ProdLineEx>();
            var sections = prodLineExList.GroupBy(p => p.Item)
                .Select(p =>
                {
                    var q = p.First();
                    q.ItemDesc = itemMgr.GetCacheItem(q.Item).Description;
                    return q;
                })
                .Where(p => string.IsNullOrWhiteSpace(searchModel.Section) || p.Item.Contains(searchModel.Section))
                .Where(p => string.IsNullOrWhiteSpace(searchModel.SectionDesc) || p.ItemDesc.Contains(searchModel.SectionDesc))
                .OrderBy(p => p.Item);

            GridModel<ProdLineEx> groupModel = new GridModel<ProdLineEx>();
            groupModel.Total = sections.Count();
            groupModel.Data = sections.Skip((command.Page - 1) * command.PageSize).Take(command.PageSize);
            ViewBag.Total = groupModel.Total;
            return PartialView(groupModel);
        }
コード例 #2
0
 public ActionResult List(GridCommand command, MrpExPlanItemRateSearchModel searchModel)
 {
     SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel);
     ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
     return View();
 }
コード例 #3
0
        /// <summary>
        /// Search Statement
        /// </summary>
        /// <param name="command">Telerik GridCommand</param>
        /// <param name="searchModel">MrpExPlanItemRate Search Model</param>
        /// <returns>return Search Statement</returns>
        private SearchStatementModel PrepareSearchStatement(GridCommand command, MrpExPlanItemRateSearchModel searchModel)
        {
            string whereStatement = string.Empty;

            IList<object> param = new List<object>();

            HqlStatementHelper.AddLikeStatement("Item", searchModel.Section, HqlStatementHelper.LikeMatchMode.Start, "i", ref whereStatement, param);
            string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors);
            if (string.IsNullOrWhiteSpace(sortingStatement))
            {
                sortingStatement = " order by i.Item ";
            }

            SearchStatementModel searchStatementModel = new SearchStatementModel();
            searchStatementModel.SelectCountStatement = selectCountStatement;
            searchStatementModel.SelectStatement = selectStatement;
            searchStatementModel.WhereStatement = whereStatement;
            searchStatementModel.SortingStatement = sortingStatement;
            searchStatementModel.Parameters = param.ToArray<object>();
            return searchStatementModel;
        }