Example #1
0
        public void ProcessRequest(HttpContext context)
        {
            Guid id = Guid.Empty;

            if (!string.IsNullOrEmpty(context.Request.QueryString["ID"]))
            {
                id = new Guid(context.Request.QueryString["ID"]);
            }

            UCHomeEntities   uc = new UCHomeEntities();
            UCHome_PersonNew pn = uc.UCHome_PersonNew.SingleOrDefault(u => u.PKID == id);

            if (pn != null)
            {
                pn.flowers = pn.flowers + 1;
            }
            try
            {
                uc.SaveChanges();
                context.Response.ContentType = "text/plain";
                context.Response.Write(true);
            }
            catch (Exception)
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write(false);
            }
        }
Example #2
0
        public ActionResult LogView2(Guid pid, string uctype, Guid userid)
        {
            UCHome_PersonNew ucpn     = uc.UCHome_PersonNew.SingleOrDefault(u => u.PKID == pid);
            UCHome_PersonNew nextucpn =
                uc.UCHome_PersonNew.Where(u => u.DeployTime < ucpn.DeployTime && u.UCType == uctype && u.AddUser == userid && u.IsShow == 1)
                .OrderByDescending(u => u.DeployTime)
                .FirstOrDefault();
            UCHome_PersonNew lastucpn =
                uc.UCHome_PersonNew.Where(u => u.DeployTime > ucpn.DeployTime && u.UCType == uctype && u.AddUser == userid && u.IsShow == 1)
                .OrderBy(u => u.DeployTime)
                .FirstOrDefault();

            ViewBag.NextArticle = nextucpn;
            ViewBag.LastArticle = lastucpn;
            ViewBag.LoginId     = userid;
            try
            {
                var             newClient = new JsonServiceClient(http + "/SNSApi/");
                SNSFeedEntryDto article   = newClient.Get(new GetSNSFeed
                {
                    ObjectID = pid.ToString()
                });
                //Regex regex = new Regex(@"<[^>]+>|</[^>]+>");
                ViewBag.Article = article;
            }
            catch (Exception)
            {
                ViewBag.Article = new SNSFeedEntryDto();
            }
            return(PartialView("LogView2", ucpn));
        }
Example #3
0
        public ActionResult AddMessage2(FormCollection form)
        {
            Guid uid = new Guid(form["AddUser"]);
            //获取登录帐号
            Guid       msguid  = userid;
            JsonResult Newjson = new JsonResult();

            if (msguid != Guid.Empty)
            {
                UCHome_Leave pn = new UCHome_Leave
                {
                    PKID          = Guid.NewGuid(),
                    Contents      = form["Contents"],
                    AcceptUserID  = uid,
                    MessageUserID = msguid,
                    EditDate      = DateTime.Now,
                    isshow        = 1,
                    msgtype       = "message",
                    flowers       = 0
                };

                try
                {
                    uc.UCHome_Leave.AddObject(pn);
                    uc.SaveChanges();
                    UCHome_PersonNew pn2 = new UCHome_PersonNew
                    {
                        PKID       = Guid.NewGuid(),
                        AddUser    = pn.AcceptUserID,
                        UCType     = "static",
                        Title      = "留言板更新",
                        Abstract   = string.Format("有新的留言【{0}】({1})", "留言", pn.EditDate),
                        Content    = pn.PKID.ToString(),
                        DeployTime = pn.EditDate,
                        IsShare    = "9",
                        IsShow     = 1,
                        IsAudit    = 0,
                        WriteFrom  = "message"
                    };
                    uc.UCHome_PersonNew.AddObject(pn2);
                    uc.SaveChanges();
                    Newjson.Data = new { statuscode = 0, message = "添加成功" };
                }
                catch (Exception)
                {
                    Newjson.Data = new { statuscode = 1, message = "添加失败" };
                }
            }
            else
            {
                Newjson.Data = new { statuscode = 1, message = "添加失败,检测未登录" };
            }
            return(Json(Newjson, JsonRequestBehavior.AllowGet));
        }
