public ActionResult _AjaxList(GridCommand command, RejectMasterSearchModel searchModel)
 {
     SearchStatementModel searchStatementModel = RejectMasterPrepareSearchStatement(command, searchModel);
     return PartialView(GetAjaxPageData<RejectMaster>(searchStatementModel, command));
 }
        private SearchStatementModel RejectMasterPrepareSearchStatement(GridCommand command, RejectMasterSearchModel searchModel)
        {
            string whereStatement = string.Empty;
            IList<object> param = new List<object>();

            HqlStatementHelper.AddLikeStatement("RejectNo", searchModel.RejectNo, HqlStatementHelper.LikeMatchMode.Start, "r", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("Status", searchModel.Status, "r", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("HandleResult", searchModel.HandleResult, "r", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("CreateUserName", searchModel.CreateUserName, "r", ref whereStatement, param);

            if (searchModel.StartDate != null && searchModel.EndDate != null)
            {
                HqlStatementHelper.AddBetweenStatement("CreateDate", searchModel.StartDate, searchModel.EndDate, "r", ref whereStatement, param);

            }
            else if (searchModel.StartDate != null && searchModel.EndDate == null)
            {
                HqlStatementHelper.AddGeStatement("CreateDate", searchModel.StartDate, "r", ref whereStatement, param);
            }
            else if (searchModel.StartDate == null && searchModel.EndDate != null)
            {
                HqlStatementHelper.AddLeStatement("CreateDate", searchModel.EndDate, "r", ref whereStatement, param);
            }

            if (command.SortDescriptors.Count > 0)
            {
                if (command.SortDescriptors[0].Member == "RejectMasterStatusDescription")
                {
                    command.SortDescriptors[0].Member = "Status";
                }
                else if (command.SortDescriptors[0].Member == "RejectMasterHandleResultDescription")
                {
                    command.SortDescriptors[0].Member = "HandleResult";
                }
            }
            //if (!string.IsNullOrEmpty(searchModel.InspectNo))
            //{
            //    if (whereStatement == string.Empty)
            //        whereStatement +=string.Format( " where exists (select 1 from RejectDetail as d where d.InspectNo='{0}%')",searchModel.InspectNo);
            //    else
            //        whereStatement += string.Format(" and exists (select 1 from RejectDetail as d where d.InspectNo='{0}%')", searchModel.InspectNo);
            //}

            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, RejectMasterSearchModel searchModel)
 {
     SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel);
     ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
     return View();
 }