Esempio n. 1
0
        public JsonResult delcommentson(wenzhangpinglunson wps)
        {
            try
            {
                userinfo uif = new userinfo();
                uif.username = HttpContext.Request.Cookies["user"];
                uif.pwd      = HttpContext.Request.Cookies["key"];
                WenZhangBLL wz = new WenZhangBLL();
                uif = DataToEnity <userinfo> .DataRowToEntity(wz.Getuserinfo(uif).Rows[0]);

                CommentBLL cb = new CommentBLL();
                if (cb.iswenzhangzuoze(uif.id, wps.id))
                {
                    wps.pinglunrenid = uif.id;
                    return(Json(new { issuf = cb.delcommentson(wps) }));
                }
                else if (cb.isgaipinglunsonzuoze(uif.id, wps.id))
                {
                    wps.pinglunrenid = uif.id;
                    return(Json(new { issuf = cb.delcommentson(wps) }));
                }
                return(Json(new { issuf = false }));
            }
            catch
            {
                return(Json(new { issuf = true }));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 获取文章列表
        /// </summary>
        /// <returns></returns>

        public IActionResult wenzhanglist()
        {
            userinfo uif = new userinfo();

            uif.username = HttpContext.Request.Cookies["user"];
            uif.pwd      = HttpContext.Request.Cookies["key"];
            WenZhangBLL uib  = new WenZhangBLL();
            var         data = uib.Getuserinfo(uif);
            List <userwenzhangkuozhan> wenzhangleixinglist = new List <userwenzhangkuozhan>();

            if (data.Rows.Count == 1)
            {
                string leixing    = GetKeyValue("leixing");
                string keyword    = GetKeyValue("keyword");
                string qpagestart = GetKeyValue("page");
                ViewData["nowpage"] = 1;
                string qpagecount = GetKeyValue("pagecount");
                int    pagestart  = 0;
                int    pagecount  = 20;
                if (!string.IsNullOrEmpty(qpagestart) && !string.IsNullOrEmpty(qpagecount))
                {
                    pagestart           = Convert.ToInt32(qpagestart);
                    pagecount           = Convert.ToInt32(qpagecount);
                    ViewData["nowpage"] = pagestart + 1;
                }
                if (string.IsNullOrEmpty(leixing) || leixing == "-1")
                {
                    ViewData["leixing"] = "-1";
                    wenzhangleixinglist = uib.Getuserwenzhanglist(data.Rows[0]["id"].ToString(), leixing = "-1", keyword, pagestart, pagecount);
                }
                else
                {
                    ViewData["leixing"] = leixing;
                    wenzhangleixinglist = uib.Getuserwenzhanglist(data.Rows[0]["id"].ToString(), leixing, keyword, pagestart, pagecount);
                }
                ViewData["dat"] = wenzhangleixinglist;
                return(View());
            }
            else
            {
                wenzhangleixinglist.Add(new userwenzhangkuozhan()
                {
                    count = 0, toal = 0
                });
                ViewData["dat"] = wenzhangleixinglist;
                return(View());
            }
        }
Esempio n. 3
0
        public void OnActionExecuting(ActionExecutingContext context)
        {
            userinfo uif = new userinfo();

            uif.pwd      = context.HttpContext.Request.Cookies["key"];
            uif.username = context.HttpContext.Request.Cookies["user"];
            WenZhangBLL bLL = new WenZhangBLL();

            if (!bLL.islogin(uif))
            {
                context.HttpContext.Response.Redirect("/user/login");
            }
            else
            {
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 获取文章列表
        /// </summary>
        /// <returns></returns>

        public JsonResult wenzhanglist()
        {
            WenZhangBLL uib      = new WenZhangBLL();
            UserInfoBLL uifbll   = new UserInfoBLL();
            string      userName = GetKeyValue("username");
            var         userInfo = uifbll.GetThisUserNameInfo(userName);
            Result <List <userwenzhangkuozhan> > result = new Result <List <userwenzhangkuozhan> >();
            List <userwenzhangkuozhan>           wenzhangleixinglist = new List <userwenzhangkuozhan>();

            if (userInfo != null)
            {
                string leixing    = GetKeyValue("leixing");
                string keyword    = GetKeyValue("keyword");
                string qpagestart = GetKeyValue("page");
                //ViewData["nowpage"] = 1;
                string qpagecount = GetKeyValue("pagecount");
                int    pagestart  = 0;
                int    pagecount  = 20;
                if (!string.IsNullOrEmpty(qpagestart) && !string.IsNullOrEmpty(qpagecount))
                {
                    pagestart = Convert.ToInt32(qpagestart);
                    pagecount = Convert.ToInt32(qpagecount);
                    //ViewData["nowpage"] = pagestart + 1;
                }
                if (string.IsNullOrEmpty(leixing) || leixing == "-1")
                {
                    //ViewData["leixing"] = "-1";
                    wenzhangleixinglist = uib.Getuserwenzhanglist(userInfo.id.ToString(), leixing = "-1", keyword, pagestart, pagecount);
                }
                else
                {
                    //ViewData["leixing"] = leixing;
                    wenzhangleixinglist = uib.Getuserwenzhanglist(userInfo.id.ToString(), leixing, keyword, pagestart, pagecount);
                }
                result.content = wenzhangleixinglist;
                result.count   = wenzhangleixinglist.Count;
                result.issuf   = true;
                result.msg     = "";
            }
            else
            {
                result.count = 0;
                result.issuf = false;
                result.msg   = "用户不存在";
            }
            return(Json(result));
        }
Esempio n. 5
0
        public JsonResult info()
        {
            userinfo uif = new userinfo();

            uif.username = HttpContext.Request.Cookies["user"];
            uif.pwd      = HttpContext.Request.Cookies["key"];
            var data = new WenZhangBLL().Getuserinfo(uif);

            if (data.Rows.Count == 1)
            {
                return(Json(new { issuf = true, userinfo = data }));
            }
            else
            {
                return(Json(new { issuf = false, msg = "用户不存在" }));
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 创建评论条
        /// </summary>
        /// <param name="wzp"></param>
        /// <returns></returns>
        public JsonResult Addcomment(wenzhangpinglun wzp)
        {
            userinfo uif = new userinfo();

            uif.username = HttpContext.Request.Cookies["user"];
            uif.pwd      = HttpContext.Request.Cookies["key"];
            if (wzp.wenzhangid == 0 || wzp.pinglunneirong == null)
            {
                return(Json(new { msg = "操作出错" }));
            }
            if (string.IsNullOrEmpty(uif.username))
            {
                userinfo userinfo = new userinfo()
                {
                    id = 0, nicheng = "欠名", username = "******", touxiangurl = @"\images\header-img-comment_03.png"
                };
                wenzhangpinglun wenzhangpinglun = new CommentBLL().addWenZhangPingLun(wzp);
                return(Json(new { issuf = true, wenzhangpinglun, userinfo }));
            }
            else
            {
                WenZhangBLL uib     = new WenZhangBLL();
                var         uifdata = uib.Getuserinfo(uif);
                wzp.pinglunrenid = uifdata.Rows.Count != 0 ? Convert.ToInt32(uifdata.Rows[0]["id"]) : 0;
                if (wzp.pinglunrenid == 0)
                {
                    return(Json(new { msg = "非法登陆,评论失败" }));
                }
                else
                {
                    var userinfo = DataToEnity <userinfo> .DataRowToEntity(uifdata.Rows[0]);

                    if (userinfo.touxiangurl == null)
                    {
                        userinfo.touxiangurl = @"\images\header-img-comment_03.png";
                    }
                    if (userinfo.nicheng == null || userinfo.nicheng == "")
                    {
                        userinfo.nicheng = "未设置昵称";
                    }
                    wenzhangpinglun wenzhangpinglun = new CommentBLL().addWenZhangPingLun(wzp);
                    return(Json(new { issuf = true, wenzhangpinglun, userinfo }));
                }
            }
        }
Esempio n. 7
0
        /// <summary>
        /// 添加文章类型
        /// </summary>
        /// <param name="uwz"></param>
        /// <returns></returns>
        public JsonResult addleixing(userwenzhangleixing uwz)
        {
            userinfo uif = new userinfo();

            uif.username = HttpContext.Request.Cookies["user"];
            uif.pwd      = HttpContext.Request.Cookies["key"];
            WenZhangBLL uib         = new WenZhangBLL();
            var         data        = uib.Getuserinfo(uif);
            string      leixingming = uwz.leixingming;

            if (string.IsNullOrEmpty(leixingming) && data.Rows.Count != 1)
            {
                return(Json(new { issuf = false }));
            }
            else
            {
                return(Json(new { issuf = uib.addleixing(data.Rows[0]["id"].ToString(), leixingming) }));
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 文章详细页面
        /// </summary>
        /// <returns></returns>
        public JsonResult getwenzhangdtl()
        {
            userinfo uif = new userinfo();

            uif.username = HttpContext.Request.Cookies["user"];
            uif.pwd      = HttpContext.Request.Cookies["key"];
            WenZhangBLL uib        = new WenZhangBLL();
            var         data       = uib.Getuserinfo(uif);
            string      wenzhangid = GetKeyValue("id");

            if (string.IsNullOrEmpty(wenzhangid) && data.Rows.Count != 1)
            {
                return(Json(new { issuf = false }));
            }
            else
            {
                return(Json(new { issuf = true, dtl = uib.GetUserwenzhang(data.Rows[0]["id"].ToString(), wenzhangid) }));
            }
        }
Esempio n. 9
0
        public JsonResult islogin(userinfo uif)
        {
            WenZhangBLL uib = new WenZhangBLL();

            uif.pwd = jiami.Encrypt(uif.pwd);
            var data = uib.islogin(uif);

            if (data)
            {
                HttpContext.Response.Cookies.Append("key", uif.pwd);
                HttpContext.Response.Cookies.Append("user", uif.username);
                string backurl = HttpContext.Request.Cookies["backurl"];

                return(Json(new { issuf = true, msg = "登陆成功", backurl = backurl }));
            }
            else
            {
                return(Json(new { issuf = false, msg = "登陆失败" }));
            }
        }
Esempio n. 10
0
        public JsonResult editwenzhang(userwenzhang uwz)
        {
            userinfo uif = new userinfo();

            uif.username = HttpContext.Request.Cookies["user"];
            uif.pwd      = HttpContext.Request.Cookies["key"];
            WenZhangBLL uib  = new WenZhangBLL();
            var         data = uib.Getuserinfo(uif);

            uwz.userid = data.Rows.Count != 0 ? Convert.ToInt32(data.Rows[0]["id"]) : 0;
            if (string.IsNullOrEmpty(uwz.content) && string.IsNullOrEmpty(uwz.content100) && string.IsNullOrEmpty(uwz.wenzhangname) && uwz.id == 0)
            {
                return(Json(new { issuf = false, msg = "参数错误" }));
            }
            else
            {
                Result <userwenzhang> result = uib.editwenzhang(uwz, serverPath);
                return(Json(new { result }));
            }
        }
Esempio n. 11
0
        public JsonResult delwenzhang(userwenzhang uwz)
        {
            userinfo uif = new userinfo();

            uif.username = HttpContext.Request.Cookies["user"];
            uif.pwd      = HttpContext.Request.Cookies["key"];
            WenZhangBLL uib  = new WenZhangBLL();
            var         data = uib.Getuserinfo(uif);

            uwz.userid = data.Rows.Count != 0 ? Convert.ToInt32(data.Rows[0]["id"]) : 0;
            if (uwz.userid == 0 || uwz.id == 0)
            {
                return(Json(new { msg = "你是傻子吧" }));
            }
            else
            {
                Result <userwenzhang> result = uib.delwenzhang(uwz);
                return(Json(new { result }));
            }
        }
Esempio n. 12
0
        /// <summary>
        /// 获取文章类型
        /// </summary>
        /// <returns></returns>
        public JsonResult wenzhangleixing()
        {
            userinfo uif = new userinfo();

            uif.username = HttpContext.Request.Cookies["user"];
            uif.pwd      = HttpContext.Request.Cookies["key"];
            WenZhangBLL uib  = new WenZhangBLL();
            var         data = uib.Getuserinfo(uif);

            if (data.Rows.Count == 1)
            {
                var wenzhangleixinglist = uib.Getuserwenzhang(data.Rows[0]["id"].ToString());
                var count = wenzhangleixinglist.Count;
                return(Json(new { issuf = true, wenzhangleixing = wenzhangleixinglist, count = count }));
            }
            else
            {
                return(Json(new { issuf = false, backurl = "/user/login" }));
            }
        }
Esempio n. 13
0
        public IActionResult Index()
        {
            var userName = Request.PathBase.Value.Trim('/').ToLower();
            var leixing  = GetKeyValue("leixing");

            ViewBag.leixing = leixing;
            UserInfoBLL uif    = new UserInfoBLL();
            var         uiInfo = uif.GetThisUserNameInfo(userName);

            if (uiInfo != null)
            {
                Response.StatusCode = 200;
                ViewBag.userInfo    = uiInfo;
                WenZhangBLL wzb = new WenZhangBLL();
                ViewBag.userWenZhangType = wzb.Getuserwenzhang(uiInfo.id.ToString());
            }
            else
            {
                Response.StatusCode = 404;
                return(View("/Views/boke/test404.cshtml"));
            }
            return(View());
        }
Esempio n. 14
0
        public IActionResult wenzhangdetl()
        {
            var pathList = Request.PathBase.Value.Trim('/').ToLower().Split(new char[] { '/', '\\' });

            if (pathList.Length != 3 || pathList[1] != "wenzhang")
            {
                Response.StatusCode = 404;
                return(View("/Views/boke/test404.cshtml"));
            }
            var         userName = pathList[0];
            UserInfoBLL uif      = new UserInfoBLL();
            var         uiInfo   = uif.GetThisUserNameInfo(userName);

            if (uiInfo != null)
            {
                Response.StatusCode = 200;
                ViewBag.userInfo    = uiInfo;
                WenZhangBLL wzb = new WenZhangBLL();
                ViewBag.userWenZhangType = wzb.Getuserwenzhang(uiInfo.id.ToString());
                var wenzhangdtl = wzb.GetUserwenzhangText(uiInfo.id.ToString(), pathList[2]);
                if (wenzhangdtl == null)
                {
                    Response.StatusCode = 404;
                    return(View("/Views/boke/test404.cshtml"));
                }
                else
                {
                    ViewBag.wenzhangdtl = wenzhangdtl;
                }
            }
            else
            {
                Response.StatusCode = 404;
                return(View("/Views/boke/test404.cshtml"));
            }
            return(View());
        }