Example #4
0
        public ActionResult AddMessage(FormCollection form)
        {
            Guid         uid     = new Guid(form["AddUser"]);
            UCHome_Leave pn      = uc.UCHome_Leave.SingleOrDefault(m => m.msgtype == "master" && m.AcceptUserID == uid && m.MessageUserID == uid);
            bool         isexist = true;

            if (pn == null)
            {
                isexist = false;
                pn      = new UCHome_Leave();
            }
            pn.Contents      = form["Contents"];
            pn.AcceptUserID  = uid;
            pn.MessageUserID = uid;
            pn.EditDate      = DateTime.Now;
            pn.isshow        = 1;
            pn.msgtype       = "master";
            pn.flowers       = 0;

            JsonResult Newjson = new JsonResult();

            try
            {
                if (!isexist)
                {
                    pn.PKID = Guid.NewGuid();
                    uc.UCHome_Leave.AddObject(pn);
                }
                uc.SaveChanges();
                UCHome_PersonNew pn2 = new UCHome_PersonNew
                {
                    PKID       = Guid.NewGuid(),
                    AddUser    = pn.MessageUserID,
                    UCType     = "static",
                    Title      = "留言板更新",
                    Abstract   = string.Format("更新了留言板【{0}】({1})", "新寄语", pn.EditDate),
                    Content    = pn.PKID.ToString(),
                    DeployTime = pn.EditDate,
                    IsShare    = "9",
                    IsShow     = 1,
                    IsAudit    = 0,
                    WriteFrom  = "message"
                };
                uc.UCHome_PersonNew.AddObject(pn2);
                uc.SaveChanges();
                Newjson.Data = new { statuscode = 0, message = "添加成功" };
            }
            catch (Exception)
            {
                Newjson.Data = new { statuscode = 1, message = "添加失败" };
            }
            return(Json(Newjson, JsonRequestBehavior.AllowGet));
        }
Example #5
0
        public void ProcessRequest(HttpContext context)
        {
            Guid pid = Guid.Empty;

            if (!string.IsNullOrEmpty(context.Request["pid"]))
            {
                pid = new Guid(context.Request["pid"]);
            }
            string uctype = string.Empty;

            if (!string.IsNullOrEmpty(context.Request["uctype"]))
            {
                uctype = context.Request["uctype"];
            }
            //isshare
            string isshare = string.Empty;

            if (!string.IsNullOrEmpty(context.Request["isshare"]))
            {
                isshare = context.Request["isshare"];
            }
            UCHomeEntities   uc     = new UCHomeEntities();
            UCHome_PersonNew uchome = uc.UCHome_PersonNew.SingleOrDefault(n => n.PKID == pid);

            if (uchome != null)
            {
                if (!string.IsNullOrEmpty(uctype))
                {
                    uchome.UCType = uctype;
                }
                if (!string.IsNullOrEmpty(isshare))
                {
                    uchome.IsShare = isshare;
                }
                uc.SaveChanges();
                context.Response.ContentType = "text/plain";
                context.Response.Write("200");
            }
            else
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write("404");
            }
        }
Example #6
0
        private LogInfo GetLogInfoBySelf(Guid pid)
        {
            UCHomeEntities   uc   = new UCHomeEntities();
            UCHome_PersonNew item = uc.UCHome_PersonNew.SingleOrDefault(u => u.PKID == pid);
            LogInfo          log  = new LogInfo();

            if (item != null)
            {
                log.pkid        = item.PKID;
                log.logtitle    = item.Title;
                log.logabstract = item.Abstract;
                log.logdate     = item.DeployTime;
                log.loghits     = item.Hits;
                log.logisaudit  = EnumConvert.ConvertAudit(item.IsAudit);
                log.logisshare  = EnumConvert.ConvertShare(item.IsShare);
                log.logisshow   = EnumConvert.ConvertShow(item.IsShow);
                log.loguser     = item.AddUser;
            }
            return(log);
        }
