Пример #1
0
        /// <summary>
        /// 根据栏目编号获取推荐到首页的列表
        /// </summary>
        /// <param name="nodecode"></param>
        /// <param name="top"></param>
        /// <param name="isLike"></param>
        /// <returns></returns>
        public DataTable GetIndexList(long langId, string nodecode, int top, bool isLike)
        {
            if (top <= 0 || top > 10)
            {
                top = 10;
            }
            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); // 已审核的
            wcb.And(cmsNews._.IsIndex == 1); // 推荐到首页的

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

            return(fs.ToDataTable());
        }
Пример #2
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());
        }
Пример #3
0
        private void BindGrid()
        {
            WhereClipBuilder wcb = new WhereClipBuilder();

            wcb.And(cmsFeedback._.LangId == CurrentLanguageId);
            if (!string.IsNullOrEmpty(txtTitle.Text.Trim()))
            {
                wcb.And(cmsFeedback._.Title.Contain(txtTitle.Text.Trim()));
            }
            if (!string.IsNullOrEmpty(txtName.Text.Trim()))
            {
                wcb.And(cmsFeedback._.Name.Contain(txtName.Text.Trim()));
            }
            if (!string.IsNullOrEmpty(txtName.Text.Trim()))
            {
                wcb.And(cmsFeedback._.Name.Contain(txtName.Text.Trim()));
            }
            if (ddlReply.SelectedIndex > 0)
            {
                wcb.And(cmsFeedback._.IsReplied == Convert.ToInt32(ddlReply.SelectedValue));
            }
            int recordCount       = 0;
            List <cmsFeedback> ls = FeedbackService.GetInstance().GetList(wcb.ToWhereClip(), cmsFeedback._.PostTime.Desc, pager.CurrentPageIndex, pager.PageSize, ref recordCount);

            // 绑定数据到GridView
            base.BindGrid <cmsFeedback>(recordCount, ls);
        }
Пример #4
0
        public ActionResult GetOrderList4Mobile(int pageSize, int pageIndex)
        {
            string           orderNo          = Request["orderNo"];
            string           area             = Request["area"];
            WhereClipBuilder whereClipBuilder = new WhereClipBuilder();

            whereClipBuilder.And(new WhereClip(Orders._.IsDel, (int)IsDel.否, QueryOperator.Equal));
            if (!string.IsNullOrEmpty(orderNo))
            {
                whereClipBuilder.And(new WhereClip(Orders._.OrderNo, orderNo, QueryOperator.Equal));
            }
            if (!string.IsNullOrEmpty(area))
            {
                whereClipBuilder.And(new WhereClip(Orders._.Area, area, QueryOperator.Equal));
            }
            var linq = Db.MySqlContext.From <Orders>().Where(whereClipBuilder.ToWhereClip()).OrderByDescending(d => d.Id);

            PageResponse <Orders> pageList = getListByPaging <Orders, Orders>(linq, pageSize, pageIndex);

            if (pageList == null || pageList.totalItems == 0)
            {
                return(Error(ErrCode.查询成功无数据.ToString()));
            }
            else
            {
                return(Success("获取成功", pageList));
            }
        }
