Ejemplo n.º 1
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.blog_type bll_type = new BLL.blog_type();
         list_type = bll_type.GetModelList("");
     }
 }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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;
            }
        }
Ejemplo n.º 4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //图片
            if (context.Request["page"] == "img")
            {
                int    id     = Convert.ToInt32(context.Request["id"]);
                string text   = context.Request["text"];
                string img    = context.Request["img"];
                int    img_is = Convert.ToInt32(context.Request["is"]);

                Model.img model_img = new Model.img()
                {
                    Img_address = img,
                    Img_id      = id,
                    Img_is      = img_is,
                    Img_text    = text
                };
                BLL.img bll_img = new BLL.img();
                if (bll_img.Update(model_img) == true)
                {
                    context.Response.Write("修改成功");
                }
                else
                {
                    context.Response.Write("修改失败");
                }
            }
            //用户
            if (context.Request["page"] == "user")
            {
                int    id    = Convert.ToInt32(context.Request["id"]);
                string name  = context.Request["name"];
                string img   = context.Request["img"];
                int    qq    = Convert.ToInt32(context.Request["qq"]);
                int    phone = Convert.ToInt32(context.Request["phone"]);

                Model.user model_user = new Model.user()
                {
                    User_id    = id,
                    User_name  = name,
                    User_img   = img,
                    User_qq    = qq,
                    User_phone = phone,
                    User_pwd   = id.ToString()
                };
                BLL.user bll_user = new BLL.user();
                if (bll_user.Update(model_user) == true)
                {
                    context.Response.Write("修改成功");
                }
                else
                {
                    context.Response.Write("修改失败");
                }
            }
            //评论
            if (context.Request["page"] == "tell")
            {
                int               id        = Convert.ToInt32(context.Request["id"]);
                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((double)list_tell[i].Tell_userid);
                    list_tell[i].Tell_username = model_user.User_name;
                }
                System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
                string a = js.Serialize(list_tell);
                context.Response.Write(a);
            }
            //博客
            if (context.Request["page"] == "blog")
            {
                int                    id         = Convert.ToInt32(context.Request["id"]);
                string                 title      = context.Request["title"];
                string                 img        = context.Request["img"];
                int                    showis     = Convert.ToInt32(context.Request["showis"]);
                string                 time       = context.Request["time"];
                string                 typename   = context.Request["typename"];
                string                 text       = context.Request["text"];
                string                 abs        = context.Request["abs"];
                BLL.blog_type          bll_type   = new BLL.blog_type();
                List <Model.blog_type> list_type  = bll_type.GetModelList("Type_name='" + typename + "'");
                Model.blogs            model_blog = new Model.blogs()
                {
                    Blog_id       = id,
                    Blog_title    = title,
                    Blog_img      = img,
                    Blog_is       = showis,
                    Blog_time     = time,
                    Blog_typeid   = list_type[0].Type_id,
                    Blog_text     = text,
                    Blog_delete   = 0,
                    Blog_abstract = abs
                };
                BLL.blogs blogs    = new BLL.blogs();
                bool      blog_add = blogs.Update(model_blog);
                if (blog_add == true)
                {
                    context.Response.Write("修改成功");
                }
                else
                {
                    context.Response.Write("修改失败");
                }
            }

            //博客类型
            if (context.Request["page"] == "type")
            {
                int             id         = Convert.ToInt32(context.Request["id"]);
                string          type       = context.Request["type"];
                int             bai        = Convert.ToInt32(context.Request["bai"]);
                Model.blog_type model_type = new Model.blog_type()
                {
                    Type_id         = id,
                    Type_name       = type,
                    Type_percentage = bai
                };
                BLL.blog_type bll_type = new BLL.blog_type();
                bool          a        = bll_type.Update(model_type);
                if (a == true)
                {
                    context.Response.Write("修改成功");
                }
                else
                {
                    context.Response.Write("修改失败");
                }
            }
        }
Ejemplo n.º 5
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //图片
            if (context.Request["page"] == "img")
            {
                int       id        = Convert.ToInt32(context.Request["id"]);
                string    text      = context.Request["text"];
                string    img       = context.Request["img"];
                int       img_is    = Convert.ToInt32(context.Request["is"]);
                Model.img model_img = new Model.img()
                {
                    Img_id      = id,
                    Img_address = img,
                    Img_is      = img_is,
                    Img_text    = text
                };
                BLL.img bll_img = new BLL.img();
                if (bll_img.Add(model_img) == true)
                {
                    context.Response.Write("添加成功");
                }
                else
                {
                    context.Response.Write("添加失败");
                }
            }
            //用户
            if (context.Request["page"] == "user")
            {
                int        id         = Convert.ToInt32(context.Request["id"]);
                string     name       = context.Request["name"];
                string     img        = context.Request["img"];
                int        qq         = Convert.ToInt32(context.Request["qq"]);
                int        phone      = Convert.ToInt32(context.Request["phone"]);
                Model.user model_user = new Model.user()
                {
                    User_id    = id,
                    User_name  = name,
                    User_img   = img,
                    User_qq    = qq,
                    User_phone = phone,
                    User_pwd   = id.ToString()
                };
                BLL.user bll_user = new BLL.user();
                if (bll_user.Add(model_user) == true)
                {
                    context.Response.Write("添加成功");
                }
                else
                {
                    context.Response.Write("添加失败");
                }
            }
            //博客
            if (context.Request["page"] == "blog")
            {
                int                    id         = Convert.ToInt32(context.Request["id"]);
                string                 title      = context.Request["title"];
                string                 img        = context.Request["img"];
                int                    showis     = Convert.ToInt32(context.Request["showis"]);
                string                 time       = context.Request["time"];
                string                 typename   = context.Request["typename"];
                string                 text       = context.Request["text"];
                string                 abs        = context.Request["abstract"];
                BLL.blog_type          bll_type   = new BLL.blog_type();
                List <Model.blog_type> list_type  = bll_type.GetModelList("Type_name='" + typename + "'");
                Model.blogs            model_blog = new Model.blogs()
                {
                    Blog_id       = id,
                    Blog_title    = title,
                    Blog_img      = img,
                    Blog_is       = showis,
                    Blog_time     = time,
                    Blog_typeid   = list_type[0].Type_id,
                    Blog_abstract = abs,
                    Blog_text     = text,
                    Blog_delete   = 0
                };
                BLL.blogs blogs    = new BLL.blogs();
                bool      blog_add = blogs.Add(model_blog);
                if (blog_add == true)
                {
                    context.Response.Write("添加成功");
                }
                else
                {
                    context.Response.Write("添加失败");
                }
            }

            //博客类型
            if (context.Request["page"] == "type")
            {
                int             id         = Convert.ToInt32(context.Request["id"]);
                string          type       = context.Request["type"];
                int             bai        = Convert.ToInt32(context.Request["bai"]);
                Model.blog_type model_type = new Model.blog_type()
                {
                    Type_id         = id,
                    Type_name       = type,
                    Type_percentage = bai
                };
                BLL.blog_type bll_type = new BLL.blog_type();
                bool          is_type  = bll_type.Add(model_type);
                if (is_type == true)
                {
                    context.Response.Write("添加成功");
                }
                else
                {
                    context.Response.Write("添加失败");
                }
            }
        }
Ejemplo n.º 6
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int id = 0;

            //图片
            if (context.Request["page"] == "img")
            {
                id = Convert.ToInt32(context.Request["id"]);
                BLL.img bll_img = new BLL.img();
                if (bll_img.Delete(id) == true)
                {
                    context.Response.Write("删除成功");
                }
                else
                {
                    context.Response.Write("删除失败");
                }
            }
            //用户
            if (context.Request["page"] == "user")
            {
                id = Convert.ToInt32(context.Request["id"]);
                BLL.user bll_user = new BLL.user();
                if (bll_user.Delete(id) == true)
                {
                    context.Response.Write("删除成功");
                }
                else
                {
                    context.Response.Write("删除失败");
                }
            }
            //博客评论
            if (context.Request["page"] == "tell")
            {
                id = Convert.ToInt32(context.Request["id"]);
                BLL.tell bll_tell    = new BLL.tell();
                bool     tell_delete = bll_tell.Delete(id);
                if (tell_delete == true)
                {
                    context.Response.Write("删除成功");
                }
                else
                {
                    context.Response.Write("删除失败");
                }
            }
            //博客
            if (context.Request["page"] == "blog")
            {
                id = Convert.ToInt32(context.Request["id"]);
                BLL.blogs bll_blog    = new BLL.blogs();
                bool      blog_delete = bll_blog.Delete(id);
                if (blog_delete == true)
                {
                    context.Response.Write("删除成功");
                }
                else
                {
                    context.Response.Write("删除失败");
                }
            }
            //博客类型
            if (context.Request["page"] == "type")
            {
                id = Convert.ToInt32(context.Request["id"]);
                BLL.blog_type bll_type = new BLL.blog_type();
                bool          a        = bll_type.Delete(id);
                if (a == true)
                {
                    context.Response.Write("删除成功");
                }
                else
                {
                    context.Response.Write("删除失败");
                }
            }
        }