Example #7
0
        public void ProcessRequest(HttpContext context)
        {
            string http = System.Web.Configuration.WebConfigurationManager.AppSettings["APIHttp"];

            IServiceClient client = new JsonServiceClient(http + "/SNSApi/");
            // IServiceClient client = new JsonServiceClient("http://education.istudy.sh.cn/SNSApi/");
            Guid   id      = Guid.Empty;
            string content = string.Empty;

            if (!string.IsNullOrEmpty(context.Request.QueryString["ID"]))
            {
                id = new Guid(context.Request.QueryString["ID"]);
            }
            if (!string.IsNullOrEmpty(context.Request.QueryString["Content"]))
            {
                content = HttpUtility.UrlDecode(context.Request.QueryString["Content"]);
            }


            UCHome_PersonNew pn = new UCHome_PersonNew();

            pn.AddUser    = id;
            pn.DeployTime = DateTime.Now;
            pn.Content    = content;
            pn.Hits       = 0;
            pn.PKID       = Guid.NewGuid();
            pn.Title      = content;
            pn.UCType     = "New";
            pn.IsShare    = "9";
            pn.IsAudit    = 0;
            pn.isTop      = 0;
            pn.IsShow     = 1;
            pn.flowers    = 0;
            UCHomeEntities uc = new UCHomeEntities();
            string         Newjson;

            try
            {
                uc.UCHome_PersonNew.AddObject(pn);
                uc.SaveChanges();
                UCHome_PersonNew pn2 = new UCHome_PersonNew();
                pn2.PKID       = Guid.NewGuid();
                pn2.AddUser    = pn.AddUser;
                pn2.UCType     = "static";
                pn2.Title      = "说说更新";
                pn2.Abstract   = string.Format("发表了新说说【{0}】({1})", pn.Title, pn.DeployTime);
                pn2.Content    = pn.Content;
                pn2.DeployTime = pn.DeployTime;
                pn2.IsShare    = pn.IsShare;
                pn2.IsShow     = 1;
                pn2.IsAudit    = 0;
                pn2.WriteFrom  = pn.UCType;
                pn2.flowers    = 0;
                uc.UCHome_PersonNew.AddObject(pn2);
                uc.SaveChanges();
                Newjson = "true";
                AddSNSFeedEntry feed = new AddSNSFeedEntry
                {
                    ObjectType = "说说",
                    ObjectID   = pn2.PKID.ToString(),
                    UID        = pn.AddUser.ToString(),
                    UName      = DisPlayName,
                    School     = XXMC,
                    Title      = "说说更新",
                    Summary    = pn.Content,
                    Date       = DateTime.Now,
                    //URL = "http://www.baidu.com",
                    Like     = 0,
                    Favorite = 0
                };
                client.Send <AddSNSFeedEntry>(feed);
            }
            catch (Exception ex)
            {
                Newjson = "false";
            }


            Newjson = string.Format("[{{ result:{0}}}]", Newjson);
            context.Response.ContentType = "text/plain";
            context.Response.Write(Newjson);
        }
Example #8
0
        public ActionResult LogEdit(Guid id, Guid pid)
        {
            UCHome_PersonNew loginfo = uc.UCHome_PersonNew.SingleOrDefault(l => l.PKID == pid);

            return(PartialView("LogEdit", loginfo));
        }
