public ActionResult _AjaxList(GridCommand command, CustodianSearchModel searchModel)
        {

            if (!this.CheckSearchModelIsNull(searchModel))
            {
                return PartialView(new GridModel(new List<Custodian>()));
            }

            SearchStatementModel searchStatementModel = PrepareSearchStatement(command, searchModel);
            return PartialView(GetAjaxPageData<Custodian>(searchStatementModel, command));
        }
 public ActionResult List(GridCommand command, CustodianSearchModel searchModel)
 {
     SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel);
     if (this.CheckSearchModelIsNull(searchCacheModel.SearchObject))
     {
         TempData["_AjaxMessage"] = "";
     }
     else
     {
         SaveWarningMessage(Resources.ErrorMessage.Errors_NoConditions);
     }
     ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
     return View();
 }
        private SearchStatementModel PrepareSearchStatement(GridCommand command, CustodianSearchModel searchModel)
        {

           IList<object> param = new List<object>();
           string whereStatement = string.Empty;

           HqlStatementHelper.AddEqStatement("UserCode", searchModel.UserCode,  "c", ref whereStatement, param);

            string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors);

            if (command.SortDescriptors.Count == 0)
            {
                sortingStatement = " order by c.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;
        }