コード例 #1
0
 public ActionResult List(GridCommand command, ItemExchangeSearchModel searchModel)
 {
     SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel);
     if (searchCacheModel.isBack == true)
     {
         ViewBag.Page = searchCacheModel.Command.Page == 0 ? 1 : searchCacheModel.Command.Page;
     }
     ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
     return View();
 }
コード例 #2
0
 public ActionResult _AjaxList(GridCommand command, ItemExchangeSearchModel searchModel)
 {
     TempData["ItemExchangeSearchModel"] = searchModel;
     this.GetCommand(ref command, searchModel);
     SearchStatementModel searchStatementModel = this.PrepareSearchStatement(command, searchModel);
     var lists = GetAjaxPageData<ItemExchange>(searchStatementModel, command);
     var itemlist = itemMgr.GetCacheAllItem();
     foreach (var listData in lists.Data)
     {
         listData.ItemFromDesc = itemlist.ValueOrDefault(listData.ItemFrom).FullDescription;
         listData.ItemToDesc = itemlist.ValueOrDefault(listData.ItemTo).FullDescription;
     }
     return PartialView(lists);
 }
コード例 #3
0
        /// <summary>
        /// Search Statement
        /// </summary>
        /// <param name="command">Telerik GridCommand</param>
        /// <param name="searchModel">ItemDiscontinueSearchModel Search Model</param>
        /// <returns>return Search Statement</returns>
        private SearchStatementModel PrepareSearchStatement(GridCommand command, ItemExchangeSearchModel searchModel)
        {
            string whereStatement = string.Empty;

            IList<object> param = new List<object>();
            //SecurityHelper.AddRegionPermissionStatement(ref whereStatement, "i", searchModel.RegionFrom);
            //SecurityHelper.AddRegionPermissionStatement(ref whereStatement, "i", searchModel.RegionFrom);

            HqlStatementHelper.AddLikeStatement("ItemFrom", searchModel.ItemFrom, HqlStatementHelper.LikeMatchMode.End, "i", ref whereStatement, param);
            HqlStatementHelper.AddLikeStatement("ItemTo", searchModel.ItemTo, HqlStatementHelper.LikeMatchMode.End, "i", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("RegionFrom", searchModel.RegionFrom, "i", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("RegionTo", searchModel.RegionTo, "i", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("LocationFrom", searchModel.LocationFrom, "i", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("LocationTo", searchModel.LocationTo, "i", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("ItemExchangeType", searchModel.ItemExchangeType, "i", ref whereStatement, param);
            HqlStatementHelper.AddLikeStatement("NewHu", searchModel.NewHu, HqlStatementHelper.LikeMatchMode.End, "i", ref whereStatement, param);
            HqlStatementHelper.AddLikeStatement("OldHu", searchModel.OldHu, HqlStatementHelper.LikeMatchMode.End, "i", ref whereStatement, param);

            //if (!string.IsNullOrWhiteSpace(searchModel.HuId))
            //{
            //    whereStatement = whereStatement + " and (OldHu like ? or NewHu like ?) ";
            //    param.Add("%" + searchModel.HuId);
            //    param.Add("%" + searchModel.HuId);
            //}

            string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors);
            if (string.IsNullOrWhiteSpace(sortingStatement))
            {
                sortingStatement = " order by Id desc";
            }
            SearchStatementModel searchStatementModel = new SearchStatementModel();
            searchStatementModel.SelectCountStatement = ItemExchangeCountStatement;
            searchStatementModel.SelectStatement = selectStatement;
            searchStatementModel.WhereStatement = whereStatement;
            searchStatementModel.SortingStatement = sortingStatement;
            searchStatementModel.Parameters = param.ToArray<object>();

            return searchStatementModel;
        }
コード例 #4
0
 public ActionResult _AjaxList(GridCommand command, ItemExchangeSearchModel searchModel)
 {
     SearchStatementModel searchStatementModel = this.PrepareSearchStatement(command, searchModel);
     return PartialView(GetAjaxPageData<ItemExchange>(searchStatementModel, command));
 }
コード例 #5
0
 public ActionResult List(GridCommand command, ItemExchangeSearchModel searchModel)
 {
     TempData["ItemExchangeSearchModel"] = searchModel;
     ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
     return View();
 }
コード例 #6
0
        /// <summary>
        /// Search Statement
        /// </summary>
        /// <param name="command">Telerik GridCommand</param>
        /// <param name="searchModel">ItemDiscontinueSearchModel Search Model</param>
        /// <returns>return Search Statement</returns>
        private SearchStatementModel PrepareSearchStatement(GridCommand command, ItemExchangeSearchModel searchModel)
        {
            string whereStatement = string.Empty;

            IList<object> param = new List<object>();
            SecurityHelper.AddRegionPermissionStatement(ref whereStatement, "i", searchModel.RegionFrom);
            SecurityHelper.AddRegionPermissionStatement(ref whereStatement, "i", searchModel.RegionFrom);

            HqlStatementHelper.AddLikeStatement("ItemFrom", searchModel.ItemFrom, HqlStatementHelper.LikeMatchMode.End, "i", ref whereStatement, param);
            HqlStatementHelper.AddLikeStatement("ItemTo", searchModel.ItemTo, HqlStatementHelper.LikeMatchMode.End, "i", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("RegionFrom", searchModel.RegionFrom, "i", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("RegionTo", searchModel.RegionTo, "i", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("LocationFrom", searchModel.LocationFrom, "i", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("LocationTo", searchModel.LocationTo, "i", ref whereStatement, param);
            string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors);

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

            return searchStatementModel;
        }