Beispiel #1
0
        /// <summary>
        /// 获取指定栏目前N条数据
        /// </summary>
        /// <param name="ColumnID"></param>
        /// <param name="TopNum"></param>
        /// <returns></returns>
        public List <Article_S> GetTopArticleByColumnID(string ColumnID, int TopNum)
        {
            using (var factory = new BaseAccess())
            {
                var      list = new List <Article_S>();
                PageInfo pi   = new PageInfo();
                var      spec = Specification <ArticleEntity> .Create(c => true);

                spec &= Specification <ArticleEntity> .Create(c => c.C_STATUS == ((int)RecordStatus.Enable).ToString());

                spec &= Specification <ArticleEntity> .Create(c => c.C_VERIFY_STATUS == ((int)EMARTICLESTATUS.二级审核).ToString());

                if (ColumnID == "999")
                {
                    spec &= Specification <ArticleEntity> .Create(c => c.DT_ADD_TIME >= DateTime.Now.AddDays(-7));

                    List <Orderby <ArticleEntity> > orders = new List <Orderby <ArticleEntity> >()
                    {
                        new Orderby <ArticleEntity>(c => c.N_HITS, SortOrder.Descending),
                        new Orderby <ArticleEntity>(c => c.DT_ADD_TIME, SortOrder.Descending)
                    };
                    pi.PageSize  = TopNum;
                    pi.PageIndex = 1;
                    list         = factory.GetPage(pi, spec, orders).Adapter <ArticleEntity, Article_S>(new List <Article_S>());
                    list.ForEach(c => c.B_HOTPOINTS = true);
                }
                else
                {
                    List <Orderby <ArticleEntity> > orders = new List <Orderby <ArticleEntity> >()
                    {
                        new Orderby <ArticleEntity>(c => c.C_RECOMMEND_LEVEL, SortOrder.Descending),//强烈推荐
                        new Orderby <ArticleEntity>(c => c.DT_ADD_TIME, SortOrder.Descending)
                    };
                    spec &= Specification <ArticleEntity> .Create(c => c.N_COLUMN_ID.Contains(ColumnID));

                    if (TopNum != 0)
                    {
                        pi.PageSize  = TopNum;
                        pi.PageIndex = 1;
                        list         = factory.GetPage <ArticleEntity>(pi, spec, orders).Adapter <ArticleEntity, Article_S>(new List <Article_S>());
                    }
                    else
                    {
                        list = factory.GetAll <ArticleEntity>(spec, orders).Adapter <ArticleEntity, Article_S>(new List <Article_S>());
                    }
                    list.ForEach(c => c.B_HOTPOINTS = false);
                }
                return(list);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 分页获取专题列表
        /// </summary>
        /// <param name="model"></param>
        /// <param name="pi"></param>
        /// <returns></returns>
        public Event_S GetEventStatusOn()
        {
            using (var factory = new BaseAccess())
            {
                List <Orderby <EventEntity> > orders = new List <Orderby <EventEntity> >()
                {
                    new Orderby <EventEntity>(c => c.DT_OP_TIME, SortOrder.Descending)
                };

                var spec = Specification <EventEntity> .Create(c => c.C_STATUS == ((int)EMSTATUS.在用).ToString());

                var pi = new PageInfo();
                pi.PageIndex = 1;
                pi.PageSize  = 1;
                var list = factory.GetPage <EventEntity>(pi, spec, orders)
                           .Adapter <EventEntity, Event_S>(new List <Event_S>());
                if (list.Count > 0)
                {
                    return(list[0]);
                }
                else
                {
                    return(new Event_S());
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// 获取栏目集合前N条数据
        /// 图片信息获取强烈推荐
        /// </summary>
        /// <param name="ColumnID"></param>
        /// <param name="TopNum"></param>
        /// <returns></returns>
        public List <Article_S> GetImageArticles(string ColumnIDs, int nCount)
        {
            using (var factory = new BaseAccess())
            {
                var listAll = new List <Article_S>();
                List <Orderby <ArticleEntity> > orders = new List <Orderby <ArticleEntity> >()
                {
                    new Orderby <ArticleEntity>(c => c.C_RECOMMEND_LEVEL, SortOrder.Descending),//强烈推荐
                    new Orderby <ArticleEntity>(c => c.DT_ADD_TIME, SortOrder.Descending)
                };
                var spec = Specification <ArticleEntity> .Create(c => c.B_IMG_NEWS == true);//是图片新闻

                spec &= Specification <ArticleEntity> .Create(c => c.C_STATUS == ((int)RecordStatus.Enable).ToString());

                if (!string.IsNullOrEmpty(ColumnIDs))
                {
                    spec = Specification <ArticleEntity> .Create(c => c.B_IMG_NEWS == true && ("," + ColumnIDs + ",").Contains(("," + c.N_COLUMN_ID + ",")));//防止104将10的情况搜索出来
                }
                PageInfo pi = new PageInfo();
                pi.PageSize  = nCount;
                pi.PageIndex = 1;
                List <ArticleEntity> list = new List <ArticleEntity>();
                if (pi.PageSize == 0)
                {
                    list = factory.GetAll <ArticleEntity>(spec, orders);
                }
                else
                {
                    list = factory.GetPage <ArticleEntity>(pi, spec, orders);
                }
                return(list.Adapter <ArticleEntity, Article_S>(new List <Article_S>()));
            }
        }
Beispiel #4
0
        /// <summary>
        /// 分页获取开放鉴定文章
        /// </summary>
        /// <returns></returns>
        public List <Article_S> GetArticlesVerifyPaged(Article_S model, PageInfo pi)
        {
            using (var factory = new BaseAccess())
            {
                List <Orderby <ArticleEntity> > orders = new List <Orderby <ArticleEntity> >()
                {
                    new Orderby <ArticleEntity>(c => c.DT_ADD_TIME, SortOrder.Descending)
                };
                var spec = Specification <ArticleEntity> .Create(c => true);

                if (!string.IsNullOrEmpty(model.C_STATUS))
                {
                    spec &= Specification <ArticleEntity> .Create(c => c.C_STATUS == model.C_STATUS);
                }
                if (!string.IsNullOrEmpty(model.C_VERIFY_STATUS))
                {
                    spec &= Specification <ArticleEntity> .Create(c => c.C_VERIFY_STATUS == model.C_VERIFY_STATUS);
                }
                if (!string.IsNullOrEmpty(model.N_COLUMN_ID))
                {
                    spec &= Specification <ArticleEntity> .Create(c => c.N_COLUMN_ID.Contains(model.N_COLUMN_ID));
                }
                else if (!string.IsNullOrEmpty(model.VC_KEYWORDS))
                {
                    spec &= (Specification <ArticleEntity> .Create(c => c.VC_KEYWORDS.Contains(model.VC_KEYWORDS)) || Specification <ArticleEntity> .Create(c => c.VC_TITLE.Contains(model.VC_KEYWORDS)) || Specification <ArticleEntity> .Create(c => c.VC_CONTENT.Contains(model.VC_KEYWORDS)));
                }
                if (!string.IsNullOrEmpty(model.VC_TITLE))
                {
                    spec &= Specification <ArticleEntity> .Create(c => c.VC_TITLE.Contains(model.VC_TITLE));
                }
                var list = factory.GetPage <ArticleEntity>(pi, spec, orders);
                List <Article_S> modellist = new List <Article_S>();
                foreach (var item in list)
                {
                    if (item.N_COLUMN_ID == "0")
                    {
                        continue;
                    }
                    var modelitem = item.Adapter <Article_S>(new Article_S());
                    var column    = factory.GetSingle <MenuEntity>(Specification <MenuEntity> .Create(m => m.MenuCode == item.N_COLUMN_ID));
                    if (column != null)
                    {
                        modelitem.VC_COLUMN_NAME = column.MenuName;
                    }
                    modelitem.VC_ADD_OP_NAME    = item.OPADD == null ? "未知" : item.OPADD.UserDisplayName;
                    modelitem.VC_UPDATE_OP_NAME = item.OPUPDATE == null ? "未知" : item.OPUPDATE.UserDisplayName;
                    modelitem.VC_RECOMMEND_NAME = Enum.GetName(typeof(EMRECOMMENDLEVEL), (item.C_RECOMMEND_LEVEL).Convert <int>(1));
                    modelitem.B_HOTPOINTS       = false;
                    modellist.Add(modelitem);
                }
                return(modellist);
            }
        }
Beispiel #5
0
        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <param name="Role"></param>
        /// <param name="pi"></param>
        /// <returns></returns>
        public List <Role_S> GetRolePaged(Role_S Role, PageInfo pi)
        {
            using (var factory = new BaseAccess())
            {
                var spec = Specification <RoleEntity> .Create(c => true);

                if (!string.IsNullOrEmpty(Role.RoleName))
                {
                    spec &= Specification <RoleEntity> .Create(c => c.RoleName.Contains(Role.RoleName));
                }

                var list = factory.GetPage <RoleEntity>(pi, spec, c => c.RoleName, SortOrder.Ascending);
                return((list ?? new List <RoleEntity>()).Adapter <RoleEntity, Role_S>(new List <Role_S>()));
            }
        }
Beispiel #6
0
        /// <summary>
        /// 分页获取专题明细列表
        /// </summary>
        /// <param name="model"></param>
        /// <param name="pi"></param>
        /// <returns></returns>
        public List <ArticleApply_S> GetArticleApplyListPaged(ArticleApply_S model, PageInfo pi)
        {
            using (var factory = new BaseAccess())
            {
                List <Orderby <ArticleApplyEntity> > orders = new List <Orderby <ArticleApplyEntity> >()
                {
                    new Orderby <ArticleApplyEntity>(c => c.DT_APPLY_TIME, SortOrder.Descending)
                };

                var spec = Specification <ArticleApplyEntity> .Create(c => true);

                if (!string.IsNullOrWhiteSpace(model.VC_ARTICLE_NAME))
                {
                    var ArticleIDs = factory.GetAll <ArticleEntity>(Specification <ArticleEntity> .Create(c => c.VC_TITLE.Contains(model.VC_ARTICLE_NAME))).Select(c => c.ID).ToList().ToArray();
                    spec &= Specification <ArticleApplyEntity> .Create(c => ArticleIDs.Contains(c.ID));
                }
                if (!string.IsNullOrWhiteSpace(model.C_CHECK_STATUS))
                {
                    spec &= Specification <ArticleApplyEntity> .Create(c => c.C_CHECK_STATUS == model.C_CHECK_STATUS);
                }
                if (!string.IsNullOrWhiteSpace(model.VC_APPLYER_NAME))
                {
                    spec &= Specification <ArticleApplyEntity> .Create(c => c.VC_APPLYER_NAME.Contains(model.VC_APPLYER_NAME));
                }
                if (model.N_START_DATE != null)
                {
                    spec &= (Specification <ArticleApplyEntity> .Create(c => c.DT_APPLY_TIME >= model.N_START_DATE));
                }
                if (model.N_END_DATE != null)
                {
                    spec &= (Specification <ArticleApplyEntity> .Create(c => c.DT_APPLY_TIME <= model.N_END_DATE));
                }
                var list = factory.GetPage <ArticleApplyEntity>(pi, spec, orders)
                           .Adapter <ArticleApplyEntity, ArticleApply_S>(new List <ArticleApply_S>());
                foreach (var item in list)
                {
                    // item.VC_ARTICLE_NAME = factory.GetSingle<ArticleEntity>(item.N_ARTICLE_ID).VC_TITLE;
                    item.VC_ARTICLE_NAME = factory.GetSingle <ArticleEntity>(item.N_ARTICLE_ID) == null ? "未知" : factory.GetSingle <ArticleEntity>(item.N_ARTICLE_ID).VC_TITLE;
                    if (!string.IsNullOrWhiteSpace(item.VC_CHECKER_ID))
                    {
                        var checker = factory.GetSingle <SYS_UserEntity>(item.VC_CHECKER_ID);
                        item.VC_CHECKER_NAME = checker == null ? "" : checker.UserDisplayName;
                    }
                }
                return(list);
            }
        }
Beispiel #7
0
        /// <summary>
        /// 获取用户分页数据
        /// </summary>
        /// <param name="user"></param>
        /// <param name="pi"></param>
        /// <returns></returns>
        public List <User_S> GetUserPaged(User_S user, PageInfo pi)
        {
            using (var factory = new BaseAccess(base._DBConfigPath))
            {
                var spec = Specification <UserEntity> .Create(c => c.UserType != (int)UserType.Administrators);

                if (!string.IsNullOrEmpty(user.UserDisplayName))
                {
                    spec &= Specification <UserEntity> .Create(c => c.UserDisplayName.Contains(user.UserDisplayName));
                }
                if (!string.IsNullOrEmpty(user.UserLoginName))
                {
                    spec &= Specification <UserEntity> .Create(c => c.UserLoginName.Contains(user.UserLoginName));
                }

                var list = factory.GetPage <UserEntity>(pi, spec, c => c.UserDisplayName, SortOrder.Ascending);
                return((list ?? new List <UserEntity>()).Adapter <UserEntity, User_S>(new List <User_S>()));
            }
        }
        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <param name="Role"></param>
        /// <param name="pi"></param>
        /// <returns></returns>
        public List <AppRegister_S> GetRolePaged(AppRegister_S app, PageInfo pi)
        {
            using (var factory = new BaseAccess(base._DBConfigPath))
            {
                var spec = Specification <SYS_AppRegisterEntity> .Create(c => true);

                if (!string.IsNullOrEmpty(app.AppName))
                {
                    spec &= Specification <SYS_AppRegisterEntity> .Create(c => c.AppName.Contains(app.AppName));
                }
                if (!string.IsNullOrEmpty(app.AppRegisterID))
                {
                    spec &= Specification <SYS_AppRegisterEntity> .Create(c => c.AppRegisterID.Contains(app.AppRegisterID));
                }

                var list = factory.GetPage <SYS_AppRegisterEntity>(pi, spec, c => c.OrderNum, SortOrder.Ascending);
                return((list ?? new List <SYS_AppRegisterEntity>()).Adapter <SYS_AppRegisterEntity, AppRegister_S>(new List <AppRegister_S>()));
            }
        }
Beispiel #9
0
        /// <summary>
        /// 分页获取专题列表
        /// </summary>
        /// <param name="model"></param>
        /// <param name="pi"></param>
        /// <returns></returns>
        public Event_S GetLatestEvent()
        {
            using (var factory = new BaseAccess())
            {
                List <Orderby <EventEntity> > orders = new List <Orderby <EventEntity> >()
                {
                    new Orderby <EventEntity>(c => c.DT_OP_TIME, SortOrder.Descending)
                };

                var spec = Specification <EventEntity> .Create(c => true);

                var pi = new PageInfo();
                pi.PageIndex = 1;
                pi.PageSize  = 1;
                var list = factory.GetPage <EventEntity>(pi, spec, orders)
                           .Adapter <EventEntity, Event_S>(new List <Event_S>());
                return(list[0]);
            }
        }
Beispiel #10
0
        /// <summary>
        /// 分页获取文章
        /// </summary>
        /// <returns></returns>
        public List <EmailRecord_S> GetEmailListPaged(EmailRecord_S model, PageInfo pi)
        {
            using (var factory = new BaseAccess())
            {
                List <Orderby <EmailRecordEntity> > orders = new List <Orderby <EmailRecordEntity> >()
                {
                    new Orderby <EmailRecordEntity>(c => c.DT_TIME, SortOrder.Descending)
                };
                var spec = Specification <EmailRecordEntity> .Create(c => true);

                spec &= Specification <EmailRecordEntity> .Create(c => c.VC_CONTENT != "");

                if (!string.IsNullOrEmpty(model.C_STATUS))
                {
                    spec &= Specification <EmailRecordEntity> .Create(c => c.C_STATUS == model.C_STATUS);
                }
                if (!string.IsNullOrEmpty(model.C_EMAIL_TYPE))
                {
                    spec &= Specification <EmailRecordEntity> .Create(c => c.C_EMAIL_TYPE == model.C_EMAIL_TYPE);
                }
                if (!string.IsNullOrEmpty(model.VC_CONTENT))
                {
                    spec &= Specification <EmailRecordEntity> .Create(c => c.VC_CONTENT.Contains(model.VC_CONTENT));
                }
                if (!string.IsNullOrEmpty(model.VC_NAME))
                {
                    spec &= (Specification <EmailRecordEntity> .Create(c => c.VC_NAME.Contains(model.VC_NAME)));
                }
                if (model.N_START_DATE != null)
                {
                    spec &= (Specification <EmailRecordEntity> .Create(c => c.DT_TIME >= model.N_START_DATE));
                }
                if (model.N_END_DATE != null)
                {
                    spec &= (Specification <EmailRecordEntity> .Create(c => c.DT_TIME <= model.N_END_DATE));
                }

                var list = factory.GetPage <EmailRecordEntity>(pi, spec, orders).Adapter <EmailRecordEntity, EmailRecord_S>(new List <EmailRecord_S>());

                return(list);
            }
        }
Beispiel #11
0
        /// <summary>
        /// 分页获取专题列表
        /// </summary>
        /// <param name="model"></param>
        /// <param name="pi"></param>
        /// <returns></returns>
        public List <Event_S> GetEventListPaged(Event_S model, PageInfo pi)
        {
            using (var factory = new BaseAccess())
            {
                List <Orderby <EventEntity> > orders = new List <Orderby <EventEntity> >()
                {
                    new Orderby <EventEntity>(c => c.DT_OP_TIME, SortOrder.Descending)
                };

                var spec = Specification <EventEntity> .Create(c => true);

                if (!string.IsNullOrWhiteSpace(model.VC_TITLE))
                {
                    spec &= Specification <EventEntity> .Create(c => c.VC_TITLE.Contains(model.VC_TITLE));
                }
                var list = factory.GetPage <EventEntity>(pi, spec, orders)
                           .Adapter <EventEntity, Event_S>(new List <Event_S>());
                return(list);
            }
        }