public ActionResult _AjaxList(GridCommand command, LocationDetailPrefSearchModel searchModel)
 {
     TempData["GridCommand"] = command;
     TempData["searchModel"] = searchModel;
     SearchStatementModel searchStatementModel = PrepareSearchStatement(command, searchModel);
     GridModel<LocationDetailPref> gridModel = GetAjaxPageData<LocationDetailPref>(searchStatementModel, command);
     foreach (var locDetPref in gridModel.Data)
     {
         locDetPref.ReferenceItemCode = this.genericMgr.FindById<Item>(locDetPref.Item).ReferenceCode;
     }
     return PartialView(gridModel);
 }
        private SearchStatementModel PrepareSearchStatement(GridCommand command, LocationDetailPrefSearchModel searchModel)
        {
            string whereStatement = string.Empty;
            IList<object> param = new List<object>();

            HqlStatementHelper.AddEqStatement("Item", searchModel.ItemCode, "f", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("Location", searchModel.LocationCode, "f", ref whereStatement, param);
           
            string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors);

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

            return searchStatementModel;
        }
 public ActionResult List(GridCommand command, LocationDetailPrefSearchModel searchModel)
 {
     SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel);
     ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
     return View();
 }
        public void ExportXls(LocationDetailPrefSearchModel searchModel)
        {
            string hql = " select l from LocationDetailPref as l where 1=1  ";
            IList<object> parameter = new List<object>();

            if (!string.IsNullOrWhiteSpace(searchModel.ItemCode))
            {
                hql += " and Item=? ";
                parameter.Add(searchModel.ItemCode);
            }
            if (!string.IsNullOrWhiteSpace(searchModel.LocationCode))
            {
                hql += " and Location=? ";
                parameter.Add(searchModel.LocationCode);
            }
            var exportList = this.genericMgr.FindAll<LocationDetailPref>(hql,parameter.ToArray());
            foreach (var locDetPref in exportList)
            {
                locDetPref.ReferenceItemCode = this.genericMgr.FindById<Item>(locDetPref.Item).ReferenceCode;
            }
            ExportToXLS<LocationDetailPref>("ExportXls", "XLS", exportList);
        }