Пример #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="top"></param>
        /// <param name="nodecode"></param>
        /// <param name="isLike"></param>
        /// <param name="isAudit"></param>
        /// <param name="isIndex"></param>
        /// <returns></returns>
        public DataTable GetTopNews(int top, string nodecode, bool isLike, bool isAudit, bool isIndex)
        {
            WhereClipBuilder wcb = new WhereClipBuilder();

            if (!string.IsNullOrEmpty(nodecode))
            {
                if (!isLike)
                {
                    wcb.And(cmsNews._.NodeCode == nodecode);
                }
                else
                {
                    wcb.And(cmsNews._.NodeCode.BeginWith(nodecode));
                }
            }
            if (isAudit)
            {
                wcb.And(cmsNews._.IsAudit == 1);         // 已审核的
            }
            if (isIndex)
            {
                wcb.And(cmsNews._.IsIndex == 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);

            if (top > 0)
            {
                fs = fs.Top(top);
            }

            return(fs.ToDataTable());
        }
Пример #6
0
        private void BindGrid()
        {
            WhereClipBuilder wcb = new WhereClipBuilder();
            wcb.And(cmsFeedback._.LangId == CurrentLanguageId);
            if (!string.IsNullOrEmpty(txtTitle.Text.Trim()))
            {
                wcb.And(cmsFeedback._.Title.Contain(txtTitle.Text.Trim()));
            }
            if (!string.IsNullOrEmpty(txtName.Text.Trim()))
            {
                wcb.And(cmsFeedback._.Name.Contain(txtName.Text.Trim()));
            }
            if (!string.IsNullOrEmpty(txtName.Text.Trim()))
            {
                wcb.And(cmsFeedback._.Name.Contain(txtName.Text.Trim()));
            }
            if (ddlReply.SelectedIndex > 0)
            {
                wcb.And(cmsFeedback._.IsReplied == Convert.ToInt32(ddlReply.SelectedValue));
            }
            int recordCount = 0;
            List<cmsFeedback> ls = FeedbackService.GetInstance().GetList(wcb.ToWhereClip(), cmsFeedback._.PostTime.Desc, pager.CurrentPageIndex, pager.PageSize, ref recordCount);

            // 绑定数据到GridView
            base.BindGrid<cmsFeedback>(recordCount, ls);
        }
Пример #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="top">top=0取全部,top>0取top条</param>
        /// <param name="nodecode"></param>
        /// <param name="isAudit"></param>
        /// <param name="isIndex"></param>
        /// <returns></returns>
        public DataTable GetTopZtNews(int top, int ztId, bool isAudit, bool isIndex)
        {
            WhereClipBuilder wcb = new WhereClipBuilder();

            if (ztId > 0)
            {
                wcb.And(cmsNewsTopicRel._.TopicId == ztId);
            }
            if (isAudit)
            {
                wcb.And(cmsNews._.IsAudit == 1);          // 已审核的
            }
            if (isIndex)
            {
                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);

            if (top > 0)
            {
                fs = fs.Top(top);
            }

            return(fs.ToDataTable());
        }
Пример #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="loginName"></param>
        /// <param name="trueName"></param>
        /// <param name="deptName"></param>
        /// <param name="roleId"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="recordCount"></param>
        /// <returns></returns>
        public List <cmsUser> GetUsersByFilter(string loginName, string trueName, string deptName, int roleId, int pageIndex, int pageSize, ref int recordCount)
        {
            UserRoleService urs = UserRoleService.GetInstance();

            WhereClipBuilder wcb = new WhereClipBuilder();

            if (!string.IsNullOrEmpty(loginName))
            {
                wcb.And(cmsUser._.UName.Contain(loginName.Trim()));
            }
            if (!string.IsNullOrEmpty(trueName))
            {
                wcb.And(cmsUser._.Name.Contain(trueName.Trim()));
            }
            if (!string.IsNullOrEmpty(deptName.Trim()))
            {
                wcb.And(cmsUser._.DeptName.Contain(deptName.Trim()));
            }
            if (roleId > 0)
            {
                FromSection fs = DBSession.CurrentSession.From <cmsUserRole>()
                                 .Select(cmsUserRole._.UserId)
                                 .Where(cmsUserRole._.RoleId == roleId);

                wcb.And(cmsUser._.Id.SubQueryIn(fs));
            }
            return(GetList(wcb.ToWhereClip(), cmsUser._.UName.Asc, pageIndex, pageSize, ref recordCount));
        }
Пример #9
0
        /// <summary>
        /// 取全部有效工作岗位
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="recordCount"></param>
        /// <returns></returns>
        public List <cmsJob> GetValidList(long langId, int pageIndex, int pageSize, ref int recordCount)
        {
            WhereClipBuilder wcb = new WhereClipBuilder();

            wcb.And(cmsJob._.LangId == langId);
            wcb.And(cmsJob._.IsEnabled == 1 && (cmsJob._.EndTime.IsNull() || cmsJob._.EndTime > DateTime.Now));

            return(GetList(wcb.ToWhereClip(), cmsJob._.OrderNo.Asc, pageIndex, pageSize, ref recordCount));
        }
Пример #10
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());
        }
