public ActionResult Edu(Edu_Filter filter, Rest.Core.Paging Page) { var PermissionCheck = CheckPermission("衛教園區管理"); if (PermissionCheck != null) { return(PermissionCheck); } if (filter.Title == "請輸入衛教標題搜尋") { filter.Title = null; } if (filter != null && !string.IsNullOrEmpty(filter.EduType) && filter.EduType.StartsWith("請選擇")) { filter.EduType = null; } ViewData["Filter"] = filter; Rest.Core.Paging page = new Rest.Core.Paging() { }; if (Page.CurrentPage > 0) { page.CurrentPage = Page.CurrentPage; } List <Edu_Info> data = EduMan.GetByParameter(filter, page, null, "EduDate desc"); ViewData["Model"] = data; ViewData["Page"] = page; return(View()); }
private Rest.Core.PetaPoco.Sql ConstructSQL(Edu_Filter filter, string[] fieldNames, string _orderby) { var SQLStr = Rest.Core.PetaPoco.Sql.Builder .Append("SELECT " + FieldNameArrayToFieldNameString(fieldNames) + " FROM db_Edu") .Append("WHERE 1=1 "); if (filter != null) { if (filter.EduId.HasValue) { SQLStr.Append(" AND EduId=@0", filter.EduId.Value); } if (!string.IsNullOrEmpty(filter.EduType)) { SQLStr.Append(" AND EduType=@0", filter.EduType); } if (filter.EduDate.HasValue) { SQLStr.Append(" AND EduDate=@0", filter.EduDate.Value); } if (!string.IsNullOrEmpty(filter.DateStart)) { SQLStr.Append(" AND DateStart=@0", filter.DateStart); } if (!string.IsNullOrEmpty(filter.DateEnd)) { SQLStr.Append(" AND DateEnd=@0", filter.DateEnd); } if (!string.IsNullOrEmpty(filter.Title)) { SQLStr.Append(" AND Title like @0", "%" + filter.Title + "%"); } if (!string.IsNullOrEmpty(filter.Place)) { SQLStr.Append(" AND Place=@0", filter.Place); } if (!string.IsNullOrEmpty(filter.Teacher)) { SQLStr.Append(" AND Teacher=@0", filter.Teacher); } if (!string.IsNullOrEmpty(filter.Notes)) { SQLStr.Append(" AND Notes=@0", filter.Notes); } if (filter.LastUpdate.HasValue) { SQLStr.Append(" AND LastUpdate=@0", filter.LastUpdate.Value); } if (!string.IsNullOrEmpty(filter.LastUpdator)) { SQLStr.Append(" AND LastUpdator=@0", filter.LastUpdator); } if (_orderby != "") { SQLStr.OrderBy(_orderby); } } return(SQLStr); }
public List <Edu_Info> GetByParam(Edu_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 <Edu_Info>(Page.CurrentPage, Page.ItemsPerPage, SQLStr); Page.Convert <Edu_Info>(result); return(result.Items); } }
public List <Edu_Info> GetByParam(Edu_Filter Filter, string[] fieldNames, string _orderby, Paging Page) { return(GetByParam(Filter, Page, fieldNames, _orderby)); }
public List <Edu_Info> GetByParam(Edu_Filter Filter, string _orderby, Paging Page) { return(GetByParam(Filter, Page, null, _orderby)); }
public List <Edu_Info> GetByParam(Edu_Filter Filter, Paging Page) { return(GetByParam(Filter, Page, null, "")); }
public List <Edu_Info> GetByParam(Edu_Filter Filter) { return(GetByParam(Filter, null, null, "")); }
private Rest.Core.PetaPoco.Sql ConstructSQL(Edu_Filter filter) { return(ConstructSQL(filter, new string[] { "*" }, "")); }
public List <Edu_Info> GetByParameter(Edu_Filter Filter, string[] fieldNames, string _orderby, Rest.Core.Paging Page) { return(new Edu_Repo().GetByParam(Filter, fieldNames, _orderby, Page)); }
public List <Edu_Info> GetByParameter(Edu_Filter Filter, string _orderby) { return(new Edu_Repo().GetByParam(Filter, _orderby)); }
public List <Edu_Info> GetByParameter(Edu_Filter Filter, Rest.Core.Paging Page) { return(new Edu_Repo().GetByParam(Filter, Page)); }
public List <Edu_Info> GetByParameter(Edu_Filter Filter) { return(new Edu_Repo().GetByParam(Filter)); }