public ActionResult List(GridCommand command, FacilityTransSearchModel 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();
 }
        private SearchStatementModel FacilityTransPrepareSearchStatement(GridCommand command, FacilityTransSearchModel facilityTransSearchModel, string fcId)
        {
            string whereStatement = " where f.FCID='" + fcId + "'";

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

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

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

            return searchStatementModel;
        }
 public ActionResult _AjaxFacilityTransList(GridCommand command, FacilityTransSearchModel facilityTransSearchModel, string fcId)
 {
     SearchStatementModel searchStatementModel = this.FacilityTransPrepareSearchStatement(command, facilityTransSearchModel, fcId);
     return PartialView(GetAjaxPageData<FacilityTrans>(searchStatementModel, command));
 }
 public ActionResult _FacilityTrans(GridCommand command, FacilityTransSearchModel facilityTransSearchModel, string id)
 {
     ViewBag.FCID = id;
     ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
     return PartialView();
 }
 public ActionResult _AjaxList(GridCommand command, FacilityTransSearchModel searchModel)
 {
     this.GetCommand(ref command, searchModel);
     SearchStatementModel searchStatementModel = this.PrepareSearchStatement(command, searchModel);
     return PartialView(GetAjaxPageData<FacilityTrans>(searchStatementModel, command));
 }
        /// <summary>
        /// Search Statement
        /// </summary>
        /// <param name="command">Telerik GridCommand</param>
        /// <param name="searchModel">FacilityTrans Search Model</param>
        /// <returns>return facilityTrans search model</returns>
        private SearchStatementModel PrepareSearchStatement(GridCommand command, FacilityTransSearchModel searchModel)
        {            
            string whereStatement = string.Empty;

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

            HqlStatementHelper.AddLikeStatement("FCID", searchModel.FCID, HqlStatementHelper.LikeMatchMode.Anywhere, "f", ref whereStatement, param);
            HqlStatementHelper.AddLikeStatement("Name", searchModel.Name, HqlStatementHelper.LikeMatchMode.Anywhere, "f", ref whereStatement, param);
            HqlStatementHelper.AddLikeStatement("AssetNo", searchModel.AssetNo, HqlStatementHelper.LikeMatchMode.Anywhere, "f", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("Category", searchModel.Category, "f", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("TransType", searchModel.TransType, "f", ref whereStatement, param);

            if (searchModel.DateFrom != null)
            {
                HqlStatementHelper.AddGeStatement("CreateDate", searchModel.DateFrom, "f", ref whereStatement, param);
            }
            if (searchModel.DateTo != null)
            {
                HqlStatementHelper.AddLtStatement("CreateDate", searchModel.DateTo.Value.AddDays(1), "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;
        }