Пример #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="langId"></param>
        /// <param name="isReplied"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public List <cmsFeedback> GetList(long langId, bool?isReplied, int pageIndex, int pageSize, ref int count)
        {
            WhereClipBuilder wcb = new WhereClipBuilder();

            wcb.And(cmsFeedback._.LangId == langId);
            if (isReplied.HasValue)
            {
                wcb.And(cmsFeedback._.IsReplied == isReplied.Value);
            }
            return(GetList(wcb.ToWhereClip(), cmsFeedback._.PostTime.Desc, 1, 5, ref count));
        }
Пример #12
0
        /// <summary>
        /// 获取通用字典
        /// </summary>
        /// <returns></returns>
        public static List <Sys_ItemsDetail> GetGlobalConstVariable(string F_ItemCode = "")
        {
            WhereClipBuilder wherebuilder = new WhereClipBuilder();

            wherebuilder.And(Sys_ItemsDetail._.F_ItemId == YiDaBusConst.CommonDicItemId);
            if (!F_ItemCode.IsEmpty())
            {
                wherebuilder.And(Sys_ItemsDetail._.F_ItemCode == F_ItemCode);
            }
            return(Db.MySqlContext.From <Sys_ItemsDetail>().Where(wherebuilder.ToWhereClip()).ToList());
        }
Пример #13
0
        /// <summary>
        /// 获取某种语言下的幻灯片列表
        /// </summary>
        /// <param name="lngId"></param>
        /// <param name="isEnabled"></param>
        /// <returns></returns>
        public List <cmsSlideshow> GetListByLangId(long lngId, bool?isEnabled = null)
        {
            WhereClipBuilder wcb = new WhereClipBuilder(cmsSlideshow._.LangId == lngId);

            if (isEnabled.HasValue)
            {
                wcb.And(cmsSlideshow._.IsEnabled == isEnabled.Value);
            }

            return(GetList(wcb.ToWhereClip(), cmsSlideshow._.OrderNo.Asc));
        }
Пример #14
0
        /// <summary>
        /// 得到实体类
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public T GetModel(params object[] id)
        {
            if (id == null || id.Length == 0)
            {
                return(null);
            }

            Field[] pkfields = Hxj.Data.Common.EntityCache.GetPrimaryKeyFields <T>();
            if (id == null)
            {
                throw new ArgumentNullException("请指定主键值!");
            }
            if (pkfields == null || pkfields.Length == 0)
            {
                throw new Exception("数据表[" + Hxj.Data.Common.EntityCache.GetTableName <T>() + "]不存在任何主键!");
            }

            T t = null;

            if (pkfields.Length == 1)
            {
                if (_trans != null)
                {
                    t = _trans.From <T>().Where(Hxj.Data.Common.EntityCache.GetPrimaryKeyFields <T>()[0] == id).ToFirst();
                }
                t = DBSession.CurrentSession.From <T>().Where(Hxj.Data.Common.EntityCache.GetPrimaryKeyFields <T>()[0] == id[0]).ToFirst();
            }
            else
            {
                if (id.Length != pkfields.Length)
                {
                    throw new Exception("指定的主键值个数与数据表的主键个数不符!");
                }

                FromSection <T> section = null;
                if (_trans != null)
                {
                    section = _trans.From <T>();
                }
                else
                {
                    section = DBSession.CurrentSession.From <T>();
                }
                WhereClipBuilder wcb = new WhereClipBuilder();
                for (int i = 0; i < pkfields.Length; i++)
                {
                    wcb.And(pkfields[i] == id[i]);
                }
                t = section.Where(wcb.ToWhereClip()).ToFirst();
            }
            GetRelations(ref t);
            return(t);
        }
