Esempio n. 1
0
        private List <BannerDetailsModel> GetBannerList()
        {
            List <BannerDetailsModel> results = new List <BannerDetailsModel>();
            List <BANNER>             data    = new List <BANNER>();

            try
            {
                data = DB.BANNER
                       .Where(o => o.DISABLE == false)
                       .OrderByDescending(o => o.BUD_DT).ThenByDescending(g => g.SQ)
                       .ToList();
                FileModule fileModule = new FileModule();
                using (var bannerModule = new BannerModule())
                {
                    foreach (var d in data)
                    {
                        PublicMethodRepository.HtmlDecode(d);
                        BannerDetailsModel temp = bannerModule.DoGetDetailsByID(d.ID);
                        temp.Files = fileModule.GetFiles((int)d.ID, "Banner", "F");
                        results.Add(temp);
                    }
                }
                fileModule.Dispose();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(results);
        }
Esempio n. 2
0
        private NewsListResultModel GetNewsList()
        {
            NewsListResultModel result = new NewsListResultModel();
            List <NEWS>         data   = new List <NEWS>();

            try
            {
                data = DB.NEWS
                       .Where(o => o.DISABLE == false && o.HOME_PAGE_DISPLAY == true)
                       .OrderByDescending(o => o.PUB_DT_STR).ThenByDescending(g => g.SQ)
                       .ToList()
                       .Take(5).ToList();

                foreach (var d in data)
                {
                    PublicMethodRepository.HtmlDecode(d);
                }

                result.Data = data;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Esempio n. 3
0
        public ResultDetailsDataModel DoGetDetailsByID(int ID)
        {
            ResultDetailsDataModel result = new ResultDetailsDataModel();
            RESULT data = DB.RESULT.Where(w => w.ID == ID).FirstOrDefault();

            PublicMethodRepository.HtmlDecode(data);
            result.Data = data;
            return(result);
        }
Esempio n. 4
0
        public ActivityListResultModel DoGetList(ActivityFilterModel filterModel)
        {
            PublicMethodRepository.FilterXss(filterModel);
            ActivityListResultModel result = new ActivityListResultModel();
            Dictionary <int, bool>  validActivityStatus = new Dictionary <int, bool>();
            List <OLACT>            data = new List <OLACT>();

            try
            {
                data = DB.OLACT.ToList();

                //關鍵字搜尋
                if (!string.IsNullOrEmpty(filterModel.QueryString))
                {
                    this.ListFilter(filterModel.QueryString, ref data);
                }
                //發佈日期搜尋
                if (!string.IsNullOrEmpty(filterModel.PublishDate))
                {
                    this.ListDateFilter((filterModel.PublishDate), ref data);
                }

                //上下架
                if (!string.IsNullOrEmpty(filterModel.Disable))
                {
                    this.ListStatusFilter(filterModel.Disable, ref data);
                }

                //排序
                this.ListSort(filterModel.SortColumn, ref data);

                PaginationResult pagination;
                //分頁
                this.ListPageList(filterModel.CurrentPage, ref data, out pagination);
                result.Pagination = pagination;
                foreach (var d in data)
                {
                    PublicMethodRepository.HtmlDecode(d);
                }

                result.Data = data;
                foreach (var d in data)
                {
                    if (!validActivityStatus.ContainsKey(d.ID))
                    {
                        validActivityStatus.Add(d.ID, true);
                    }
                    validActivityStatus[d.ID] = ActivityStatusCheckByID(d.ID);
                }
                result.ValidActivityStatusBuffer = validActivityStatus;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Esempio n. 5
0
        public NewsDetailsDataModel DoGetDetailsByID(int ID)
        {
            NewsDetailsDataModel result = new NewsDetailsDataModel();
            NEWS data = DB.NEWS.Where(w => w.ID == ID).FirstOrDefault();

            PublicMethodRepository.HtmlDecode(data);
            result.Data = data;
            return(result);
        }
Esempio n. 6
0
        public NewsListResultModel DoGetList(NewsListFilterModel filterModel)
        {
            PublicMethodRepository.FilterXss(filterModel);
            NewsListResultModel result = new NewsListResultModel();
            List <NEWS>         data   = new List <NEWS>();

            try
            {
                data = DB.NEWS.ToList();

                //關鍵字搜尋
                if (!string.IsNullOrEmpty(filterModel.QueryString))
                {
                    this.ListFilter(filterModel.QueryString, ref data);
                }

                //發佈日期搜尋
                if (!string.IsNullOrEmpty(filterModel.PublishDate))
                {
                    this.ListDateFilter(filterModel.PublishDate, ref data);
                }

                //首頁顯示
                if (!string.IsNullOrEmpty(filterModel.DisplayForHomePage))
                {
                    this.ListStatusFilter(filterModel.DisplayForHomePage, "DisplayHome", ref data);
                }

                //上下架
                if (!string.IsNullOrEmpty(filterModel.Disable))
                {
                    this.ListStatusFilter(filterModel.Disable, "Disable", ref data);
                }

                //排序
                this.ListSort(filterModel.SortColumn, ref data);
                PaginationResult pagination;
                //分頁
                this.ListPageList(filterModel.CurrentPage, ref data, out pagination);
                result.Pagination = pagination;
                foreach (var d in data)
                {
                    PublicMethodRepository.HtmlDecode(d);
                }

                result.Data = data;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Esempio n. 7
0
        public TeamDetailsDataModel DoGetDetailsByID(int ID)
        {
            TeamDetailsDataModel result = new TeamDetailsDataModel();

            using (var db = new RITUAL())
            {
                TEAM data = db.TEAM.Where(w => w.ID == ID).FirstOrDefault();
                PublicMethodRepository.HtmlDecode(data);
                result.Data = data;
            }

            return(result);
        }
Esempio n. 8
0
        public BannerDetailsModel DoGetDetailsByID(int ID)
        {
            BannerDetailsModel details =
                DB.BANNER.Where(w => w.ID == ID)
                .Select(s => new BannerDetailsModel()
            {
                ID      = s.ID,
                Disable = s.DISABLE,
                Sort    = s.SQ,
                Title   = s.TITLE
            })
                .FirstOrDefault();

            PublicMethodRepository.HtmlDecode(details);
            return(details);
        }
Esempio n. 9
0
        public Dictionary <bool, string> GetProductInfo()
        {
            Dictionary <bool, string> result = new Dictionary <bool, string>();

            using (var db = new REDOXDB())
            {
                result = db.LISTEDITOR
                         .Where(s => s.OBJ_NAME == _actionName)
                         .ToDictionary(d => d.STATUS, d => d.OBJ_CONTENT);
            }
            if (result.Count > 0)
            {
                PublicMethodRepository.HtmlDecode(result.Values.First());
            }
            return(result);
        }
Esempio n. 10
0
        public string GetContent()
        {
            string result = string.Empty;

            var data = this.DB.EDITOR.FirstOrDefault();

            if (data != null)
            {
                result = data.CONTENT;
                PublicMethodRepository.HtmlDecode(new List <string>()
                {
                    result
                });
            }
            return(result);
        }
Esempio n. 11
0
        public DownloadDetailsModel DoGetDetailsByID(int ID)
        {
            DownloadDetailsModel details =
                DB.DLFILES.Where(w => w.ID == ID)
                .Select(s => new DownloadDetailsModel()
            {
                ID             = s.ID,
                Disable        = s.DISABLE,
                PublishDateStr = s.PUB_DT_STR,
                Sort           = s.SQ,
                Title          = s.TITLE
            })
                .FirstOrDefault();

            PublicMethodRepository.HtmlDecode(details);
            return(details);
        }
Esempio n. 12
0
        /// <summary>
        /// 取得使用者資訊
        /// </summary>
        /// <param name="userModel"></param>
        /// <returns></returns>
        public LoginUserInfoModel GetUserBySignID(SignInModel userModel)
        {
            LoginUserInfoModel userInfo =
                this.DB.USER
                .Where(s => s.USR_ID == userModel.Account && s.USR_PWD == userModel.Password)
                .Select(s => new LoginUserInfoModel()
            {
                ID          = s.ID,
                UserAccount = s.USR_ID,
                UserName    = s.USR_NM,
                IsDisabled  = s.DISABLE,
            })
                .FirstOrDefault();

            PublicMethodRepository.HtmlDecode(userInfo);
            return(userInfo);
        }
Esempio n. 13
0
        /// <summary>
        /// 取得報名明細 其中參賽群組已判斷報名數量
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public ApplyViewDetailsModel GetViewActivityDetailsByID(int ID)
        {
            ApplyViewDetailsModel details =
                DB.OLACT.Where(w => w.ID == ID)
                .Select(s => new ApplyViewDetailsModel()
            {
                ID             = s.ID,
                Disable        = s.DISABLE,
                PublishDateStr = s.PUB_DT_STR,
                Sort           = s.SQ,
                Title          = s.ACTITLE,
                ActivityDateTimeDescription = s.ACT_DATE_DESC,
                ActivityContent             = s.ACT_CONTENT,
                ApplyDateTimeBegin          = s.APPLY_DATE_BEGIN,
                ApplyDateTimeEnd            = s.APPLY_DATE_END,
                ActivityNumber = s.ACT_NUM
            })
                .FirstOrDefault();

            PublicMethodRepository.HtmlDecode(details);

            if (details != null)
            {
                var group = DB.OLACTGROUP
                            .Where(o => o.MAP_ACT_ID == ID)
                            .Select(s => new ApplyViewGroup()
                {
                    GroupID         = s.ID,
                    GroupName       = s.GROUP_NAME,
                    GroupApplyLimit = s.TEAM_APPLY_LIMIT,
                    CountApplyLimit = s.COUNT_APPLY_LIMIT
                })
                            .ToList();

                foreach (var g in group)
                {
                    var applyGorupLimitCount = DB.APPLY.Where(o => o.MAP_ACT_ID == ID && o.MAP_ACT_GUP_ID == g.GroupID).Count();
                    g.CountApplyLastLimit = (g.GroupApplyLimit - applyGorupLimitCount) <= 0 ? 0 : (g.GroupApplyLimit - applyGorupLimitCount);
                    details.ActivityGroup.Add(g);
                }
                details.ApplyGroupJsonString = JsonConvert.SerializeObject(details.ActivityGroup);
            }
            return(details);
        }
Esempio n. 14
0
        public ApplyExcelReplyDataModel GetApplyDetailsForExcel(ApplyExcelReplyDataModel details)
        {
            details.GroupList = GetActivityGroupListByID(details.ActivityID);
            var activityData = DB.OLACT.Where(o => o.ID == details.ActivityID).FirstOrDefault();

            if (activityData == null)
            {
                throw new Exception("無法取得該活動賽事,是否已被移除?");
            }

            details.ActivityID   = activityData.ID;
            details.ActivityName = activityData.ACTITLE;

            var applyLstData =
                DB.APPLY
                .Where(w => w.MAP_ACT_ID == details.ActivityID)
                .AsEnumerable()
                .Select(s => new ApplyListDetailsData()
            {
                ID                   = s.ID,
                ApplyDate            = s.BUD_DT.ConvertDateTimeTo10CodeString(),
                ApplyNumber          = s.APPLY_IDEN_NUM,
                ApplySuccessStatus   = s.APPLY_SUCCESS,
                ApplyTeamName        = s.TEAM_NM,
                ApplyTeamMemberCount = DB.APPLY_MEMBER.Where(o => o.MAP_APPLY_ID == s.ID && o.REF_ACT_ID == details.ActivityID).Count(),
                GroupID              = s.MAP_ACT_GUP_ID,
                ContactPhone         = s.CONTACT_PHONE,
                ContactEmail         = s.EMAIL,
                Remark               = s.REMRK.ReplaceEmpty(),
                Coach                = s.TEAM_COACH,
                Contact              = s.CONTACT,
                MemberInfo           = GetMemberInfoByApplyID(details.ActivityID, s.ID)
            })
                .ToList();

            details.ApplyListData = applyLstData;


            foreach (var d in details.ApplyListData)
            {
                PublicMethodRepository.HtmlDecode(d);
            }
            return(details);
        }
Esempio n. 15
0
        public ApplyMaintainListResultModel DoGetList(ApplyMaintainListFilterModel filterModel)
        {
            ApplyMaintainListResultModel      result = new ApplyMaintainListResultModel();
            List <ApplyMaintainListDataModel> data   = new List <ApplyMaintainListDataModel>();

            try
            {
                data = DB.OLACT
                       .AsEnumerable()
                       .Select(s => new ApplyMaintainListDataModel()
                {
                    ID                = s.ID,
                    ActivityName      = s.ACTITLE,
                    PublishDateString = s.PUB_DT_STR,
                    Sort              = s.SQ,
                    ApplyStatus       = ActivityStatusCheckByID(s.ID),
                    RegisteredCount   = DB.APPLY.Where(g => g.MAP_ACT_ID == s.ID).Count(),
                    LimitCount        = DB.OLACTGROUP.Where(o => o.MAP_ACT_ID == s.ID).Sum(m => m.TEAM_APPLY_LIMIT),
                    ActivityDateRange = s.ACT_DATE_DESC
                })
                       .ToList();

                //排序
                this.ListSort(filterModel.SortColumn, ref data);

                PaginationResult pagination;
                //分頁
                this.ListPageList(filterModel.CurrentPage, ref data, out pagination);
                result.Pagination = pagination;
                foreach (var d in data)
                {
                    PublicMethodRepository.HtmlDecode(d);
                }

                result.Data = data;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Esempio n. 16
0
        public BannerListResultModel DoGetList(BannerFilterModel filterModel)
        {
            PublicMethodRepository.FilterXss(filterModel);
            BannerListResultModel result = new BannerListResultModel();
            List <BANNER>         data   = new List <BANNER>();

            try
            {
                data = DB.BANNER.ToList();

                //關鍵字搜尋
                if (!string.IsNullOrEmpty(filterModel.QueryString))
                {
                    this.ListFilter(filterModel.QueryString, ref data);
                }

                //上下架
                if (!string.IsNullOrEmpty(filterModel.Disable))
                {
                    this.ListStatusFilter(filterModel.Disable, ref data);
                }

                //排序
                this.ListSort(filterModel.SortColumn, ref data);

                PaginationResult pagination;
                //分頁
                this.ListPageList(filterModel.CurrentPage, ref data, out pagination);
                result.Pagination = pagination;
                foreach (var d in data)
                {
                    PublicMethodRepository.HtmlDecode(d);
                }

                result.Data = data;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Esempio n. 17
0
        public override object DoGetDetailsByID(int ID)
        {
            ProductDetailsDataModel result = new ProductDetailsDataModel();
            PRODUCT data = new PRODUCT();

            if (PublicMethodRepository.CurrentMode == SiteMode.FronEnd)
            {
                data = DB.PRODUCT.Where(w => w.ID == ID && !w.DISABLE).FirstOrDefault();
            }
            else if (PublicMethodRepository.CurrentMode == SiteMode.Home)
            {
                data = DB.PRODUCT.Where(w => w.ID == ID && !w.DISABLE && w.HOME_PAGE_DISPLAY).FirstOrDefault();
            }
            else
            {
                data = DB.PRODUCT.Where(w => w.ID == ID).FirstOrDefault();
            }
            PublicMethodRepository.HtmlDecode(data);
            result.Data = data;
            return(result);
        }
Esempio n. 18
0
        public DownloadFrontResultModel GetList(int page)
        {
            DownloadFrontResultModel result = new DownloadFrontResultModel();

            try
            {
                var data = this.DB.DLFILES
                           .AsEnumerable()
                           .OrderByDescending(o => o.PUB_DT_STR).ThenByDescending(a => a.SQ)
                           .Where(o => o.DISABLE == false)
                           .Select(o => new DownloadFrontDataModel()
                {
                    ID             = o.ID,
                    Title          = o.TITLE,
                    PublishDateStr = o.PUB_DT_STR
                })
                           .ToList();
                result.Data = data;
                result      = this.ListPagination(ref result, page, Convert.ToInt32(PublicMethodRepository.GetConfigAppSetting("DefaultPageSize")));

                foreach (var item in data)
                {
                    PublicMethodRepository.HtmlDecode(item);
                }


                using (var fileModule = new FileModule())
                {
                    foreach (var item in data)
                    {
                        item.Files = fileModule.GetFiles((int)item.ID, "Download", "F");
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Esempio n. 19
0
        public bool ChangePassword(FormCollection form)
        {
            if (UserProvider.Instance.User == null)
            {
                throw new Exception("請先登入!");
            }
            var oldPwd     = form["oldPw"];
            var newPwd     = form["newPw"];
            var rePwd      = form["rePw"];
            var entityUser = this.DB.USER
                             .Where(o => o.ID == UserProvider.Instance.User.ID &&
                                    o.USR_ID == UserProvider.Instance.User.UserAccount).First();

            PublicMethodRepository.HtmlDecode(entityUser);


            bool isTruePw = (oldPwd == entityUser.USR_PWD);

            if (isTruePw)
            {
                if (newPwd.Equals(rePwd))
                {
                    PublicMethodRepository.FilterXss(entityUser);
                    entityUser.USR_PWD = rePwd;
                    this.DB.Entry(entityUser).State = EntityState.Modified;
                    this.DB.SaveChanges();
                }
                else
                {
                    throw new Exception("新密碼兩次輸入密碼不同.");
                }
            }
            else
            {
                throw new Exception("原密碼輸入錯誤.");
            }
            return(true);
        }
Esempio n. 20
0
        public ApplyListViewModel GetList(int page, bool getContent = false)
        {
            ApplyListViewModel model = new ApplyListViewModel();
            var data = DB.OLACT
                       .AsEnumerable()
                       .OrderByDescending(o => o.PUB_DT_STR).ThenByDescending(a => a.SQ)
                       .Select(s => new ApplyListViewDataModel()
            {
                ID = s.ID,
                ActivityDateTimeDescription = s.ACT_DATE_DESC,
                ApplyDateRange = string.Concat(s.APPLY_DATE_BEGIN, "~", s.APPLY_DATE_END),
                Sort           = s.SQ,
                Title          = s.ACTITLE,
                Remark         = s.ACT_CONTENT
            })
                       .ToList();

            using (var actModule = new ActivityModule())
            {
                foreach (var d in data)
                {
                    d.GroupApplyLimit = DB.OLACTGROUP.Where(o => o.MAP_ACT_ID == d.ID).Sum(o => o.TEAM_APPLY_LIMIT);
                    d.Registered      = DB.APPLY.Where(g => g.MAP_ACT_ID == d.ID).Count();
                    d.ActivityStatus  = actModule.ActivityStatusCheckByID((int)d.ID);
                }
            }
            model.ListData = data;
            foreach (var d in data)
            {
                PublicMethodRepository.HtmlDecode(d);
            }

            if (!getContent)
            {
                model = this.ListPagination(ref model, page, Convert.ToInt32(PublicMethodRepository.GetConfigAppSetting("DefaultPageSize")));
            }
            return(model);
        }
Esempio n. 21
0
        public ActivityDetailsModel DoGetDetailsByID(int ID)
        {
            ActivityDetailsModel details =
                DB.OLACT.Where(w => w.ID == ID)
                .Select(s => new ActivityDetailsModel()
            {
                ID             = s.ID,
                Disable        = s.DISABLE,
                PublishDateStr = s.PUB_DT_STR,
                Sort           = s.SQ,
                Title          = s.ACTITLE,
                ActivityDateTimeDescription = s.ACT_DATE_DESC,
                ActivityContent             = s.ACT_CONTENT,
                ApplyDateTimeBegin          = s.APPLY_DATE_BEGIN,
                ApplyDateTimeEnd            = s.APPLY_DATE_END,
                ActivityNumber = s.ACT_NUM
            })
                .FirstOrDefault();

            PublicMethodRepository.HtmlDecode(details);

            if (details != null)
            {
                details.ActivityGroup = DB.OLACTGROUP
                                        .Where(o => o.MAP_ACT_ID == ID)
                                        .Select(s => new ActivityGroup()
                {
                    GroupID         = s.ID,
                    GroupName       = s.GROUP_NAME,
                    GroupApplyLimit = s.TEAM_APPLY_LIMIT,
                    CountApplyLimit = s.COUNT_APPLY_LIMIT
                })
                                        .ToList();
            }
            return(details);
        }
Esempio n. 22
0
        public ApplyDetailsDataModel GetApplyDetails(ApplyDetailsDataModel details)
        {
            details.GroupList = GetActivityGroupListByID(details.ActivityID);
            var activityData = DB.OLACT.Where(o => o.ID == details.ActivityID).FirstOrDefault();

            if (activityData == null)
            {
                throw new Exception("無喇取得該活動賽事,是否已被移除?");
            }

            details.ActivityID        = activityData.ID;
            details.ActivityDateRange = activityData.ACT_DATE_DESC;
            details.ActivityName      = activityData.ACTITLE;

            var applyLstData =
                DB.APPLY
                .Where(w => w.MAP_ACT_ID == details.ActivityID)
                .AsEnumerable()
                .Select(s => new ApplyDetailsListDataModel()
            {
                ID                   = s.ID,
                ApplyDate            = s.BUD_DT.ConvertDateTimeTo10CodeString(),
                ApplyNumber          = s.APPLY_IDEN_NUM,
                ApplySuccessStatus   = s.APPLY_SUCCESS,
                ApplyTeamName        = s.TEAM_NM,
                ApplyTeamMemberCount = DB.APPLY_MEMBER.Where(o => o.MAP_APPLY_ID == s.ID && o.REF_ACT_ID == details.ActivityID).Count(),
                GroupID              = s.MAP_ACT_GUP_ID,
                ContactPhone         = s.CONTACT_PHONE
            })
                .ToList();

            details.ListData.Result.Data             = applyLstData;
            details.GroupInfo.RegisteredSuccessCount = DB.APPLY.Where(o => o.MAP_ACT_ID == details.ActivityID && o.APPLY_SUCCESS == true).Count();
            details.GroupInfo.RegisteredCount        = DB.APPLY.Where(g => g.MAP_ACT_ID == details.ActivityID).Count();
            details.GroupInfo.GroupApplyLimit        = DB.OLACTGROUP.Where(o => o.MAP_ACT_ID == details.ActivityID).Sum(m => m.TEAM_APPLY_LIMIT);

            if (details.ListData.Filter.GroupID.HasValue)
            {
                applyLstData = applyLstData.Where(o => o.GroupID == details.ListData.Filter.GroupID).ToList();
                details.ListData.Result.Data = applyLstData;
                //若要在上方訊息區塊秀出對應的組別資料 移除下面註解
                //details.GroupInfo = GetGroupInfoByID(details.ActivityID, (int)details.ListData.Filter.GroupID);
            }

            if (!string.IsNullOrEmpty(details.ListData.Filter.QueryString))
            {
                details.ListData.Result.Data = applyLstData.Where(o => o.ApplyTeamName.Contains(details.ListData.Filter.QueryString)).ToList();
            }

            //排序
            switch (details.ListData.Filter.SortColumn)
            {
            case "sortApplyStatus/asc":
                details.ListData.Result.Data = details.ListData.Result.Data.OrderBy(o => o.ApplySuccessStatus).ThenByDescending(o => o.ApplyDate).ToList();
                break;

            case "sortApplyStatus/desc":
                details.ListData.Result.Data = details.ListData.Result.Data.OrderByDescending(o => o.ApplySuccessStatus).ThenByDescending(o => o.ApplyDate).ToList();
                break;

            default:
                details.ListData.Result.Data = details.ListData.Result.Data.OrderByDescending(o => o.ApplyDate).ThenByDescending(g => g.ApplySuccessStatus).ToList();
                break;
            }
            PaginationResult pagination;
            var tempData = details.ListData.Result.Data;

            //分頁
            this.ListPageList(details.ListData.Filter.CurrentPage, ref tempData, out pagination);
            details.ListData.Result.Data       = tempData;
            details.ListData.Result.Pagination = pagination;
            foreach (var d in details.ListData.Result.Data)
            {
                PublicMethodRepository.HtmlDecode(d);
            }
            return(details);
        }
Esempio n. 23
0
        public TeamListResultModel DoGetList(TeamListFilterModel filterModel)
        {
            PublicMethodRepository.FilterXss(filterModel);
            TeamListResultModel result = new TeamListResultModel();
            List <TEAM>         data   = new List <TEAM>();

            using (var db = new RITUAL())
            {
                try
                {
                    data = db.TEAM.ToList();

                    //關鍵字搜尋
                    if (!string.IsNullOrEmpty(filterModel.QueryString))
                    {
                        this.ListFilter(filterModel.QueryString, ref data);
                    }

                    if (filterModel.CityID.HasValue)
                    {
                        this.ListFilterCity(filterModel.CityID.Value, ref data);
                    }

                    if (filterModel.AreaID.HasValue)
                    {
                        this.ListFilterArea(filterModel.AreaID.Value, ref data);
                    }

                    //發佈日期搜尋
                    //if (!string.IsNullOrEmpty(filterModel.PublishDate))
                    //{
                    //    this.ListDateFilter(filterModel.PublishDate, ref data);
                    //}

                    //前台顯示
                    //if (!string.IsNullOrEmpty(filterModel.Disable))
                    //{
                    //    this.ListStatusFilter(filterModel.Disable, "Display", ref data);
                    //}

                    //上下架
                    //if (!string.IsNullOrEmpty(filterModel.Disable))
                    //{
                    //    this.ListStatusFilter(filterModel.Disable, "Disable", ref data);
                    //}

                    //排序
                    this.ListSort(filterModel.SortColumn, ref data);
                    PaginationResult pagination;
                    //分頁
                    this.ListPageList(filterModel.CurrentPage, ref data, out pagination, filterModel.DoPagination);
                    result.Pagination = pagination;
                    foreach (var d in data)
                    {
                        PublicMethodRepository.HtmlDecode(d);
                    }

                    result.Data = data;
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }

            return(result);
        }
Esempio n. 24
0
        public override object DoGetList(object filter)
        {
            ListResultBase result      = new ListResultBase();
            TFilter        filterModel = (filter as TFilter);

            PublicMethodRepository.FilterXss(filterModel);
            List <TData> data = new List <TData>();

            try
            {
                var enumerable = (IEnumerable <TData>)(typeof(REDOXDB).GetProperty(typeof(TData).Name).GetValue(DB, null));
                if (PublicMethodRepository.CurrentMode == SiteMode.FronEnd)
                {
                    data = enumerable.Where(s => !s.DISABLE).ToList();
                }
                else if (PublicMethodRepository.CurrentMode == SiteMode.Home)
                {
                    data = enumerable.Where(s => !s.DISABLE && s.HOME_PAGE_DISPLAY).ToList();
                }
                else
                {
                    data = enumerable.ToList();
                }


                //關鍵字搜尋
                if (!string.IsNullOrEmpty(filterModel.QueryString))
                {
                    data = this.DoListFilterStringQuery(filterModel.QueryString, data);
                }
                //PUB_DT_STR搜尋
                if (!string.IsNullOrEmpty(filterModel.PublishStartDate) && !string.IsNullOrEmpty(filterModel.PublishEndate))
                {
                    data = this.DoListDateFilter(Convert.ToDateTime(filterModel.PublishStartDate), Convert.ToDateTime(filterModel.PublishEndate), data);
                }

                //前台顯示
                if (!string.IsNullOrEmpty(filterModel.DisplayForFrontEnd))
                {
                    data = this.DoListStatusFilter(filterModel.DisplayForFrontEnd, "F", data);
                }

                //SQ
                data = this.DoListSort(filterModel.SortColumn, filterModel.Status, data);

                //分頁
                //分頁
                bool isDoPage = PublicMethodRepository.CurrentMode == SiteMode.FronEnd ||
                                PublicMethodRepository.CurrentMode == SiteMode.Home ? false : true;
                data = this.DoListPageList(filterModel.CurrentPage, data, out PaginationResult pagination, isDoPage);
                result.Pagination = pagination;
                foreach (var d in data)
                {
                    PublicMethodRepository.HtmlDecode(d);
                }
                result.Data = data;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }