public ActionResult List(GridCommand command, PriceListMasterSearchModel 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();
 }
        /// <summary>
        /// Search Statement
        /// </summary>
        /// <param name="command">Telerik GridCommand</param>
        /// <param name="searchModel">PriceListMaster Search Model</param>
        /// <returns>Search Statement</returns>
        private SearchStatementModel PrepareSearchStatement(GridCommand command, PriceListMasterSearchModel searchModel)
        {
            string whereStatement = "where p.Type='2'";

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

            HqlStatementHelper.AddLikeStatement("Code", searchModel.Code, HqlStatementHelper.LikeMatchMode.Start, "p", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("Party", searchModel.Party, "p", 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 _AjaxList(GridCommand command, PriceListMasterSearchModel searchModel)
 {
     this.GetCommand(ref command, searchModel);
     SearchStatementModel searchStatementModel = this.PrepareSearchStatement(command, searchModel);
     GridModel<PriceListMaster> PriceListMasterLists = GetAjaxPageData<PriceListMaster>(searchStatementModel, command);
     foreach (var PriceListMasterList in PriceListMasterLists.Data)
     {
         if (!string.IsNullOrWhiteSpace(PriceListMasterList.Party))
         {
             PriceListMasterList.PartyName = this.genericMgr.FindById<Party>(PriceListMasterList.Party).Name;
         }
     }
     return PartialView(PriceListMasterLists);
 }
 public ActionResult _AjaxList(GridCommand command, PriceListMasterSearchModel searchModel)
 {
     SearchStatementModel searchStatementModel = this.PrepareSearchStatement(command, searchModel);
     return PartialView(GetAjaxPageData<PriceListMaster>(searchStatementModel, command));
 }
 public ActionResult List(GridCommand command, PriceListMasterSearchModel searchModel)
 {
     SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel);
     ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
     return View();
 }
        public ActionResult Export(PriceListMasterSearchModel searchModel)
        {
            try
            {
                string sql = @" Select top 100000 a.Code As 代码,a.Party As 供应商,a.Currency As 货币,b.Item As 物料,Uom As 单位,UnitPrice As 价格
	                        ,b.StartDate As 开始日期,b.EndDate As 结束日期,REPLACE(REPLACE(a.Code ,c.Code,''),a.Party,'') As 价格单类别
	                        from BIL_PriceListMstr a,BIL_PriceListDet b,MD_Currency c where a.Code =b.PriceList 
                            and a.Type =1 and a.Currency = c.Code
                            and b.StartDate <GETDATE() and b.EndDate >GETDATE() ";
                if (!string.IsNullOrWhiteSpace(searchModel.Code))
                {
                    sql = sql + "and Code like '" + searchModel.Code + "%'";
                }
                if (!string.IsNullOrWhiteSpace(searchModel.Party))
                {
                    sql = sql + "and Party ='" + searchModel.Party + "'";
                }
                var table = GetTableHtmlBySql(sql, null);
                return new DownloadFileActionResult(table, "ExportPriceList.xls");
            }
            catch (System.Exception e)
            {
                return Json(null);
            }
        }