コード例 #1
0
        //
        // GET: /Xueya/
        public ActionResult Index(int? p)
        {
            Pager pager = new Pager();
            pager.table = "CMSXueya";
            pager.strwhere = "1=1";
            pager.PageSize = 30;
            pager.PageNo = p ?? 1;
            pager.FieldKey = "XueyaId";
            pager.FiledOrder = "XueyaId Desc";
            pager = CMSService.SelectAll("Xueya", pager);

            List<XueyaDto> list = new List<XueyaDto>();
            foreach (DataRow dr in pager.EntityDataTable.Rows)
            {
                XueyaDto dto = XueyaMapping.getDTO(dr);
                list.Add(dto);

            }
            pager.Entity = list.AsQueryable();

            ViewBag.PageNo = p ?? 1;
            ViewBag.PageCount = pager.PageCount;
            ViewBag.RecordCount = pager.Amount;
            ViewBag.Message = pager.Amount;
              //  ViewBag.CustomerId = id;
            //ViewBag.CustomerName = MyService.CustomerIdToName("CustomerId=" + id);

            return View(pager.Entity);
        }
コード例 #2
0
        public ActionResult Daizhen(int? p)
        {
            Pager pager = new Pager();
            pager.table = "CMSCustomer";
            pager.strwhere = "1=1";
            pager.PageSize = 10;
            pager.PageNo = p ?? 1;
            pager.FieldKey = "CustomerId";
            pager.FiledOrder = "CustomerId Desc";
            pager.strwhere = pager.strwhere + " and CustomerTizhi='0'";

            pager = CMSService.SelectAll("Customer", pager);
            List<CustomerDto> list = new List<CustomerDto>();
            foreach (DataRow dr in pager.EntityDataTable.Rows)
            {
                CustomerDto dto = CustomerMapping.getDTO(dr);
                list.Add(dto);

            }
            pager.Entity = list.AsQueryable();

            ViewBag.PageNo = p ?? 1;
            ViewBag.PageCount = pager.PageCount;
            ViewBag.RecordCount = pager.Amount;
            ViewBag.Message = pager.Amount;

            return View(pager.Entity);
        }
コード例 #3
0
ファイル: BbsServiceImpl.cs プロジェクト: 91mvc/YQCMS
 /// <summary>
 /// 获取论坛板块列表 CategoryModel
 /// </summary>
 /// <param name="cid"></param>
 /// <returns></returns>
 public IQueryable<BbsBoardModel> GetBbsBoards(int cid)
 {
     IQueryable<CategoryModel> list = GetSubCategoryList(cid);
     List<BbsBoardModel> boardlist = new List<BbsBoardModel>();
     foreach (CategoryModel c in list)
     {
         boardlist.Add(GetBbsBoard(c));
     }
     return boardlist.AsQueryable();
 }
