예제 #1
0
        public ActionResult Content(AboutContent_Filter filter, Rest.Core.Paging Page)
        {
            var PermissionCheck = CheckPermission("關於萬芳管理");

            if (PermissionCheck != null)
            {
                return(PermissionCheck);
            }
            if (!string.IsNullOrEmpty(filter.UnitName) && filter.UnitName.StartsWith("請輸入"))
            {
                filter.UnitName = null;
            }
            ViewData["Filter"] = filter;

            Rest.Core.Paging page = new Rest.Core.Paging()
            {
            };
            if (Page.CurrentPage > 0)
            {
                page.CurrentPage = Page.CurrentPage;
            }
            List <AboutContent_Info>  data      = AboutContMan.GetByParameter(filter, page, null, "AboutId, AboutCategoryId");
            List <About_Info>         About     = AboutMan.GetAll().OrderBy(x => x.SortNum).ToList();
            List <AboutCategory_Info> Categoary = AboutCateMan.GetAll().OrderBy(x => x.SortNum).ToList();

            ViewData["Model"]     = data;
            ViewData["About"]     = About;
            ViewData["Categoary"] = Categoary;
            ViewData["Page"]      = page;
            return(View());
        }
예제 #2
0
        public List <AboutContent_Info> GetByParam(AboutContent_Filter Filter, Paging Page, string _orderby)
        {
            if (Page == null)
            {
                Page = new Paging();
            }
            using (var db = new DBExecutor().GetDatabase())
            {
                var SQLStr = ConstructSQL(Filter, _orderby);

                var result = db.Page <AboutContent_Info>(Page.CurrentPage, Page.ItemsPerPage, SQLStr);
                Page.Convert <AboutContent_Info>(result);

                return(result.Items);
            }
        }
예제 #3
0
 public List <AboutContent_Info> GetByParam(AboutContent_Filter Filter, string[] fieldNames, string _orderby, Paging Page)
 {
     return(GetByParam(Filter, Page, fieldNames, _orderby));
 }
예제 #4
0
 public List <AboutContent_Info> GetByParam(AboutContent_Filter Filter, string _orderby)
 {
     return(GetByParam(Filter, null, null, _orderby));
 }
예제 #5
0
 public List <AboutContent_Info> GetByParam(AboutContent_Filter Filter, Paging Page)
 {
     return(GetByParam(Filter, Page, null, ""));
 }
예제 #6
0
        private Rest.Core.PetaPoco.Sql ConstructSQL(AboutContent_Filter filter, string[] fieldNames, string _orderby)
        {
            var SQLStr = Rest.Core.PetaPoco.Sql.Builder
                         .Append("SELECT " + FieldNameArrayToFieldNameString(fieldNames) + " FROM db_AboutContent")
                         .Append("WHERE 1=1 ");

            if (filter != null)
            {
                if (filter.AboutContentId.HasValue)
                {
                    SQLStr.Append(" AND AboutContentId=@0", filter.AboutContentId.Value);
                }
                if (filter.AboutId.HasValue)
                {
                    SQLStr.Append(" AND AboutId=@0", filter.AboutId.Value);
                }
                if (filter.AboutCategoryId.HasValue)
                {
                    SQLStr.Append(" AND AboutCategoryId=@0", filter.AboutCategoryId.Value);
                }
                if (!string.IsNullOrEmpty(filter.UnitName))
                {
                    SQLStr.Append(" AND UnitName like @0", "%" + filter.UnitName + "%");
                }
                if (filter.OpenType.HasValue)
                {
                    SQLStr.Append(" AND OpenType=@0", filter.OpenType.Value);
                }
                if (!string.IsNullOrEmpty(filter.OpenUrl))
                {
                    SQLStr.Append(" AND OpenUrl=@0", filter.OpenUrl);
                }
                if (!string.IsNullOrEmpty(filter.Content1))
                {
                    SQLStr.Append(" AND Content1=@0", filter.Content1);
                }
                if (!string.IsNullOrEmpty(filter.Content2))
                {
                    SQLStr.Append(" AND Content2=@0", filter.Content2);
                }
                if (!string.IsNullOrEmpty(filter.Content3))
                {
                    SQLStr.Append(" AND Content3=@0", filter.Content3);
                }
                if (!string.IsNullOrEmpty(filter.Image1))
                {
                    SQLStr.Append(" AND Image1=@0", filter.Image1);
                }
                if (!string.IsNullOrEmpty(filter.Image2))
                {
                    SQLStr.Append(" AND Image2=@0", filter.Image2);
                }
                if (!string.IsNullOrEmpty(filter.Image3))
                {
                    SQLStr.Append(" AND Image3=@0", filter.Image3);
                }
                if (filter.Position1.HasValue)
                {
                    SQLStr.Append(" AND Position1=@0", filter.Position1.Value);
                }
                if (filter.Position2.HasValue)
                {
                    SQLStr.Append(" AND Position2=@0", filter.Position2.Value);
                }
                if (filter.Position3.HasValue)
                {
                    SQLStr.Append(" AND Position3=@0", filter.Position3.Value);
                }
                if (filter.IsActive.HasValue)
                {
                    SQLStr.Append(" AND IsActive=@0", filter.IsActive.Value);
                }
                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 (filter.VerifiedDate.HasValue)
                {
                    SQLStr.Append(" AND VerifiedDate=@0", filter.VerifiedDate.Value);
                }
                if (_orderby != "")
                {
                    SQLStr.OrderBy(_orderby);
                }
            }
            return(SQLStr);
        }
