Esempio n. 1
0
        private void GetXMList()
        {
            FromSection <Activity> fromsection = DbSession.Default.From <Activity>()
                                                 .Where(s => s.Status.Equals(0) && s.Type.Equals(10));
            var           list     = fromsection.Page(10, 1).ToList();
            List <object> listDesc = new List <object>();

            if (list.Count > 0)
            {
                foreach (var item in list)
                {
                    listDesc.Add(new
                    {
                        id  = item.ID,
                        sjd = item.Title,
                        gj  = item.Entitle,
                        img = item.Conver,
                        sb  = item.Extend
                    });
                }
                string jsonstrlist = JsonHelper.GetJsonString(new jsonResult {
                    code = "succ", result = listDesc, count = list.Count
                });
                _ct.Response.Write(jsonstrlist);
            }
            else
            {
                string jsonstrlist = JsonHelper.GetJsonString(new jsonResult {
                    code = "error", result = "", count = 0
                });
                _ct.Response.Write(jsonstrlist);
            }
        }
Esempio n. 2
0
        private void GetMyJc()
        {
            var topid1 = Common.CryptHelper.DESEncrypt.Decrypt(Dos.Common.CookieHelper.Get("curYHJCAes1"), WebConfigurationManager.AppSettings["PassWordKey"]);
            FromSection <HdPicHit> fromsection = DbSession.Default.From <HdPicHit>()
                                                 .Where(s => s.wxopenid.Equals(topid1) && s.extend1.Equals("115")).OrderBy(HdPicHit._.addtime.Desc);
            var           list     = fromsection.Page(30, 1).ToList();
            List <object> listDesc = new List <object>();

            if (list.Count > 0)
            {
                foreach (var item in list)
                {
                    listDesc.Add(new
                    {
                        id  = item.Id,
                        sjd = item.extend2,
                        jc  = item.name,
                        sy  = item.status
                    });
                }
                string jsonstrlist = JsonHelper.GetJsonString(new jsonResult {
                    code = "succ", result = listDesc, count = list.Count
                });
                _ct.Response.Write(jsonstrlist);
            }
            else
            {
                string jsonstrlist = JsonHelper.GetJsonString(new jsonResult {
                    code = "error", result = "", count = 0
                });
                _ct.Response.Write(jsonstrlist);
            }
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="nodecode"></param>
        /// <param name="isLike"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="recordCount"></param>
        /// <returns></returns>
        public DataTable GetList(long langId, string nodecode, bool isLike, int pageIndex, int pageSize, ref int recordCount)
        {
            WhereClipBuilder wcb = new WhereClipBuilder();

            wcb.And(cmsNews._.LangId == langId);
            if (!string.IsNullOrEmpty(nodecode))
            {
                if (!isLike)
                {
                    wcb.And(cmsNews._.NodeCode == nodecode);
                }
                else
                {
                    wcb.And(cmsNews._.NodeCode.BeginWith(nodecode));
                }
            }
            wcb.And(cmsNews._.IsAudit == 1); // 已审核的

            FromSection fs = GetFromSection(wcb.ToWhereClip(), null)
                             .InnerJoin <cmsNewsCatalog>(cmsNewsCatalog._.NodeCode == cmsNews._.NodeCode)
                             .Select(cmsNews._.All, cmsNewsCatalog._.NodeName)
                             .OrderBy(cmsNews._.IsTop.Desc && cmsNews._.EditTime.Desc);

            recordCount = fs.Count();

            return(fs.Page(pageSize, pageIndex).ToDataTable());
        }
Esempio n. 4
0
        //private void SetZan(HttpContext context)
        //{
        //    try
        //    {
        //        int tmphid = 0;
        //        int.TryParse(context.Request.Form["tmpid"], out tmphid);
        //        string topid = context.Request.Form["tmpopenid"];

        //        var tmpopenid = Common.CryptHelper.DESEncrypt.Decrypt(topid, WebConfigurationManager.AppSettings["PassWordKey"]);
        //        int nums1 = 0;
        //        int ist = 0;
        //        DateTime t1 = DateTime.Now.Date;
        //        DateTime tm2 = DateTime.Now.AddDays(1).Date;
        //        DateTime t2 = Convert.ToDateTime(WebConfigurationManager.AppSettings["endtime12"]);
        //        DateTime t3 = t2.AddDays(1);

        //        var userInfo = UserApi.Info(AccessTokenContainer.TryGetToken(WebConfigurationManager.AppSettings["wxappid1"], WebConfigurationManager.AppSettings["wxsecret1"]), tmpopenid);
        //        if (string.IsNullOrEmpty(_ct.Request.UserAgent) || (!_ct.Request.UserAgent.Contains("MicroMessenger") && !_ct.Request.UserAgent.Contains("Windows Phone")))
        //        {
        //            context.Response.Write("{\"ismsgs\":\"0\",\"ist\":\"" + 2 + "\"}");
        //        }
        //        else
        //        {

        //            if (DateTime.Compare(t1, t2) < 0)
        //            {
        //                if (tmphid > 0)
        //                {
        //                    int idnum = 0;
        //                    using (WXDBEntities db = new WXDBEntities())
        //                    {
        //                        //var ctcount = db.HdPicHit.Where(s => s.wxopenid.Equals(tmpopenid) && s.addtime > t1 && s.addtime < tm2).Count();
        //                        //if (ctcount >= 3)
        //                        //{
        //                        //    context.Response.Write("{\"ismsgs\":\"0\",\"ist\":\"" + 2 + "\"}");
        //                        //}
        //                        //else
        //                        //{
        //                        //var tmpdel = db.HdPicHit.Where(s => s.wxopenid.Equals(tmpopenid) && s.hdpicid.Equals(tmphid) && s.addtime > t1 && s.addtime < tm2).FirstOrDefault();
        //                        var tmpdel = db.HdPicHit.Where(s => s.wxopenid.Equals(tmpopenid) && s.extend1.Equals("108")).FirstOrDefault();
        //                        if (tmpdel != null)
        //                        {
        //                            context.Response.Write("{\"ismsgs\":\"0\",\"ist\":\"" + 5 + "\"}");
        //                        }
        //                        else
        //                        {
        //                            HdPicHit model = new HdPicHit();
        //                            model.addtime = DateTime.Now;
        //                            model.updatetime = DateTime.Now;
        //                            model.extend1 = "108";
        //                            model.extend2 = "";
        //                            model.orders = 0;
        //                            model.status = 0;
        //                            model.wxopenid = tmpopenid;
        //                            model.name = "";
        //                            model.hdpicid = tmphid;
        //                            db.HdPicHit.AddObject(model);
        //                            db.SaveChanges();
        //                            HdPic tmodel = db.HdPic.Where(s => s.Id == tmphid).FirstOrDefault();
        //                            if (tmodel != null)
        //                            {
        //                                nums1 = tmodel.Orders + 1;
        //                                SqlParameter[] para = new SqlParameter[] {
        //                                    new SqlParameter("@Id",tmodel.Id),
        //                                    new SqlParameter("@Orders",tmodel.Orders+1),
        //                                    new SqlParameter("@UpdateTime",DateTime.Now)
        //                                    };
        //                                var ct = db.ExecuteStoreCommand(" update HdPic set Orders=@Orders, UpdateTime=@UpdateTime  where Id=@Id", para);
        //                            }
        //                            else
        //                            {
        //                                nums1 = 0;
        //                            }
        //                            ist = 1;
        //                            context.Response.Write("{\"ismsgs\":\"" + nums1 + "\",\"ist\":\"" + 1 + "\"}");
        //                            //}
        //                        }
        //                    }
        //                }
        //                else
        //                {
        //                    context.Response.Write("{\"ismsgs\":\"0\",\"ist\":\"" + 0 + "\"}");
        //                }
        //            }
        //            else
        //            {
        //                context.Response.Write("{\"ismsgs\":\"0\",\"ist\":\"" + 3 + "\"}");
        //            }
        //        }

        //    }
        //    catch (Exception)
        //    {
        //        context.Response.Write("{\"ismsgs\":\"0\",\"ist\":\"" + 4 + "\"}");
        //    }
        //}
        protected void GetImgList()
        {
            int page     = 0;
            int pagesize = 8;

            int.TryParse(_ct.Request.Form["tmppage"], out page);
            if (page < 1)
            {
                page = 0;
            }
            int.TryParse(_ct.Request.Form["pagesize"], out pagesize);

            using (WXDBEntities db = new WXDBEntities())
            {
                int skipsize = page * pagesize;
                int tmpage   = page + 1;
                //var list = new List<HdPic>();
                //////.OrderByDescending(s => s.Orders).
                //list = db.HdPic.Where(s => s.Status == 0 && s.Extend2.Equals("108")).OrderByDescending(s => s.Orders).ThenBy(s => s.UpdateTime).Skip(skipsize).Take(pagesize).ToList();
                FromSection <Dos.Model.HdPic> fromsection = DbSession.Default.From <Dos.Model.HdPic>()
                                                            .Where(s => s.Extend2.Equals("108"))
                                                            .OrderBy(Dos.Model.HdPic._.Orders.Desc, Dos.Model.HdPic._.UpdateTime.Asc);
                var list = fromsection.Page(pagesize, tmpage).ToList();
                //DbSession.Default.FromSql("select row from (select row_number() over (order by orders desc,updatetime asc) row,extend1 from hdpic where Extend2='108') newtable where extend1=@extend1").AddInParameter("@extend1", DbType.String, "321").ToScalar();
                //SqlSection str = new SqlSection();
                //str.(DbSession)
                //IQueryable<HdPic> list = db.HdPic.OrderByDescending(s => s.Orders).ThenBy(s => s.UpdateTime).Where(s => s.Extend2.Equals("108"));
                //var dblist = list.ToPagedList(tmpage, pagesize);

                List <object> listDesc = new List <object>();
                if (list.Count > 0)
                {
                    foreach (var item in list)
                    {
                        listDesc.Add(new
                        {
                            id    = item.Id,
                            name  = item.Name,
                            nums  = item.Orders,
                            tcont = item.PicUrl
                        });
                    }
                    string jsonstrlist = JsonHelper.GetJsonString(new jsonResult {
                        code = "succ", result = listDesc, count = list.Count
                    });
                    _ct.Response.Write(jsonstrlist);
                }
                else
                {
                    string jsonstrlist = JsonHelper.GetJsonString(new jsonResult {
                        code = "error", result = "", count = 0
                    });
                    _ct.Response.Write(jsonstrlist);
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="langId"></param>
        /// <param name="keyword">搜索关键字</param>
        /// <param name="type">搜索类别:0-按标题搜,1-按内容搜,2-按标题或内容搜</param>
        /// <param name="nodecode">如果为空,则全局搜;不为空,则在本类下搜</param>
        /// <param name="isLike">是否搜索子类</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize"></param>
        /// <param name="recordCount"></param>
        /// <returns></returns>
        public DataTable Search(int langId, string keyword, int type, string nodecode, bool isLike, int pageIndex, int pageSize, ref int recordCount)
        {
            WhereClipBuilder wcb = new WhereClipBuilder();

            if (!string.IsNullOrEmpty(nodecode) && nodecode != "0000")
            {
                if (!isLike)
                {
                    wcb.And(cmsNews._.NodeCode == nodecode);
                }
                else
                {
                    wcb.And(cmsNews._.NodeCode.BeginWith(nodecode));
                }
            }
            wcb.And(cmsNews._.IsAudit == 1); // 已审核的
            wcb.And(cmsNews._.IsIndex == 1); // 已推荐的

            if (!string.IsNullOrEmpty(keyword))
            {
                switch (type)
                {
                case -1:
                    break;

                case 0:
                    wcb.And(cmsNews._.Title.Contain(keyword));
                    break;

                case 1:
                    wcb.And(cmsNews._.Content.Contain(keyword));
                    break;

                case 2:
                    wcb.And(cmsNews._.Title.Contain(keyword) || cmsNews._.Content.Contain(keyword));
                    break;
                }
            }

            if (langId > 0)
            {
                wcb.And(cmsNewsCatalog._.LangId == langId);
            }
            FromSection fs = GetFromSection(null, null)
                             .InnerJoin <cmsNewsCatalog>(cmsNewsCatalog._.NodeCode == cmsNews._.NodeCode)
                             .Select(cmsNews._.All, cmsNewsCatalog._.NodeName)
                             .Where(wcb.ToWhereClip())
                             .OrderBy(cmsNews._.IsTop.Desc && cmsNews._.EditTime.Desc);

            recordCount = fs.Count();

            return(fs
                   .Page(pageSize, pageIndex)
                   .ToDataTable());
        }
Esempio n. 6
0
        /// <summary>
        /// 获取图片列表
        /// </summary>
        /// <param name="context"></param>
        protected void GetImgList()
        {
            int page     = 0;
            int pagesize = 8;

            int.TryParse(_ct.Request.Form["tmppage"], out page);
            if (page < 1)
            {
                page = 0;
            }
            int.TryParse(_ct.Request.Form["pagesize"], out pagesize);

            using (WXDBEntities db = new WXDBEntities())
            {
                int skipsize = page * pagesize;

                int tmpage = page + 1;
                //var list = db.HdPic.Where(s => s.Status == 0 && s.Extend2.Equals("107")).OrderBy(s => s.AddTime).Skip(skipsize).Take(pagesize).ToList();
                FromSection <Dos.Model.HdPic> fromsection = DbSession.Default.From <Dos.Model.HdPic>()
                                                            .Where(s => s.Extend2.Equals("107"));
                var list = fromsection.Page(pagesize, tmpage).ToList();
                //IQueryable<HdPic> list = db.HdPic.Where(s => s.Status == 0 && s.Extend2.Equals("107")).OrderBy(s => s.AddTime);
                //var dblist = list.ToPagedList(tmpage, pagesize);
                //.OrderByDescending(s => s.Orders).
                //list = .Skip(skipsize).Take(pagesize).ToList();
                //int count = db.HdPic.Where(s => s.Status == 0 && s.Extend2.Equals("107")).Count();
                List <object> listDesc = new List <object>();
                if (list.Count > 0)
                {
                    foreach (var item in list)
                    {
                        listDesc.Add(new
                        {
                            id     = item.Id,
                            name   = item.Name,
                            nums   = item.Orders,
                            imgurl = item.PicUrl,
                            ntnum  = item.Extend4
                        });
                    }
                    string jsonstrlist = JsonHelper.GetJsonString(new jsonResult {
                        code = "succ", result = listDesc, count = list.Count
                    });
                    _ct.Response.Write(jsonstrlist);
                }
                else
                {
                    string jsonstrlist = JsonHelper.GetJsonString(new jsonResult {
                        code = "error", result = "", count = 0
                    });
                    _ct.Response.Write(jsonstrlist);
                }
            }
        }
Esempio n. 7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="recordCount"></param>
        /// <returns></returns>
        public DataTable GetDataTable(int pageIndex, int pageSize, ref int recordCount)
        {
            FromSection fs = GetFromSection(null, null)
                             .LeftJoin <cmsLinkGroup>(cmsLinkGroup._.Id == cmsLink._.GroupId)
                             .Select(cmsLink._.All, cmsLinkGroup._.Name.As("TypeName"))
                             .OrderBy(cmsLink._.GroupId.Asc && cmsLink._.OrderNo.Asc && cmsLink._.Id.Desc);

            recordCount = fs.Count();

            return(fs
                   .Page(pageSize, pageIndex)
                   .ToDataTable());
        }
Esempio n. 8
0
        /// <summary>
        /// 得到案例列表信息
        /// </summary>
        private void GetALList()
        {
            int tyid = 0;

            int.TryParse(_ct.Request.Form["typid"], out tyid);
            int page     = 0;
            int pagesize = 8;

            int.TryParse(_ct.Request.Form["tmppage"], out page);
            if (page < 1)
            {
                page = 0;
            }
            int.TryParse(_ct.Request.Form["pagesize"], out pagesize);
            int skipsize = page * pagesize;
            int tmpage   = page + 1;
            FromSection <Forms> fromsection = DbSession.Default.From <Forms>()
                                              .Where(s => !s.Status.Equals(2) && s.Type.Equals(tyid))
                                              .OrderBy(s => s.Orders).OrderByDescending(s => s.AddTime);
            var           list     = fromsection.Page(pagesize, tmpage).ToList();
            List <object> listDesc = new List <object>();

            if (list.Count > 0)
            {
                foreach (var item in list)
                {
                    listDesc.Add(new
                    {
                        id    = item.Id,
                        img   = globalVariables.NewsImgServer + item.Income,
                        title = item.Title,
                        desc  = item.Remark,
                        url   = item.Source
                    });
                }
                string jsonstrlist = JsonHelper.GetJsonString(new jsonResult {
                    code = "succ", result = listDesc, count = list.Count
                });
                _ct.Response.Write(jsonstrlist);
            }
            else
            {
                string jsonstrlist = JsonHelper.GetJsonString(new jsonResult {
                    code = "error", result = "", count = 0
                });
                _ct.Response.Write(jsonstrlist);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 读取列表
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="query"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="isOrderBy"></param>
        /// <returns></returns>
        public static async Task <Page <T> > ToPageAsync <T>(this FromSection <T> query,
                                                             int pageIndex,
                                                             int pageSize,
                                                             bool isOrderBy = false) where T : Dos.ORM.Entity
        {
            var page       = new Page <T>();
            var totalItems = query.Count();
            var totalPages = totalItems != 0 ? (totalItems % pageSize) == 0 ? (totalItems / pageSize) : (totalItems / pageSize) + 1 : 0;

            page.CurrentPage  = pageIndex;
            page.ItemsPerPage = pageSize;
            page.TotalItems   = totalItems;
            page.TotalPages   = totalPages;
            page.Items        = totalItems == 0 ? null : query.Page(pageSize, pageIndex).ToList();
            return(page);
        }
Esempio n. 10
0
        private void GetYHlist()
        {
            int page     = 0;
            int pagesize = 15;

            int.TryParse(_ct.Request.Form["tmppage"], out page);
            if (page < 1)
            {
                page = 0;
            }
            int.TryParse(_ct.Request.Form["pagesize"], out pagesize);
            int skipsize = page * pagesize;
            int tmpage   = page + 1;
            FromSection <Dos.Model.HdPic> fromsection = DbSession.Default.From <Dos.Model.HdPic>()
                                                        .Where(s => s.Extend2.Equals("115"))
                                                        .OrderBy(HdPic._.Orders.Desc, HdPic._.UpdateTime.Asc);
            var           list     = fromsection.Page(pagesize, tmpage).ToList();
            List <object> listDesc = new List <object>();

            if (list.Count > 0)
            {
                foreach (var item in list)
                {
                    listDesc.Add(new
                    {
                        id       = item.Id,
                        img      = item.PicUrl,
                        nickname = item.Name,
                        nums     = item.Orders
                    });
                }
                string jsonstrlist = JsonHelper.GetJsonString(new jsonResult {
                    code = "succ", result = listDesc, count = list.Count
                });
                _ct.Response.Write(jsonstrlist);
            }
            else
            {
                string jsonstrlist = JsonHelper.GetJsonString(new jsonResult {
                    code = "error", result = "", count = 0
                });
                _ct.Response.Write(jsonstrlist);
            }
        }
Esempio n. 11
0
        /// <summary>
        /// 根据模块类别获取列表
        /// </summary>
        /// <param name="type"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="recordCount"></param>
        /// <returns></returns>
        public DataTable GetListByType(long langId, string type, int pageIndex, int pageSize, ref int recordCount)
        {
            string[] types = type.Split('|');

            WhereClipBuilder wcb = new WhereClipBuilder();

            wcb.And(cmsNewsCatalog._.LangId == langId);
            if (types.Length > 0)
            {
                wcb.And(cmsNewsCatalog._.NodeType.SelectIn(types));
            }
            FromSection fs = GetFromSection(wcb.ToWhereClip(), null)
                             .InnerJoin <cmsNewsCatalog>(cmsNewsCatalog._.NodeCode == cmsNews._.NodeCode)
                             .Select(cmsNews._.All, cmsNewsCatalog._.NodeName)
                             .OrderBy(cmsNews._.IsTop.Desc && cmsNews._.EditTime.Desc);

            recordCount = fs.Count();

            return(fs.Page(pageSize, pageIndex).ToDataTable());
        }
Esempio n. 12
0
        /// <summary>
        /// 提取某专题下的分页文章
        /// </summary>
        /// <param name="ztId"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <param name="recordCount"></param>
        /// <returns></returns>
        public DataTable GetZtNewsList(int ztId, int pageSize, int pageIndex, ref int recordCount)
        {
            WhereClipBuilder wcb = new WhereClipBuilder();

            if (ztId > 0)
            {
                wcb.And(cmsNewsTopicRel._.TopicId == ztId);
            }
            wcb.And(cmsNews._.IsAudit == 1); // 已审核的
            wcb.And(cmsNews._.IsIndex == 1); // 已推荐的

            FromSection fs = GetFromSection(null, null)
                             .InnerJoin <cmsNewsCatalog>(cmsNewsCatalog._.NodeCode == cmsNews._.NodeCode)
                             .InnerJoin <cmsNewsTopicRel>(cmsNews._.Id == cmsNewsTopicRel._.NewsId)
                             .Select(cmsNews._.All, cmsNewsCatalog._.NodeName)
                             .Where(wcb.ToWhereClip())
                             .OrderBy(cmsNews._.EditTime.Desc);

            recordCount = fs.Count();

            return(fs.Page(pageSize, pageIndex).ToDataTable());
        }
        /// <summary>
        /// 使用linq查询(分页)
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <typeparam name="OutEntity"></typeparam>
        /// <param name="linq"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <param name="lambdaOrderBy"></param>
        /// <returns></returns>
        public PageResponse <OutEntity> getListByPaging <TEntity, OutEntity>(FromSection <TEntity> linq, int pageSize, int pageIndex, Expression <Func <TEntity, object> > lambdaOrderBy = null) where TEntity : Entity
        {
            if (pageIndex <= 0)
            {
                pageIndex = 1;
            }
            if (pageSize <= 0)
            {
                pageSize = 10;
            }
            PageResponse <OutEntity> result = new PageResponse <OutEntity>();

            result.totalItems = linq.Count();
            List <OutEntity> sqlList = new List <OutEntity>();

            if (lambdaOrderBy != null)
            {
                sqlList = linq.OrderBy(lambdaOrderBy).Page(pageSize, pageIndex).ToList <OutEntity>();
            }
            else
            {
                sqlList = linq.Page(pageSize, pageIndex).ToList <OutEntity>();
            }

            if (sqlList == null || sqlList.Count == 0)
            {
                return(null);
            }
            result.items        = sqlList;
            result.currentPage  = pageIndex;
            result.itemsPerPage = pageSize;
            result.totalPages   = result.totalItems / pageSize;
            if ((result.totalItems % pageSize) != 0)
            {
                result.totalPages++;
            }
            return(result);
        }
        private void BindRepeater()
        {
            int page = AspNetPager1.CurrentPageIndex;

            if (!this.IsPostBack)
            {
                if (Request["page"] + "" != "")
                {
                    page = int.Parse(Request["page"] + "");
                }
            }
            FromSection <Dos.Model.Manager_Groups> fromsection = DbSession.Default.From <Dos.Model.Manager_Groups>()
                                                                 .Where(s => s.Status.Equals(0))
                                                                 .OrderBy(s => s.AddTime).OrderByDescending(s => s.Id);

            //List<object> listDesc = new List<object>();
            //var  carlist = DbSession.Default.fr.Manager_Groups.Where(s => s.Status.Equals(0)).OrderBy(o => o.AddTime).ThenByDescending(o => o.Id);

            if (!string.IsNullOrEmpty(txtKeywords.Text.Trim()))
            {
                fromsection = fromsection.Where(s => s.Name.Contains(txtKeywords.Text));
            }
            //carlist.ToPagedList(page, AspNetPager1.PageSize);
            AspNetPager1.RecordCount = fromsection.Count();
            ltlCount.Text            = "<b>" + fromsection.Count() + "</b>";
            var dblist = fromsection.Page(AspNetPager1.PageSize, page).ToList();

            if (!this.IsPostBack)
            {
                if (Request["page"] + "" != "")
                {
                    int temp = int.Parse(Request["page"] + "");
                    AspNetPager1.CurrentPageIndex = temp;
                }
            }
            WebUtil.CtrlToList <Dos.Model.Manager_Groups>(rptLoop, dblist);
        }
        /// <summary>
        /// 使用linq查询(分页)
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <typeparam name="OutEnity"></typeparam>
        /// <param name="linq"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <param name="lambdaOrderBy"></param>
        /// <returns></returns>
        public ActionResult getListByPaging <TEntity, OutEnity>(FromSection <TEntity> linq, Pagination pagination, OrderByClip lambdaOrderBy = null) where TEntity : Entity
        {
            int             pageIndex = pagination.page;
            int             pageSize  = pagination.rows <= 0 ? 20 : pagination.rows;
            List <OutEnity> sqlList   = new List <OutEnity>();

            if (lambdaOrderBy != null)
            {
                sqlList = linq.OrderBy(lambdaOrderBy).Page(pageSize, pageIndex).ToList <OutEnity>();
            }
            else
            {
                sqlList = linq.Page(pageSize, pageIndex).ToList <OutEnity>();
            }
            int totalCount = linq.Count();

            return(Content(new
            {
                rows = sqlList,
                total = (totalCount / pageSize) + 1,
                page = pagination.page,
                records = totalCount
            }.ToJson()));
        }
Esempio n. 16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="nodecode"></param>
        /// <param name="title"></param>
        /// <param name="productNo"></param>
        /// <param name="productModel"></param>
        /// <param name="tags"></param>
        /// <param name="iIndex"></param>
        /// <param name="iTop"></param>
        /// <param name="iAudit"></param>
        /// <param name="dtAdd1"></param>
        /// <param name="dtAdd2"></param>
        /// <param name="dtEdit1"></param>
        /// <param name="dtEdit2"></param>
        /// <param name="userId"></param>
        /// <param name="isAdmin"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="recordCount"></param>
        /// <returns></returns>
        public DataTable GetProductsByFilter(
            string nodecode,
            string title,
            string productNo,
            string productModel,
            string tags,
            int iIndex,
            int iTop,
            int iAudit,
            string dtAdd1,
            string dtAdd2,
            string dtEdit1,
            string dtEdit2,
            long userId,
            bool isAdmin,
            int pageIndex,
            int pageSize,
            ref int recordCount
            )
        {
            WhereClipBuilder wcb = new WhereClipBuilder();

            if (!string.IsNullOrEmpty(nodecode))
            {
                wcb.And(cmsNews._.NodeCode == nodecode); // 当前栏目
            }
            if (!isAdmin)
            {
                wcb.And(cmsNews._.IsAudit < 3);
            }
            if (!string.IsNullOrEmpty(title.Trim()))
            {
                wcb.And(cmsNews._.Title.Contain(title.Trim()));
            }
            if (!string.IsNullOrEmpty(productNo.Trim()))
            {
                wcb.And(cmsNews._.ProductNo.Contain(productNo.Trim()));
            }
            if (!string.IsNullOrEmpty(productModel.Trim()))
            {
                wcb.And(cmsNews._.ProductModel.Contain(productModel.Trim()));
            }
            if (!string.IsNullOrEmpty(tags.Trim()))
            {
                wcb.And(cmsNews._.Tags.Contain(tags.Trim()));
            }
            if (iIndex >= 0)
            {
                wcb.And(cmsNews._.IsIndex == iIndex);
            }
            if (iTop >= 0)
            {
                wcb.And(cmsNews._.IsTop == iTop);
            }
            if (iAudit >= 0)
            {
                wcb.And(cmsNews._.IsAudit == iAudit);
            }
            if (!isAdmin && userId > 0)
            {
                wcb.And(cmsNews._.AddUser == userId);
            }
            DateTime dt;

            if (DateTime.TryParse(dtAdd1.Trim(), out dt))
            {
                wcb.And(cmsNews._.AddTime >= dt);
            }
            if (DateTime.TryParse(dtAdd2.Trim(), out dt))
            {
                wcb.And(cmsNews._.AddTime <= dt);
            }
            if (DateTime.TryParse(dtEdit1.Trim(), out dt))
            {
                wcb.And(cmsNews._.EditTime >= dt);
            }
            if (DateTime.TryParse(dtEdit2.Trim(), out dt))
            {
                wcb.And(cmsNews._.EditTime <= dt);
            }

            FromSection fs = GetFromSection(wcb.ToWhereClip(), cmsNews._.EditTime.Desc);

            recordCount = fs.Count();

            return(fs
                   .Page(pageSize, pageIndex)
                   .ToDataTable());
        }
Esempio n. 17
0
        /// <summary>
        /// 根据条件取得专题下所有文章
        /// </summary>
        /// <param name="nodecode"></param>
        /// <param name="title"></param>
        /// <param name="source"></param>
        /// <param name="author"></param>
        /// <param name="tags"></param>
        /// <param name="iIndex"></param>
        /// <param name="iTop"></param>
        /// <param name="iAudit"></param>
        /// <param name="dtAdd1"></param>
        /// <param name="dtAdd2"></param>
        /// <param name="dtEdit1"></param>
        /// <param name="dtEdit2"></param>
        /// <param name="userId"></param>
        /// <param name="isAdmin"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="recordCount"></param>
        /// <returns></returns>
        public DataTable GetListInTopicByFilter(
            int ztId,
            string title,
            string source,
            string author,
            string tags,
            int iIndex,
            int iTop,
            int iAudit,
            string dtAdd1,
            string dtAdd2,
            string dtEdit1,
            string dtEdit2,
            int userId,
            bool isAdmin,
            int pageIndex,
            int pageSize,
            ref int recordCount
            )
        {
            WhereClipBuilder wcb = new WhereClipBuilder();

            if (ztId > 0)
            {
                wcb.And(cmsNewsTopicRel._.TopicId == ztId);
            }
            if (!isAdmin)
            {
                wcb.And(cmsNews._.IsAudit < 3);
            }
            if (!string.IsNullOrEmpty(title.Trim()))
            {
                wcb.And(cmsNews._.Title.Contain(title.Trim()));
            }
            if (!string.IsNullOrEmpty(source.Trim()))
            {
                wcb.And(cmsNews._.Source.Contain(source.Trim()));
            }
            if (!string.IsNullOrEmpty(author.Trim()))
            {
                wcb.And(cmsNews._.Author.Contain(author.Trim()));
            }
            if (!string.IsNullOrEmpty(tags.Trim()))
            {
                wcb.And(cmsNews._.Tags.Contain(tags.Trim()));
            }
            if (iIndex >= 0)
            {
                wcb.And(cmsNews._.IsIndex == iIndex);
            }
            if (iTop >= 0)
            {
                wcb.And(cmsNews._.IsTop == iTop);
            }
            if (iAudit >= 0)
            {
                wcb.And(cmsNews._.IsAudit == iAudit);
            }
            if (!isAdmin && userId > 0)
            {
                wcb.And(cmsNews._.AddUser == userId);
            }
            DateTime dt;

            if (DateTime.TryParse(dtAdd1.Trim(), out dt))
            {
                wcb.And(cmsNews._.AddTime >= dt);
            }
            if (DateTime.TryParse(dtAdd2.Trim(), out dt))
            {
                wcb.And(cmsNews._.AddTime <= dt);
            }
            if (DateTime.TryParse(dtEdit1.Trim(), out dt))
            {
                wcb.And(cmsNews._.EditTime >= dt);
            }
            if (DateTime.TryParse(dtEdit2.Trim(), out dt))
            {
                wcb.And(cmsNews._.EditTime <= dt);
            }

            FromSection fs = entCMS.Services.DBSession.CurrentSession.From <cmsNews>()
                             .InnerJoin <cmsNewsCatalog>(cmsNews._.NodeCode == cmsNewsCatalog._.NodeCode)
                             .InnerJoin <cmsNewsTopicRel>(cmsNews._.Id == cmsNewsTopicRel._.NewsId)
                             .Select(cmsNewsTopicRel._.TopicId, cmsNewsCatalog._.NodeName, cmsNews._.All)
                             .Where(wcb.ToWhereClip())
                             .OrderBy(cmsNews._.EditTime.Desc);

            recordCount = fs.Count();

            return(fs
                   .Page(pageSize, pageIndex)
                   .ToDataTable());
        }
Esempio n. 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (string.IsNullOrEmpty(Request.UserAgent) || (!Request.UserAgent.Contains("MicroMessenger") && !Request.UserAgent.Contains("Windows Phone")))
                {
                    jsHint.toUrl("/index.html");
                }
                else
                {
                    tmpstr = Dos.Common.CookieHelper.Get("curYHJCAes1");
                    if (string.IsNullOrEmpty(tmpstr))
                    {
                        //不存在
                        //code = "890";
                        code = Request.QueryString["code"];
                        if (string.IsNullOrEmpty(code))
                        {
                            GetCode();
                        }
                        else
                        {
                            wxopid = GetOpid(code);
                            //wxopid = "so-11d9VTojracvd-qdDctsndsscsd";
                            //ctname = "互动点10";
                            //ctimgurl = "http://wx.qlogo.cn/mmopen/MvRAYAnmInk1nmbAeTtzO9mnw8QJbarxVeVicMKlOiaZfaF1I43MID2oUia6RicibBvTVfHJZcnWNgPq1FtkBuQ4sbGecA6zukloa/0";
                            tmpstr = Common.CryptHelper.DESEncrypt.Encrypt(wxopid, WebConfigurationManager.AppSettings["PassWordKey"]);
                            Dos.Common.CookieHelper.Set("curYHJCAes1", tmpstr, 12600);
                            //Dos.Common.CookieHelper.Set("curXYTid", wxopid, 12600);
                            Dos.Common.CookieHelper.Set("curYHJCName", ctname, 12600);
                            Dos.Common.CookieHelper.Set("curYHJCImgUrl", ctimgurl, 12600);
                        }
                    }
                    else
                    {
                        //存在
                        wxopid = Common.CryptHelper.DESEncrypt.Decrypt(tmpstr, WebConfigurationManager.AppSettings["PassWordKey"]);
                        //Dos.Common.CookieHelper.Set("curLNTid", wxopid, 12600);
                    }
                    try
                    {
                        var da1    = Convert.ToDateTime("09:00");
                        var da2    = Convert.ToDateTime("21:00");
                        var curdat = DateTime.Now;
                        if (curdat > da1 && curdat < da2)
                        {
                            sjdjc = "1";
                        }
                        if (string.IsNullOrEmpty(wxopid))
                        {
                            jsHint.toUrl("index.aspx");
                        }
                        else
                        {
                            tnum = DbSession.Default.From <HdPic>().Where(s => s.Extend2.Equals("115")).Count() + "";
                            if (!tnum.Equals("0"))
                            {
                                stopNum = DbSession.Default.FromSql("select row from (select row_number() over (order by orders desc,updatetime asc) row,extend1 from hdpic where Extend2='115') newtable where extend1=@extend1").AddInParameter("@extend1", DbType.String, wxopid).ToScalar() + "";
                            }
                            //SqlSection str = new SqlSection();
                            var model =
                                DbSession.Default.From <Dos.Model.HdPic>()
                                .Where(s => s.Extend1.Equals(wxopid) && s.Extend2.Equals("115")).ToFirstDefault();
                            FromSection <Activity> fromsection = DbSession.Default.From <Activity>()
                                                                 .Where(s => s.Status.Equals(0) && s.Type.Equals(10));
                            var list = fromsection.Page(10, 1).ToList();
                            if (list.Count > 0)
                            {
                                isbs = "1";
                            }
                            else
                            {
                                isbs = "2";
                            }
                            if (model.Id > 0)
                            {
                                //var tmodel = DbSession.Default.From<Dos.Model.HdPicHit>().Where(s => s.wxopenid.Equals(wxopid) && s.extend1.Equals("111")).ToFirstDefault();
                                //if (tmodel.Id > 0)
                                //{
                                //    strstart = tmodel.extend2;
                                //}
                                tid      = model.Id + "";
                                isx      = "1";
                                stotal   = model.Orders + "";
                                startNum = model.Status + "";

                                foreach (var item in list)
                                {
                                    var tmodel = DbSession.Default.From <HdPicHit>().Where(s => s.wxopenid.Equals(wxopid) && s.extend1.Equals("115") && s.hdpicid.Equals(item.ID)).ToFirstDefault();
                                    if (tmodel.Id > 0)
                                    {
                                        isjc = "1";
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception)
                    {
                        jsHint.toUrl("/index.html");
                    }
                }
            }
        }