Example #1
0
        public ActionResult DownLoad(WebDownload_Filter filter, Rest.Core.Paging Page)
        {
            if (!sessionData.trading.Dept.HasValue)
            {
                return(View("~/Views/Manage/PermissionDeny.aspx"));
            }
            else
            {
                if (filter.DocumentName == "請輸入檔案名稱搜尋")
                {
                    filter.DocumentName = null;
                }
                if (!sessionData.trading.IsVerifier)
                {
                    filter.DeptName = EnumHelper.GetEnumDescription <WS_Dept_type>(sessionData.trading.Dept.Value);
                    filter.CostName = sessionData.trading.CostName;
                }

                ViewData["Filter"] = filter;

                Rest.Core.Paging page = new Rest.Core.Paging()
                {
                };
                if (Page.CurrentPage > 0)
                {
                    page.CurrentPage = Page.CurrentPage;
                }
                List <WebDownload_Info> data = Downloadman.GetByParameter(filter, page, null, "SortNum");
                ViewData["Model"] = data;
                ViewData["Page"]  = page;
                return(View());
            }
        }
Example #2
0
        private Rest.Core.PetaPoco.Sql ConstructSQL(WebDownload_Filter filter, string[] fieldNames, string _orderby)
        {
            var SQLStr = Rest.Core.PetaPoco.Sql.Builder
                         .Append("SELECT " + FieldNameArrayToFieldNameString(fieldNames) + " FROM db_WebDownload")
                         .Append("WHERE 1=1 ");

            if (filter != null)
            {
                if (filter.WebDownLoadID.HasValue)
                {
                    SQLStr.Append(" AND WebDownLoadID=@0", filter.WebDownLoadID.Value);
                }
                if (filter.SortNum.HasValue)
                {
                    SQLStr.Append(" AND SortNum=@0", filter.SortNum.Value);
                }
                if (!string.IsNullOrEmpty(filter.CostName))
                {
                    SQLStr.Append(" AND CostName=@0", filter.CostName);
                }
                if (!string.IsNullOrEmpty(filter.CostId))
                {
                    SQLStr.Append(" AND CostId=@0", filter.CostId);
                }
                if (!string.IsNullOrEmpty(filter.DeptName))
                {
                    SQLStr.Append(" AND DeptName=@0", filter.DeptName);
                }
                if (!string.IsNullOrEmpty(filter.File1))
                {
                    SQLStr.Append(" AND File1=@0", filter.File1);
                }
                if (!string.IsNullOrEmpty(filter.DocumentName))
                {
                    SQLStr.Append(" AND DocumentName like @0", "%" + filter.DocumentName + "%");
                }
                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);
        }
Example #3
0
        public List <WebDownload_Info> GetByParam(WebDownload_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 <WebDownload_Info>(Page.CurrentPage, Page.ItemsPerPage, SQLStr);
                Page.Convert <WebDownload_Info>(result);

                return(result.Items);
            }
        }
Example #4
0
 public List <WebDownload_Info> GetByParam(WebDownload_Filter Filter, string[] fieldNames, string _orderby, Paging Page)
 {
     return(GetByParam(Filter, Page, fieldNames, _orderby));
 }
Example #5
0
 public List <WebDownload_Info> GetByParam(WebDownload_Filter Filter, string _orderby, Paging Page)
 {
     return(GetByParam(Filter, Page, null, _orderby));
 }
Example #6
0
 public List <WebDownload_Info> GetByParam(WebDownload_Filter Filter, Paging Page)
 {
     return(GetByParam(Filter, Page, null, ""));
 }
Example #7
0
 private Rest.Core.PetaPoco.Sql ConstructSQL(WebDownload_Filter filter)
 {
     return(ConstructSQL(filter, new string[] { "*" }, ""));
 }
Example #8
0
 public List <WebDownload_Info> GetByParameter(WebDownload_Filter Filter, string[] fieldNames, string _orderby, Rest.Core.Paging Page)
 {
     return(new WebDownload_Repo().GetByParam(Filter, fieldNames, _orderby, Page));
 }
Example #9
0
 public List <WebDownload_Info> GetByParameter(WebDownload_Filter Filter, string _orderby)
 {
     return(new WebDownload_Repo().GetByParam(Filter, _orderby));
 }
Example #10
0
 public List <WebDownload_Info> GetByParameter(WebDownload_Filter Filter, Rest.Core.Paging Page)
 {
     return(new WebDownload_Repo().GetByParam(Filter, Page));
 }
Example #11
0
 public List <WebDownload_Info> GetByParameter(WebDownload_Filter Filter)
 {
     return(new WebDownload_Repo().GetByParam(Filter));
 }