예제 #7
0
 private Rest.Core.PetaPoco.Sql ConstructSQL(AboutContent_Filter filter)
 {
     return(ConstructSQL(filter, new string[] { "*" }, ""));
 }
예제 #8
0
        private Rest.Core.PetaPoco.Sql ConstructSQL(AboutContent_Filter filter, string _orderby)
        {
            var SQLStr = Rest.Core.PetaPoco.Sql.Builder
                         .Append("SELECT b.Category as AboutName,b.Category as CategoryName, a.* FROM db_AboutContent a ")
                         .Append(@"inner join db_About b on a.AboutId = b.AboutId 
                          inner join db_AboutCategory c on c.AboutCategoryId = a.AboutCategoryId")
                         .Append("WHERE 1=1 ");

            if (filter != null)
            {
                if (filter.AboutContentId.HasValue)
                {
                    SQLStr.Append(" AND a.AboutContentId=@0", filter.AboutContentId.Value);
                }
                if (filter.AboutCategoryId.HasValue)
                {
                    SQLStr.Append(" AND a.AboutCategoryId=@0", filter.AboutCategoryId.Value);
                }
                if (!string.IsNullOrEmpty(filter.UnitName))
                {
                    SQLStr.Append(" AND a.UnitName=@0", filter.UnitName);
                }
                if (filter.OpenType.HasValue)
                {
                    SQLStr.Append(" AND a.OpenType=@0", filter.OpenType.Value);
                }
                if (!string.IsNullOrEmpty(filter.OpenUrl))
                {
                    SQLStr.Append(" AND a.OpenUrl=@0", filter.OpenUrl);
                }
                if (!string.IsNullOrEmpty(filter.Content1))
                {
                    SQLStr.Append(" AND a.Content1=@0", filter.Content1);
                }
                if (!string.IsNullOrEmpty(filter.Content2))
                {
                    SQLStr.Append(" AND a.Content2=@0", filter.Content2);
                }
                if (!string.IsNullOrEmpty(filter.Content3))
                {
                    SQLStr.Append(" AND a.Content3=@0", filter.Content3);
                }
                if (!string.IsNullOrEmpty(filter.Image1))
                {
                    SQLStr.Append(" AND a.Image1=@0", filter.Image1);
                }
                if (!string.IsNullOrEmpty(filter.Image2))
                {
                    SQLStr.Append(" AND a.Image2=@0", filter.Image2);
                }
                if (!string.IsNullOrEmpty(filter.Image3))
                {
                    SQLStr.Append(" AND a.Image3=@0", filter.Image3);
                }
                if (filter.Position1.HasValue)
                {
                    SQLStr.Append(" AND a.Position1=@0", filter.Position1.Value);
                }
                if (filter.Position2.HasValue)
                {
                    SQLStr.Append(" AND a.Position2=@0", filter.Position2.Value);
                }
                if (filter.Position3.HasValue)
                {
                    SQLStr.Append(" AND a.Position3=@0", filter.Position3.Value);
                }
                if (filter.IsActive.HasValue)
                {
                    SQLStr.Append(" AND a.IsActive=@0", filter.IsActive.Value);
                }
                if (filter.LastUpdate.HasValue)
                {
                    SQLStr.Append(" AND a.LastUpdate=@0", filter.LastUpdate.Value);
                }
                if (!string.IsNullOrEmpty(filter.LastUpdator))
                {
                    SQLStr.Append(" AND a.LastUpdator=@0", filter.LastUpdator);
                }
                if (_orderby != "")
                {
                    SQLStr.Append("ORDER BY @0", _orderby);
                }
            }
            return(SQLStr);
        }
예제 #9
0
 public List <AboutContent_Info> GetByParameter(AboutContent_Filter Filter, string[] fieldNames, string _orderby, Rest.Core.Paging Page)
 {
     return(new AboutContent_Repo().GetByParam(Filter, fieldNames, _orderby, Page));
 }
예제 #10
0
 public List <AboutContent_Info> GetByParameter(AboutContent_Filter Filter, string _orderby)
 {
     return(new AboutContent_Repo().GetByParam(Filter, _orderby));
 }
예제 #11
0
 public List <AboutContent_Info> GetByParameter(AboutContent_Filter Filter, Rest.Core.Paging Page)
 {
     return(new AboutContent_Repo().GetByParam(Filter, Page));
 }
예제 #12
0
 public List <AboutContent_Info> GetByParameter(AboutContent_Filter Filter)
 {
     return(new AboutContent_Repo().GetByParam(Filter));
 }
예제 #13
0
 public List <AboutContent_Info> GetByParam(AboutContent_Filter Filter, string _orderby, Paging Page)
 {
     return(new AboutBindingListing_Repo().GetByParam(Filter, Page, _orderby));
 }
예제 #14
0
 public List <AboutContent_Info> GetByParam(AboutContent_Filter Filter)
 {
     return(new AboutBindingListing_Repo().GetByParam(Filter));
 }