Пример #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="lngId"></param>
        /// <param name="isEnabled"></param>
        /// <returns></returns>
        public List <cmsLinkGroup> GetList(long?lngId, int?isEnabled)
        {
            WhereClipBuilder wcb = new WhereClipBuilder();

            if (lngId.HasValue)
            {
                wcb.And(cmsLinkGroup._.LangId == lngId.Value);
            }
            if (isEnabled.HasValue)
            {
                wcb.And(cmsLinkGroup._.IsEnabled == isEnabled.Value);
            }

            return(GetList(wcb.ToWhereClip(), cmsLinkGroup._.OrderNo.Asc));
        }
Пример #16
0
        public ActionResult GetSelectedSeatsByAare(string area, string week)
        {
            WhereClipBuilder wherebuilder = new WhereClipBuilder();

            wherebuilder.And(Orders._.IsDel == IsDel.否);
            var    DepartureTime = string.Empty;
            string IsOpenF56789  = "是";

            if (area == AreaType.shanghai.ToString())
            {
                wherebuilder.And(Orders._.CarNumber.In(YiDaBusConst.海车牌号1, YiDaBusConst.海车牌号2));
                int day = 0;
                DepartureTime = GetDateTimeByWeek(week.ToInt(), ref day).ToString("yyyy-MM-dd");
                IsOpenF56789  = CommonBLL.GetGlobalConstVariable(YiDaBusConst.是否开启苏F56789).FirstOrDefault()?.F_Description;
            }
            else if (area == AreaType.hangzhou.ToString())
            {
                wherebuilder.And(Orders._.CarNumber == YiDaBusConst.杭州车牌号);
                DepartureTime = DateTime.Now.ToString("yyyy-MM-dd");
            }
            wherebuilder.And(Orders._.DepartureTime == DepartureTime);

            var data      = Db.MySqlContext.From <Orders>().Where(wherebuilder.ToWhereClip()).ToList();
            var groupData = data.GroupBy(d => d.CarNumber);

            SeatsDetails seatsDetails = new SeatsDetails();
            List <OrdersByGroupCarNumber> ordersByGroupCarNumberList = new List <OrdersByGroupCarNumber>();

            foreach (var groupitem in groupData)
            {
                List <string> seatsList    = new List <string>();
                List <string> unSelectList = new List <string>();

                foreach (var item in groupitem)
                {
                    seatsList = seatsList.Concat(item.SeatIds.Replace(YiDaBusConst.SeatSign, "").Split(',').ToList()).ToList();
                }

                ordersByGroupCarNumberList.Add(new OrdersByGroupCarNumber()
                {
                    CarNumber = groupitem.Key,
                    SeatIds   = seatsList
                });
            }
            seatsDetails.OrdersByGroupCarNumberList = ordersByGroupCarNumberList;
            seatsDetails.IsOpenF56789 = IsOpenF56789;
            return(base.Sucess("操作成功", 200, seatsDetails));
        }
Пример #17
0
        /// <summary>
        /// 返回全部parentCode下的子栏目
        /// </summary>
        /// <param name="parentCode">上级栏目</param>
        /// <param name="isLike">是否包含</param>
        /// <param name="isEnabled">是否有效</param>
        /// <returns></returns>
        public List <cmsNewsCatalog> GetChildList(string parentCode, bool isLike, bool?isEnabled)
        {
            WhereClipBuilder wcb = new WhereClipBuilder();

            if (isLike)
            {
                wcb.And(cmsNewsCatalog._.ParentCode.BeginWith(parentCode));
            }
            else
            {
                wcb.And(cmsNewsCatalog._.ParentCode == parentCode);
            }
            if (isEnabled.HasValue)
            {
                wcb.And(cmsNewsCatalog._.IsEnabled == (isEnabled.Value ? 1 : 0));
            }

            return(GetList(wcb.ToWhereClip(), cmsNewsCatalog._.OrderNo.Asc));
        }
Пример #18
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());
        }
Пример #19
0
        /// <summary>
        /// 根据栏目类型获取推荐到首页的列表
        /// </summary>
        /// <param name="nodetype"></param>
        /// <param name="top"></param>
        /// <returns></returns>
        public DataTable GetIndexList(long langId, int nodetype, int top)
        {
            if (top <= 0 || top > 10)
            {
                top = 10;
            }
            WhereClipBuilder wcb = new WhereClipBuilder();

            wcb.And(cmsNews._.LangId == langId);
            wcb.And(cmsNewsCatalog._.NodeType == nodetype);
            wcb.And(cmsNews._.IsAudit == 1); // 已审核的
            wcb.And(cmsNews._.IsIndex == 1); // 推荐到首页的

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

            return(fs.ToDataTable());
        }
