public ActionResult List(GridCommand command, PartySearchModel 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();
 }
 public ActionResult _AjaxList(GridCommand command, PartySearchModel searchModel)
 {
     this.GetCommand(ref command, searchModel);
     SearchStatementModel searchStatementModel = PrepareSearchStatement(command, searchModel);
     return PartialView(GetAjaxPageData<Region>(searchStatementModel, command));
 }
 private SearchStatementModel PrepareSearchStatement(GridCommand command, PartySearchModel searchModel)
 {
     string whereStatement = string.Empty;
     IList<object> param = new List<object>();
     HqlStatementHelper.AddLikeStatement("Plant", searchModel.Plant, HqlStatementHelper.LikeMatchMode.Start, "r", ref whereStatement, param);
     HqlStatementHelper.AddLikeStatement("Code", searchModel.Code, HqlStatementHelper.LikeMatchMode.Start, "r", ref whereStatement, param);
     HqlStatementHelper.AddLikeStatement("Name", searchModel.Name, HqlStatementHelper.LikeMatchMode.Start, "r", ref whereStatement, param);
     HqlStatementHelper.AddLikeStatement("Workshop", searchModel.Workshop, HqlStatementHelper.LikeMatchMode.Start, "r", 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, PartySearchModel searchModel)
 {
     SearchStatementModel searchStatementModel = PrepareSearchStatement(command, searchModel);
     return PartialView(GetAjaxPageData<Supplier>(searchStatementModel, command));
 }
 public ActionResult List(GridCommand command, PartySearchModel searchModel)
 {
     SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel);
     ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
     return View();
 }
 public void ExportSupplierXLS(PartySearchModel searchModel)
 {
     string hql = " select u from Supplier  as u where 1=1";
     if (!string.IsNullOrWhiteSpace(searchModel.Code))
     {
         hql += string.Format(" and u.ReferenceCode like '{0}%' ", searchModel.Code);
     }
     if (!string.IsNullOrWhiteSpace(searchModel.ShortCode))
     {
         hql += string.Format(" and u.ShortCode like '{0}%' ", searchModel.ShortCode);
     }
     if (!string.IsNullOrWhiteSpace(searchModel.Name))
     {
         hql += string.Format(" and u.Name like '{0}%' ", searchModel.Name);
     }
     hql += " order by u.CreateDate asc ";
     IList<Supplier> exportSupplierList = this.genericMgr.FindAll<Supplier>(hql);
     ExportToXLS<Supplier>("ExportSupplierXLS", "xls", exportSupplierList);
 }
 public ActionResult Export(PartySearchModel searchModel)
 {
     try
     {
         string sql = @" Select a.Code As 供应商代码,c.Name As 供应商名称,b.Address As 供应商地址,PostCode As 邮编,TelPhone As 固定电话,MobilePhone
                         As 手机号码,Fax As 传真,Email As 邮箱,ContactPsnNm 联系人,Case when IsActive=1 then '有效' else '无效' End
                         As 是否有效  from MD_Supplier a,MD_Address b,MD_Party c 
                         where a.Code =b.Code and b.Code =c.Code ";
         if (!string.IsNullOrWhiteSpace(searchModel.Code))
         {
             sql = sql + "and a.Code like '" + searchModel.Code + "%'";
         }
         if (!string.IsNullOrWhiteSpace(searchModel.Name))
         {
             sql = sql + "and c.Name like '" + searchModel.Name + "%'";
         }
         if (!string.IsNullOrWhiteSpace(searchModel.ShortCode))
         {
             sql = sql + "and ShortCode like '" + searchModel.ShortCode + "%'";
         }
         var table = GetTableHtmlBySql(sql, null);
         return new DownloadFileActionResult(table, "Supplier.xls");
     }
     catch (System.Exception e)
     {
         return Json(null);
     }
 }