Esempio n. 1
0
        public ActionResult Guide(Guide_Filter filter, Rest.Core.Paging Page)
        {
            var PermissionCheck = CheckPermission("就醫指南管理");

            if (PermissionCheck != null)
            {
                return(PermissionCheck);
            }
            if (!string.IsNullOrEmpty(filter.ItemName) && filter.ItemName.StartsWith("請輸入"))
            {
                filter.ItemName = null;
            }
            ViewData["Filter"] = filter;
            Rest.Core.Paging page = new Rest.Core.Paging()
            {
            };
            if (Page.CurrentPage > 0)
            {
                page.CurrentPage = Page.CurrentPage;
            }
            List <Guide_Info> data = GuideMan.GetByParameter(filter, page, null, "SortNum");

            ViewData["Model"] = data;
            ViewData["Page"]  = page;
            return(View());
        }
Esempio n. 2
0
        public List <Guide_Info> GetByParam(Guide_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 <Guide_Info>(Page.CurrentPage, Page.ItemsPerPage, SQLStr);
                Page.Convert <Guide_Info>(result);

                return(result.Items);
            }
        }
Esempio n. 3
0
 public List <Guide_Info> GetByParameter(Guide_Filter Filter, string[] fieldNames, string _orderby, Rest.Core.Paging Page)
 {
     return(new Guide_Repo().GetByParam(Filter, fieldNames, _orderby, Page));
 }
Esempio n. 4
0
 public List <Guide_Info> GetByParameter(Guide_Filter Filter, string _orderby)
 {
     return(new Guide_Repo().GetByParam(Filter, _orderby));
 }
Esempio n. 5
0
 public List <Guide_Info> GetByParameter(Guide_Filter Filter, Rest.Core.Paging Page)
 {
     return(new Guide_Repo().GetByParam(Filter, Page));
 }
Esempio n. 6
0
 public List <Guide_Info> GetByParameter(Guide_Filter Filter)
 {
     return(new Guide_Repo().GetByParam(Filter));
 }
Esempio n. 7
0
 public List <Guide_Info> GetByParam(Guide_Filter Filter, string[] fieldNames, string _orderby, Paging Page)
 {
     return(GetByParam(Filter, Page, fieldNames, _orderby));
 }
Esempio n. 8
0
 public List <Guide_Info> GetByParam(Guide_Filter Filter, string _orderby, Paging Page)
 {
     return(GetByParam(Filter, Page, null, _orderby));
 }
Esempio n. 9
0
 public List <Guide_Info> GetByParam(Guide_Filter Filter, Paging Page)
 {
     return(GetByParam(Filter, Page, null, ""));
 }
Esempio n. 10
0
 public List <Guide_Info> GetByParam(Guide_Filter Filter)
 {
     return(GetByParam(Filter, null, null, ""));
 }
Esempio n. 11
0
        private Rest.Core.PetaPoco.Sql ConstructSQL(Guide_Filter filter, string[] fieldNames, string _orderby)
        {
            var SQLStr = Rest.Core.PetaPoco.Sql.Builder
                         .Append("SELECT " + FieldNameArrayToFieldNameString(fieldNames) + " FROM db_Guide")
                         .Append("WHERE 1=1 ");

            if (filter != null)
            {
                if (filter.GuideId.HasValue)
                {
                    SQLStr.Append(" AND GuideId=@0", filter.GuideId.Value);
                }
                if (filter.SortNum.HasValue)
                {
                    SQLStr.Append(" AND SortNum=@0", filter.SortNum.Value);
                }
                if (!string.IsNullOrEmpty(filter.ItemName))
                {
                    SQLStr.Append(" AND ItemName like @0", "%" + filter.ItemName + "%");
                }
                if (filter.DisplayType.HasValue)
                {
                    SQLStr.Append(" AND DisplayType=@0", filter.DisplayType.Value);
                }
                if (!string.IsNullOrEmpty(filter.Link))
                {
                    SQLStr.Append(" AND Link=@0", filter.Link);
                }
                if (!string.IsNullOrEmpty(filter.ContentBody1))
                {
                    SQLStr.Append(" AND ContentBody1=@0", filter.ContentBody1);
                }
                if (!string.IsNullOrEmpty(filter.ContentBody2))
                {
                    SQLStr.Append(" AND ContentBody2=@0", filter.ContentBody2);
                }
                if (!string.IsNullOrEmpty(filter.ContentBody3))
                {
                    SQLStr.Append(" AND ContentBody3=@0", filter.ContentBody3);
                }
                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);
        }
Esempio n. 12
0
 private Rest.Core.PetaPoco.Sql ConstructSQL(Guide_Filter filter)
 {
     return(ConstructSQL(filter, new string[] { "*" }, ""));
 }