コード例 #4
0
ファイル: EditorDal.cs プロジェクト: jorzen2010/HealthCrm
        public static Pager GetEditorPage(Pager pager, string strwhere, string table)
        {
            SqlParameter[] arParms = new SqlParameter[9];
            //@tbname   --要分页显示的表名
            arParms[0] = new SqlParameter("@tbname", SqlDbType.NVarChar, 30);
            arParms[0].Value = table;

            // @FieldKey --用于定位记录的主键(惟一键)字段,可以是逗号分隔的多个字段
            arParms[1] = new SqlParameter("@FieldKey", SqlDbType.NVarChar, 40);
            arParms[1].Value = "EditorId";

            //@PageCurrent --要显示的页码
            arParms[2] = new SqlParameter("@PageCurrent", SqlDbType.Int);
            arParms[2].Value = pager.PageNo + 1;

            // @PageSize --每页的大小(记录数)
            arParms[3] = new SqlParameter("@PageSize", SqlDbType.Int);
            arParms[3].Value = pager.PageSize;

            //@FieldShow  --以逗号分隔的要显示的字段列表,如果不指定,则显示所有字段
            arParms[4] = new SqlParameter("@FieldShow", SqlDbType.NVarChar, 500);
            arParms[4].Value = "*";

            //@FieldOrder --以逗号分隔的排序字段列表,可以指定在字段后面指定DESC/ASC用于指定排序顺序

            arParms[5] = new SqlParameter("@FieldOrder", SqlDbType.NVarChar, 500);
            arParms[5].Value = "EditorId desc";

            //@Where   --查询条件
            arParms[6] = new SqlParameter("@Where", SqlDbType.VarChar, 8000);
            arParms[6].Value = strwhere;

            //@PageCount --总页数
            arParms[7] = new SqlParameter("@PageCount", SqlDbType.Int);
            arParms[7].Direction = ParameterDirection.Output;

            //@RecordCount --总记录数
            arParms[8] = new SqlParameter("@RecordCount", SqlDbType.Int);
            arParms[8].Direction = ParameterDirection.Output;
            SqlConnection myconn = new SqlConnection(CommonDal.ConnectionString);
            try
            {
            EditorDto editorDto = null;
            List<EditorDto> list = new List<EditorDto>();
            DataTable dt = null;
            DataSet ds = SqlHelper.ExecuteDataset(myconn, CommandType.StoredProcedure, "sp_AspNetPageView", arParms);
            dt = ds.Tables[0];
            foreach (DataRow dr in dt.Rows)
            {
                editorDto = EditorDal.getDataRowToEditorDto(dr);
                list.Add(editorDto);
            }

            var totalItems = (int)arParms[8].Value;

            pager.Amount = totalItems;
            pager.Entity = list.AsQueryable();
            pager.PageCount = (int)arParms[7].Value;

            return pager;
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {

                myconn.Close();
                myconn.Dispose();
            }
        }
コード例 #5
0
        // 显示用户列表页
        public ActionResult Index(int? p, int? roleId)
        {
            int RoleId = roleId ?? 0;
            Pager pager = new Pager();
            pager.table = "CMSUser";
            pager.strwhere = "1=1";
            pager.PageSize = 10;
            pager.PageNo = p ?? 1;
            pager.FieldKey = "UserId";
            pager.FiledOrder = "UserId Desc";
            if (RoleId > 0)
            {

                pager.strwhere = pager.strwhere + " and charindex('" + RoleId + "',UserRoles)>0";

            }

            pager = CMSService.SelectAll("User", pager);

            List<UserDto> list = new List<UserDto>();
            foreach (DataRow dr in pager.EntityDataTable.Rows)
            {
                UserDto dto = UserMapping.getDTO(dr);
                dto.UserRoles = MyService.RolesIdToRolesName(dto.UserRoles);
                list.Add(dto);

            }
            pager.Entity = list.AsQueryable();

            ViewBag.PageNo = p ?? 1;
            ViewBag.PageCount = pager.PageCount;
            ViewBag.RecordCount = pager.Amount;
            ViewBag.Message = pager.Amount;
            ViewData["Roles"] = MyService.GetRolesList("1=1");

            return View(pager.Entity);
        }
コード例 #6
0
        // Category列表
        public ActionResult Index(int? p, int id, string CategoryParentName)
        {
            Pager pager = new Pager();
            pager.table = "CMSCategory";
            pager.strwhere = "CategoryParentId="+id;
            pager.PageSize = 10;
            pager.PageNo = p ?? 1;
            pager.FieldKey = "CategoryId";
            pager.FiledOrder = "CategoryId Desc";
            pager = CMSService.SelectAll("Category", pager);

            List<CategoryDto> list = new List<CategoryDto>();
            foreach (DataRow dr in pager.EntityDataTable.Rows)
            {
                CategoryDto dto = CategoryMapping.getDTO(dr);
                list.Add(dto);

            }
            pager.Entity = list.AsQueryable();

            ViewBag.PageNo = p ?? 1;
            ViewBag.PageCount = pager.PageCount;
            ViewBag.RecordCount = pager.Amount;
            ViewBag.Message = pager.Amount;
            ViewBag.CategoryParentName = CategoryParentName;
            ViewBag.CategoryParentId = id;
            return View(pager.Entity);
        }
コード例 #7
0
        //
        // GET: /Role/
        public ActionResult Index(int? p)
        {
            Pager pager = new Pager();
            pager.table = "CMSRole";
            pager.strwhere = "1=1";
            pager.PageSize = 10;
            pager.PageNo = p ?? 1;
            pager.FieldKey = "RoleId";
            pager.FiledOrder = "RoleId Desc";
            pager = CMSService.SelectAll("Role", pager);

            List<RoleDto> list = new List<RoleDto>();
            foreach (DataRow dr in pager.EntityDataTable.Rows)
            {
                RoleDto dto = RoleMapping.getDTO(dr);
                list.Add(dto);

            }
            pager.Entity = list.AsQueryable();

            ViewBag.PageNo = p ?? 1;
            ViewBag.PageCount = pager.PageCount;
            ViewBag.RecordCount = pager.Amount;
            ViewBag.Message = pager.Amount;

            return View(pager.Entity);
        }
コード例 #8
0
 /// <summary>
 /// 获取指定分类下所有相册信息
 /// </summary>
 public IQueryable<AlbumModel> GetAlbums(int cid,int count=0)
 {
     IQueryable<blog_varticle> varticles;
     if(cid==0)
         varticles = GetArticles(4, 0, count);
     else
         varticles = GetArticles(4, GetCategoryIds(cid), count);
     varticles = varticles.OrderBy(m => m.catepath);
     List<AlbumModel> lst = new List<AlbumModel>();
     foreach (blog_varticle varticle in varticles)
     {
         lst.Add(GetAlbum(varticle));
     }
     return lst.AsQueryable();
 }
コード例 #9
0
        //
        // GET: /Customer/
        public ActionResult Index(int? p, string  category,string guidang)
        {
            string Category = category ?? "全部";
            string Guidang = guidang ?? "0";
            Pager pager = new Pager();
            pager.table = "CMSCustomer";
            pager.strwhere = "1=1";
            pager.PageSize = 10;
            pager.PageNo = p ?? 1;
            pager.FieldKey = "CustomerId";
            pager.FiledOrder = "CustomerId Desc";

            if (Category !="全部")
            {

                pager.strwhere = pager.strwhere + " and charindex('" + Category + "',CustomerTizhi)>0";

            }
            if (Guidang != "0")
            {

                pager.strwhere = pager.strwhere + " and charindex('" + Guidang + "',CustomerGuidang)>0";

            }
            pager = CMSService.SelectAll("Customer", pager);
            List<CustomerDto> list = new List<CustomerDto>();
            foreach (DataRow dr in pager.EntityDataTable.Rows)
            {
                CustomerDto dto = CustomerMapping.getDTO(dr);
                list.Add(dto);

            }
            pager.Entity = list.AsQueryable();

            ViewBag.PageNo = p ?? 1;
            ViewBag.PageCount = pager.PageCount;
            ViewBag.RecordCount = pager.Amount;
            ViewBag.Message = pager.Amount;
            ViewData["Category"] = MyService.GetCategoryList("CategoryParentId=20");
            ViewData["Guidang"] = MyService.GetCategoryList("CategoryParentId=30");

            return View(pager.Entity);
        }
コード例 #10
0
        //
        // GET: /Liangbiao/Details/5
        public ActionResult List(int?p,int id)
        {
            Pager pager = new Pager();
            pager.table = "CMSTizhi";
            pager.strwhere = "TizhiCustomerId="+id;
            pager.PageSize = 10;
            pager.PageNo = p ?? 1;
            pager.FieldKey = "TizhiId";
            pager.FiledOrder = "TizhiId Desc";
            pager = CMSService.SelectAll("Tizhi", pager);

            List<TizhiDto> list = new List<TizhiDto>();
            foreach (DataRow dr in pager.EntityDataTable.Rows)
            {
                TizhiDto dto = TizhiMapping.getDTO(dr);
                list.Add(dto);

            }
            pager.Entity = list.AsQueryable();

            ViewBag.PageNo = p ?? 1;
            ViewBag.PageCount = pager.PageCount;
            ViewBag.RecordCount = pager.Amount;
            ViewBag.Message = pager.Amount;
            ViewBag.CustomerId = id;
            ViewBag.CustomerName = MyService.CustomerIdToName("CustomerId=" + id);

            return View(pager.Entity);
        }
コード例 #11
0
        /// <summary>
        /// 记录结果处理
        /// </summary>
        private IQueryable<ArtilceWithDecorate> GetNewArticleQuery(IQueryable<blog_varticle> d, out string jsonSummaryImg)
        {
            configinfo.DecorateImgCount = WebUtils.GetDecorateCount(WebUtils.GetCurrentTheme());
            List<ArtilceWithDecorate> list = new List<ArtilceWithDecorate>();
            string str = "[";
            string img = "";
            int tmpKey = 0;
            Random ran = new Random();

            string themepath = WebUtils.GetCurrentTheme() == "" ? "/Content/" : "/Themes/" + WebUtils.GetCurrentTheme() + "/Content/";

            foreach (blog_varticle a in d)
            {
               //提取summary中第一张图
                img = Utils.GetImg(a.summary);
                //提取内容中的第一张图
                //if (img == "")
                //    img = Utils.GetImg(a.content);
                if (img == "" && configinfo.DecorateImgCount > 0)
                {
                    int RandKey = ran.Next(1001, 1000 + configinfo.DecorateImgCount);
                    if (RandKey == tmpKey)
                        RandKey++;
                    RandKey = RandKey > 1000 + configinfo.DecorateImgCount ? 1001 : RandKey;
                    tmpKey = RandKey;

                    img = themepath+"image/decorate/" + RandKey.ToString() + ".jpg";
                }
                if (img != "")
                    str += "{\"id\":\"" + a.id.ToString() + "\",\"img\":\"" + img + "\"},";

                list.Add(
                    new ArtilceWithDecorate
                    {
                        id=a.id,
                        title=a.title,
                        cateid=a.cateid,
                        typeid=a.typeid,
                        createdate=a.createdate,
                        viewcount=a.viewcount,
                        subcount=a.subcount,
                        catepath = myService.GetCategoryPathUrl(a.catepath),
                        rename=a.rename,
                        url=a.url,
                        istop=a.istop,
                        iscommend=a.iscommend,
                        Decorate=img,
                        summary = Utils.ClearImgs(a.summary).Trim() == "" ? Utils.CutString(Utils.RemoveHtml(a.content), 0, configinfo.MaxSummaryCharCount) + "..." : Utils.ClearImgs(a.summary),
                        FullSummary = a.summary.Trim() == "" ? Utils.CutString(Utils.RemoveHtml(a.content), 0, configinfo.MaxSummaryCharCount) + "..." : a.summary.Trim()
                    });
            }
            jsonSummaryImg = "var summaryimgs=" + str.Trim(',') + "];";
            return list.AsQueryable<ArtilceWithDecorate>();
        }