Exemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int id = Convert.ToInt32(context.Request["id"]);

            BLL.blogs   bll_blog   = new BLL.blogs();
            Model.blogs model_blog = bll_blog.GetModel(id);
            //阅读排行榜
            List <Model.blogs> list_blog = bll_blog.GetModelList("Blog_delete = 0 and Blog_is = 1 order by Blog_read desc LIMIT 4");

            //评论
            BLL.tell          bll_tell  = new BLL.tell();
            List <Model.tell> list_tell = bll_tell.GetModelList("Tell_blogid=" + id + "");

            BLL.user bll_user = new BLL.user();
            for (int i = 0; i < list_tell.Count; i++)
            {
                Model.user model_user = bll_user.GetModel((int)list_tell[i].Tell_userid);
                list_tell[i].Tell_name = model_user.User_name;
            }


            Model.showblog model_show = new Model.showblog()
            {
                Show_blog = model_blog,
                Show_list = list_blog,
                Show_tell = list_tell
            };
            System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
            string is_show = js.Serialize(model_show);

            context.Response.Write(is_show);
        }
Exemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["ht_id"] == null && Request.Cookies["ht_pwd"] == null)
     {
         Response.Redirect("login.html");
     }
     else
     {
         BLL.blogs bll_blog = new BLL.blogs();
         list_blog = bll_blog.GetModelList("");
     }
 }
Exemplo n.º 3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //博客类别
            string session_user = null;

            //if (context.Session["USER"] != null){
            //    session_user = context.Session["USER"].ToString();
            //}
            BLL.blog_type          bll_type  = new BLL.blog_type();
            List <Model.blog_type> list_type = bll_type.GetModelList("");

            //热门博客
            BLL.blogs          bll_blogs     = new BLL.blogs();
            List <Model.blogs> list_hotblogs = bll_blogs.GetModelList(" Blog_delete = 0 and Blog_is = 1 order by Blog_read  desc");

            Model.blogs moblogs = list_hotblogs[0];
            //图片分享
            BLL.img          bll_img  = new BLL.img();
            List <Model.img> list_img = bll_img.GetModelList("Img_is=1");

            //评论
            BLL.tell          bll_tell  = new BLL.tell();
            BLL.user          bll_user  = new BLL.user();
            List <Model.tell> list_tell = bll_tell.GetModelList(" Tell_id>0 order by Tell_blogid  LIMIT 3");

            for (int i = 0; i < list_tell.Count; i++)
            {
                Model.user model_user = bll_user.GetModel((int)list_tell[i].Tell_userid);
                list_tell[i].Tell_img  = model_user.User_img;
                list_tell[i].Tell_name = model_user.User_name;
            }
            //推荐博客

            List <Model.blogs> list_tuiblogs = new List <Model.blogs> {
                list_hotblogs[1], list_hotblogs[2], list_hotblogs[3]
            };

            Model.Main main = new Model.Main()
            {
                Main_type     = list_type,
                Main_hotblogs = moblogs,
                Main_tuiblogs = list_tuiblogs,
                Main_tell     = list_tell,
                Main_img      = list_img,
                name          = session_user
            };
            System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
            string json = js.Serialize(main);

            context.Response.Write(json);
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["ht_id"] == null && Request.Cookies["ht_pwd"] == null)
            {
                Response.Redirect("login.html");
            }
            else
            {
                BLL.blogs          bll_blogs = new BLL.blogs();
                List <Model.blogs> blogs     = bll_blogs.GetModelList("Blog_delete=0");
                BLL.blog_type      bll_type  = new BLL.blog_type();

                for (int i = 0; i < blogs.Count; i++)
                {
                    Model.blog_type model_type = bll_type.GetModel((int)blogs[i].Blog_typeid);
                    blogs[i].Blog_typename = model_type.Type_name;
                }
                oblogs = blogs;
            }
        }