Пример #20
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());
        }
Пример #21
0
        private void BindGrid()
        {
            WhereClipBuilder wcb = new WhereClipBuilder();

            wcb.And(cmsLink._.LangId == CurrentLanguageId);
            if (!string.IsNullOrEmpty(txtName.Text.Trim()))
            {
                wcb.And(cmsLink._.Name.Contain(txtName.Text.Trim()));
            }
            if (!string.IsNullOrEmpty(txtUrl.Text.Trim()))
            {
                wcb.And(cmsLink._.Url.Contain(txtUrl.Text.Trim()));
            }
            if (ddlType.SelectedIndex > 0)
            {
                wcb.And(cmsLink._.GroupId == Convert.ToInt64(ddlType.SelectedValue));
            }
            int       recordCount = 0;
            DataTable dt          = ls.GetDataTable(wcb.ToWhereClip(), pager.CurrentPageIndex, pager.PageSize, ref recordCount);

            // 绑定数据到GridView
            base.BindGrid(recordCount, dt);
        }
Пример #22
0
        /// <summary>
        /// 返回某语言下指定类别的全部有效栏目
        /// </summary>
        /// <returns></returns>
        public List <cmsNewsCatalog> GetCatalogs(long langId, params int[] types)
        {
            WhereClipBuilder wcb = new WhereClipBuilder();

            wcb.And(cmsNewsCatalog._.LangId == langId && cmsNewsCatalog._.IsEnabled == 1);
            if (types != null && types.Length > 0)
            {
                wcb.And(cmsNewsCatalog._.NodeType.SelectIn(types));
            }
            List <cmsNewsCatalog> ls      = GetList(wcb.ToWhereClip(), cmsNewsCatalog._.LangId.Asc && cmsNewsCatalog._.OrderNo.Asc);
            List <cmsNewsCatalog> allList = new List <cmsNewsCatalog>();

            foreach (var item in ls)
            {
                if (!allList.Exists(x => x.Id == item.Id))
                {
                    allList.Add(item);
                }
                AddParentToList(allList, item);
            }

            return(allList);
        }
Пример #23
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 GetListByFilter2(
            string nodecode,
            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 (!string.IsNullOrEmpty(nodecode))
            {
                wcb.And(cmsNews._.NodeCode == nodecode); // 当前栏目
            }
            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);
                wcb.And(cmsNews._.AddUser.SubQueryIn(
                            DBSession.CurrentSession.From <cmsUserMap>()
                            .Select(cmsUserMap._.UserId)
                            .Where(cmsUserMap._.UpUserId == 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
                   .Select(cmsNews._.All)
                   .Page(pageSize, pageIndex)
                   .ToDataTable());
        }
Пример #24
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());
        }
Пример #25
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());
        }
Пример #26
0
        private void BindGrid()
        {
            WhereClipBuilder wcb = new WhereClipBuilder();
            wcb.And(cmsLink._.LangId == CurrentLanguageId);
            if (!string.IsNullOrEmpty(txtName.Text.Trim()))
            {
                wcb.And(cmsLink._.Name.Contain(txtName.Text.Trim()));
            }
            if (!string.IsNullOrEmpty(txtUrl.Text.Trim()))
            {
                wcb.And(cmsLink._.Url.Contain(txtUrl.Text.Trim()));
            }
            if (ddlType.SelectedIndex > 0)
            {
                wcb.And(cmsLink._.GroupId == Convert.ToInt64(ddlType.SelectedValue));
            }
            int recordCount = 0;
            DataTable dt = ls.GetDataTable(wcb.ToWhereClip(), pager.CurrentPageIndex, pager.PageSize, ref recordCount);

            // 绑定数据到GridView
            base.BindGrid(recordCount, dt);
        }