public ActionResult Report(Report_Filter filter, Rest.Core.Paging Page) { //var PermissionCheck = CheckPermission("最新消息管理"); //if (PermissionCheck != null) return PermissionCheck; if (!filter.DaysOfPeroid.HasValue || filter.DaysOfPeroid.Value > 120) { filter.DaysOfPeroid = 30; } if (!string.IsNullOrEmpty(filter.ItemName) && filter.ItemName.StartsWith("請輸入")) { filter.ItemName = null; } if (!string.IsNullOrEmpty(filter.Url) && filter.Url.StartsWith("請輸入")) { filter.Url = null; } ViewData["Filter"] = filter; Rest.Core.Paging page = new Rest.Core.Paging() { }; if (Page.CurrentPage > 0) { page.CurrentPage = Page.CurrentPage; } List <Report_Info> data = DiaryMan.GetByParameter(filter, page, null, "CreateDateTime desc"); ViewData["Model"] = data; ViewData["Page"] = page; return(View()); }
private Rest.Core.PetaPoco.Sql ConstructSQL(Report_Filter filter, string[] fieldNames, string _orderby) { var SQLStr = Rest.Core.PetaPoco.Sql.Builder .Append("SELECT " + FieldNameArrayToFieldNameString(fieldNames) + " FROM db_Report") .Append("WHERE 1=1 "); if (filter != null) { if (filter.ReportID.HasValue) { SQLStr.Append(" AND ReportID=@0", filter.ReportID.Value); } if (!string.IsNullOrEmpty(filter.IP)) { SQLStr.Append(" AND IP like @0", "%" + filter.IP + "%"); } if (!string.IsNullOrEmpty(filter.Url)) { SQLStr.Append(" AND Url like @0", "%" + filter.Url + "%"); } if (!string.IsNullOrEmpty(filter.Reff)) { SQLStr.Append(" AND Reff like @0", "%" + filter.Reff + "%"); } if (!string.IsNullOrEmpty(filter.ItemName)) { SQLStr.Append(" AND ItemName like @0", "%" + filter.ItemName + "%"); } if (filter.CreateDateTime.HasValue) { SQLStr.Append(" AND CreateDateTime=@0", filter.CreateDateTime.Value); } if (filter.DaysOfPeroid.HasValue) { SQLStr.Append(" AND CreateDateTime >= DATEADD(dd, DATEDIFF(dd, 0, GETDATE()) - @0, 0)", filter.DaysOfPeroid.Value); } if (_orderby != "") { SQLStr.OrderBy(_orderby); } } return(SQLStr); }
public List <Report_Info> GetByParam(Report_Filter Filter, Paging Page, string[] fieldNames, string _orderby) { if (fieldNames == null) { fieldNames = new string[] { "*" }; } if (Page == null) { Page = new Paging(); } using (var db = new DBExecutor().GetDatabase()) { var SQLStr = ConstructSQL(Filter, fieldNames, _orderby); var result = db.Page <Report_Info>(Page.CurrentPage, Page.ItemsPerPage, SQLStr); Page.Convert <Report_Info>(result); return(result.Items); } }
public List <Report_Info> GetByParam(Report_Filter Filter, string[] fieldNames, string _orderby, Paging Page) { return(GetByParam(Filter, Page, fieldNames, _orderby)); }
public List <Report_Info> GetByParam(Report_Filter Filter, string _orderby, Paging Page) { return(GetByParam(Filter, Page, null, _orderby)); }
public List <Report_Info> GetByParam(Report_Filter Filter, Paging Page) { return(GetByParam(Filter, Page, null, "")); }
public List <Report_Info> GetByParam(Report_Filter Filter) { return(GetByParam(Filter, null, null, "")); }
private Rest.Core.PetaPoco.Sql ConstructSQL(Report_Filter filter) { return(ConstructSQL(filter, new string[] { "*" }, "")); }
public List <Report_Info> GetByParameter(Report_Filter Filter, string[] fieldNames, string _orderby, Rest.Core.Paging Page) { return(new Report_Repo().GetByParam(Filter, fieldNames, _orderby, Page)); }
public List <Report_Info> GetByParameter(Report_Filter Filter, string _orderby) { return(new Report_Repo().GetByParam(Filter, _orderby)); }
public List <Report_Info> GetByParameter(Report_Filter Filter, Rest.Core.Paging Page) { return(new Report_Repo().GetByParam(Filter, Page)); }
public List <Report_Info> GetByParameter(Report_Filter Filter) { return(new Report_Repo().GetByParam(Filter)); }