Example #9
0
        public ActionResult EditLog(FormCollection form, Guid PKID)
        {
            JsonResult       Newjson = new JsonResult();
            UCHome_PersonNew pn      = uc.UCHome_PersonNew.SingleOrDefault(l => l.PKID == PKID);

            if (pn != null)
            {
                pn.AddUser    = new Guid(form["AddUser"]);
                pn.DeployTime = DateTime.Now;
                pn.Content    = form["Content"];
                pn.Title      = form["Title"];
                pn.UCType     = form["UCType"];
                pn.IsShare    = form["IsShare"];
                pn.Abstract   = form["Abstract"];
                pn.IsShow     = form["IsShow"].ToLower().Contains("true") ? 0 : 1;
                try
                {
                    uc.SaveChanges();
                    //UCHome_PersonNew pn2 = new UCHome_PersonNew();
                    //pn2.PKID = Guid.NewGuid();
                    //pn2.AddUser = pn.AddUser;
                    //pn2.UCType = "static";
                    //pn2.Title = "文章更新";
                    //pn2.Abstract = string.Format("更新了文章【{0}】({1})", pn.Title, pn.DeployTime);
                    //pn2.Content = pn.PKID.ToString();
                    //pn2.DeployTime = pn.DeployTime;
                    //pn2.IsShare = pn.IsShare;
                    //pn2.IsShow = pn.IsShow;
                    //pn2.IsAudit = 0;
                    //pn2.WriteFrom = pn.UCType;
                    //uc.UCHome_PersonNew.AddObject(pn2);
                    //uc.SaveChanges();
                    if (pn.IsShare != "0" && pn.UCType != "log")
                    {
                        AddSNSFeedEntry feed = new AddSNSFeedEntry
                        {
                            ObjectType = "文章日志",
                            ObjectID   = pn.PKID.ToString(),
                            UID        = pn.AddUser.ToString(),
                            UName      = DisPlayName,
                            School     = XXMC,
                            Title      = form["Title"],
                            Summary    = pn.Content,
                            Date       = DateTime.Now,
                            URL        = "/UCHome/PublicShare/logview2?pid=" + pn.PKID + "&uctype=article&userid=" + pn.AddUser + "",
                            Like       = 0,
                            Favorite   = 0
                        };
                        client.Send <AddSNSFeedEntry>(feed);
                    }
                    Newjson.Data = new { statuscode = 0, message = "更新成功" };
                }
                catch (Exception)
                {
                    Newjson.Data = new { statuscode = 1, message = "更新失败" };
                }
            }
            else
            {
                Newjson.Data = new { statuscode = 2, message = "日志不存在" };
            }
            return(Json(Newjson, JsonRequestBehavior.AllowGet));
        }
Example #10
0
        public ActionResult AddLog(FormCollection form)
        {
            UCHome_PersonNew pn = new UCHome_PersonNew
            {
                AddUser    = new Guid(form["AddUser"]),
                DeployTime = DateTime.Now,
                Content    = form["Content"],
                Hits       = 0,
                PKID       = Guid.NewGuid(),
                Title      = form["Title"],
                UCType     = form["UCType"],
                IsShare    = form["IsShare"],
                IsAudit    = 4,
                isTop      = 0,
                IsShow     = form["IsShow"].ToLower().Contains("true") ? 0 : 1,
                Abstract   = form["Abstract"],
                flowers    = 0
            };
            JsonResult Newjson = new JsonResult();

            try
            {
                uc.UCHome_PersonNew.AddObject(pn);
                uc.SaveChanges();
                UCHome_PersonNew pn2 = new UCHome_PersonNew
                {
                    PKID       = Guid.NewGuid(),
                    AddUser    = pn.AddUser,
                    UCType     = "static",
                    Title      = "文章更新",
                    Abstract   = string.Format("发表了新文章【{0}】({1})", pn.Title, pn.DeployTime),
                    Content    = pn.PKID.ToString(),
                    DeployTime = pn.DeployTime,
                    IsShare    = pn.IsShare,
                    IsShow     = pn.IsShow,
                    IsAudit    = 0,
                    WriteFrom  = pn.UCType
                };
                uc.UCHome_PersonNew.AddObject(pn2);
                uc.SaveChanges();
                if (pn.IsShare != "0" && pn.UCType != "log")
                {
                    AddSNSFeedEntry feed = new AddSNSFeedEntry
                    {
                        ObjectType = "文章日志",
                        ObjectID   = pn.PKID.ToString(),
                        UID        = pn.AddUser.ToString(),
                        UName      = DisPlayName,
                        School     = XXMC,
                        Title      = form["Title"],
                        Summary    = pn.Content,
                        Date       = DateTime.Now,
                        URL        = "/UCHome/PublicShare/logview2?pid=" + pn.PKID + "&uctype=article&userid=" + pn.AddUser + "",
                        Like       = 0,
                        Favorite   = 0
                    };
                    client.Send <AddSNSFeedEntry>(feed);
                }
                Newjson.Data = new { statuscode = 0, message = "添加成功" };
            }
            catch (Exception)
            {
                Newjson.Data = new { statuscode = 1, message = "添加失败" };
            }
            return(Json(Newjson, JsonRequestBehavior.AllowGet));
        }