public ActionResult List(GridCommand command, IssueAddressSearchModel searchModel)
 {
     TempData["IssueAddressSearchModel"] = searchModel;
     ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
     return View();
 }
 public ActionResult _AjaxList(GridCommand command, IssueAddressSearchModel searchModel)
 {
     SearchStatementModel searchStatementModel = PrepareSearchStatement(command, searchModel);
     return PartialView(GetAjaxPageData<IssueAddress>(searchStatementModel, command));
 }
        private SearchStatementModel PrepareSearchStatement(GridCommand command, IssueAddressSearchModel searchModel)
        {
            string whereStatement = string.Empty;

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

            if (!string.IsNullOrWhiteSpace(searchModel.ParentIssueAddressCode))
            {
                HqlStatementHelper.AddEqStatement("Code", searchModel.ParentIssueAddressCode, "pia", ref whereStatement, param);
            }
            HqlStatementHelper.AddLikeStatement("Description", searchModel.Description, HqlStatementHelper.LikeMatchMode.Start, "ia", ref whereStatement, param);

            if (command.SortDescriptors.Count > 0)
            {
                if (command.SortDescriptors[0].Member == "Code")
                {
                    command.SortDescriptors[0].Member = "ia.Code";
                }
                if (command.SortDescriptors[0].Member == "Description")
                {
                    command.SortDescriptors[0].Member = "ia.Description";
                }
                if (command.SortDescriptors[0].Member == "Sequence")
                {
                    command.SortDescriptors[0].Member = "ia.Sequence";
                }
                if (command.SortDescriptors[0].Member == "ParentIssueAddressCode")
                {
                    command.SortDescriptors[0].Member = "pia.Code";
                }
                if (command.SortDescriptors[0].Member == "ParentIssueAddressDescription")
                {
                    command.SortDescriptors[0].Member = "pia.Description";
                }
            }

            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;
        }