Esempio n. 1
0
        /// <summary>
        /// 1获取话题(pubtopic)信息
        /// </summary>
        /// <param name="notice"></param>
        /// <returns></returns>
        private string GetTopicInfo(CY.UME.Core.Business.Notice notice, out bool isCut)
        {
            isCut = false;
            string result = String.Empty;

            CY.UME.Core.Business.Account author;

            if (notice.InstanceId.Length < 1)
            {
                return result;
            }

            author = CY.UME.Core.Business.Account.Load(notice.AuthorId);
            if (author == null)
            {
                return result;
            }

            Guid topicId = new Guid(notice.InstanceId);

            CY.UME.Core.Business.Topic topic = CY.UME.Core.Business.Topic.Load(topicId);
            if (topic == null)
            {
                notice.DeleteOnSave();
                notice.Save();

                return result;
            }
            CY.UME.Core.Business.TopicExtend te = CY.UME.Core.Business.TopicExtend.Load(topicId);

            if (te == null)
            {
                notice.DeleteOnSave();
                notice.Save();

                return result;
            }

            int groupId = 0;
            if (!int.TryParse(te.InstanceId, out groupId))
            {
                notice.DeleteOnSave();
                notice.Save();

                return result;
            }

            CY.UME.Core.Business.Group group = CY.UME.Core.Business.Group.Load(groupId);

            if (group == null)
            {
                notice.DeleteOnSave();
                notice.Save();

                return result;
            }

            StringBuilder sb = new StringBuilder();

            sb.Append("{id:'");
            sb.Append(notice.Id);
            sb.Append("', authorId:");
            sb.Append(notice.AuthorId);
            sb.Append(", accountId:");
            sb.Append(notice.AccountId);
            sb.Append(", authorName:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(author.Name));
            sb.Append(",content: ");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(notice.Content));//.Replace(currentAccount.Name, "我")
            sb.Append(",type:'");
            sb.Append(notice.Type);
            sb.Append("',topicId:'");
            sb.Append(topicId);
            sb.Append("',topicName:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(CY.Utility.Common.StringUtility.CutString(topic.Title, 30, "...")));

            string strContent = topic.Content.Replace("\r\n", "");
            strContent = CY.Utility.Common.StringUtility.NoHTML(strContent);
            strContent = System.Web.HttpContext.Current.Server.HtmlDecode(strContent);
            strContent = strContent.Replace("&nbsp;", " ");
            strContent = strContent.Replace("\r\n", "");

            strContent = CY.Utility.Common.StringUtility.CutString(strContent.Trim(), 400, "...");
            strContent = strContent.Replace("&", "&amp;");

            sb.Append(",topicContent:" + CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(strContent));
            sb.Append(",topicDate:'" + CY.Utility.Common.StringUtility.getDateDifference(topic.DateCreated));
            sb.Append("',groupId:" + groupId);
            sb.Append(",groupName:" + CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(group.Name));
            sb.Append(",ReplyNum:" + topic.ReplyNum);
            sb.Append("},");

            result = sb.ToString();

            isCut = true;
            return result;
        }
Esempio n. 2
0
        /// <summary>
        /// 7获取友情小组(relativegroup)信息
        /// </summary>
        /// <param name="notice"></param>
        /// <returns></returns>
        private string GetRelativeGroupInfo(CY.UME.Core.Business.Notice notice, out bool isCut)
        {
            isCut = false;
            string result = String.Empty;

            StringBuilder sb = new StringBuilder();

            CY.UME.Core.Business.Account author;

            if (notice.InstanceId.Length < 1)
            {
                return result;
            }

            author = CY.UME.Core.Business.Account.Load(notice.AuthorId);
            if (author == null)
            {
                return result;
            }

            Guid RelativeGroupId = new Guid();

            if (!Guid.TryParse(notice.InstanceId, out RelativeGroupId))
            {
                notice.DeleteOnSave();
                notice.Save();

                return result;
            }

            CY.UME.Core.Business.RelativeGroup re = CY.UME.Core.Business.RelativeGroup.Load(RelativeGroupId);

            if (re == null)
            {
                notice.DeleteOnSave();
                notice.Save();

                return result;
            }

            CY.UME.Core.Business.Group MyGroup = CY.UME.Core.Business.Group.Load(re.GroupId);//作者的小组
            CY.UME.Core.Business.Group RelativeGroup = CY.UME.Core.Business.Group.Load(re.RelativeGroupId);//作者的有情小组

            if (MyGroup == null || RelativeGroup == null)
            {
                notice.DeleteOnSave();
                notice.Save();

                return result;
            }

            sb.Append("{id:'");
            sb.Append(notice.Id);
            sb.Append("', authorId:'");
            sb.Append(notice.AuthorId);
            sb.Append("', accountId:'");
            sb.Append(notice.AccountId);
            sb.Append("', authorName:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(author.Name));
            sb.Append(",content:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(notice.Content));
            sb.Append(",type:'");
            sb.Append(notice.Type);
            //群组信息
            sb.Append("',Date:'");
            sb.Append(CY.Utility.Common.StringUtility.getDateDifference(notice.DateCreated));
            sb.Append("',myGroupId:'" + MyGroup.Id);
            sb.Append("',myGroupName:'" + MyGroup.Name);
            sb.Append("',relativeGroupId:'" + RelativeGroup.Id);
            sb.Append("',relativeGroupName:'" + CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(RelativeGroup.Name));
            sb.Append("'},");

            isCut = true;
            return sb.ToString();
        }
Esempio n. 3
0
        /// <summary>
        /// 4获取单个(miniblog)信息
        /// </summary>
        /// <param name="notice"></param>
        /// <returns></returns>
        private string GetMiniBlogInfo(CY.UME.Core.Business.Notice notice, out bool isCut)
        {
            isCut = false;
            string result = String.Empty;
            StringBuilder sb = new StringBuilder();
            CY.UME.Core.Business.Account author;
            CY.UME.Core.Business.MiniBlog miniBlog;

            long miniblogId = 0;

            if (!CY.Utility.Common.ParseUtility.TryParseInt64(notice.InstanceId, out miniblogId))
            {
                return result;
            }
            else
            {
                if (miniblogId < 1) { return result; }
                else
                {
                    miniBlog = CY.UME.Core.Business.MiniBlog.Load(miniblogId);
                }
            }

            if (miniBlog == null)
            {
                notice.DeleteOnSave();
                notice.Save();

                return result;
            }

            author = CY.UME.Core.Business.Account.Load(notice.AuthorId);
            if (author == null)
            {
                return result;
            }

            CY.UME.Core.Business.MiniBlogExtend mbe = CY.UME.Core.Business.MiniBlogExtend.Load(miniblogId);

            bool IsPhoneSended = false;
            string picurl = String.Empty;
            string video = String.Empty;
            StringBuilder Refereds = new StringBuilder();

            Refereds.Append("{");
            if (mbe != null)
            {
                IsPhoneSended = mbe.IsPhoneSended;
                picurl = mbe.ImgPath;
                video = mbe.Video;
                if (mbe.ReferedId > 0)
                {
                    CY.UME.Core.Business.MiniBlogExtend mbeTemp = CY.UME.Core.Business.MiniBlogExtend.Load(mbe.ReferedId);
                    string name = mbe.ReferedName;
                    long id = mbe.ReferedAuthorId;
                    bool check = true;
                    long orMiniBlogId = mbe.ReferedId;
                    string orMiniBlogContent = String.Empty;
                    int orTraNum = 0;
                    int i = 0;

                    CY.UME.Core.Business.MiniBlog orMbTemp = CY.UME.Core.Business.MiniBlog.Load(mbeTemp.Id);

                    if (orMbTemp != null) orMiniBlogContent = orMbTemp.Content;//叫你们要判空,老是记不住!2010-05-11 11:17

                    Refereds.Append("TraInfo:[ ");
                    while (check)
                    {
                        if (i < 10)
                        {
                            Refereds.Append("{");
                            Refereds.Append("AccountId:" + id);
                            Refereds.Append(",Name:'" + (notice.AccountId == id ? "我" : name) + "'");
                            Refereds.Append(",MiniBlogId:" + orMiniBlogId);
                            Refereds.Append(",MiniBlogContent:" + Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(orMiniBlogContent));
                            Refereds.Append("},");
                        }

                        i++;

                        if (mbeTemp == null)
                        {
                            check = false;
                            orTraNum = CY.UME.Core.Business.MiniBlogExtend.GetMiniBlogTransferNum(orMiniBlogId);
                        }
                        else
                        {
                            if (mbeTemp.ReferedId == 0)
                            {
                                check = false;
                                orTraNum = mbeTemp.TransferedNum;
                            }
                            else
                            {
                                id = mbeTemp.ReferedAuthorId;
                                name = mbeTemp.ReferedName;
                                orMiniBlogId = mbeTemp.ReferedId;

                                CY.UME.Core.Business.MiniBlog orMiniBlog = CY.UME.Core.Business.MiniBlog.Load(orMiniBlogId);

                                orMiniBlogContent = orMiniBlog == null ? "" : orMiniBlog.Content;

                                mbeTemp = CY.UME.Core.Business.MiniBlogExtend.Load(mbeTemp.ReferedId);
                            }
                        }
                    }
                    Refereds.Remove(Refereds.Length - 1, 1);
                    Refereds.Append("]");
                    Refereds.Append(",Id:" + orMiniBlogId);
                    Refereds.Append(",TrasNum:" + orTraNum);
                }
            }
            Refereds.Append("}");

            sb.Append("{id:");
            sb.Append(notice.Id);
            sb.Append(",type:'" + notice.Type);
            sb.Append("',authorId:");
            sb.Append(notice.AuthorId);
            sb.Append(",authorName:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(author.Id == notice.AccountId ? "我" : author.Name));
            sb.Append(",content:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(notice.Content));
            sb.Append(",miniBlogId:");
            sb.Append(miniblogId);
            sb.Append(",miniBlogContent:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(miniBlog.Content));
            sb.Append(",miniBlogPubDate:'");
            sb.Append(CY.Utility.Common.StringUtility.getDateDifference(miniBlog.DatePublish));
            sb.Append("',Refereds:" + Refereds.ToString());
            sb.Append(",TrasNum:" + (mbe == null ? "0" : mbe.TransferedNum.ToString()));
            sb.Append(",ReplyNum:" + miniBlog.GetCommentCount());
            sb.Append(",IsPhoneSended:" + (IsPhoneSended ? "1" : "0"));
            sb.Append(",picUrl:'" + picurl + "'");
            sb.Append(",video:'" + video + "'");
            sb.Append("},");
            const string aabc = "<table border = 0 cellpadding=0 cellspacing=0><tr><td></td>{0}</tr></table>";
            String title = "";
            String.Format(aabc, title);
            result = sb.ToString();

            isCut = true;
            return result;
        }
Esempio n. 4
0
        /// <summary>
        /// 2获取单个图片(picture)信息
        /// </summary>
        /// <param name="notice"></param>
        /// <returns></returns>
        private string GetPictureInfo(CY.UME.Core.Business.Notice notice, out bool isCut)
        {
            isCut = false;
            string result = String.Empty;
            StringBuilder sb = new StringBuilder();
            CY.UME.Core.Business.Account author;
            CY.UME.Core.Business.Picture pic;
            CY.UME.Core.Business.Album album;
            long picId = 0;

            author = CY.UME.Core.Business.Account.Load(notice.AuthorId);
            if (author == null)
            {
                return result;
            }

            sb.Append("{id:");
            sb.Append(notice.Id);
            sb.Append(",type:'" + notice.Type);
            sb.Append("',authorId:");
            sb.Append(notice.AuthorId);
            sb.Append(",authorName:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(author.Name));
            sb.Append(",content:" + CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(notice.Content));

            string[] arrayInstanceId = notice.InstanceId.Split(',');

            if (!long.TryParse(arrayInstanceId[0], out picId))
            {
                return result;
            }
            else
            {
                if (picId < 1) { return result; }
                else
                {
                    pic = CY.UME.Core.Business.Picture.Load(picId);
                }
            }

            if (pic == null)
            {
                notice.DeleteOnSave();
                notice.Save();

                return result;
            }

            album = CY.UME.Core.Business.Album.Load(pic.AlbumId);
            if (album == null)
            {
                return result;
            }

            sb.Append(",albumName:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(album.Name));
            sb.Append(",albumId:");
            sb.Append(album.Id);

            sb.Append(",Pictures:[");
            sb.Append("{picName:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(pic.Name));
            sb.Append(",pictureId:");
            sb.Append(picId);
            sb.Append(",picDate:'");
            sb.Append(CY.Utility.Common.StringUtility.getDateDifference(pic.DateCreated));
            sb.Append("',ReplyNum:" + pic.ReplyNum);
            sb.Append("}");

            for (int i = 1; i < arrayInstanceId.Length; i++)
            {
                if (!long.TryParse(arrayInstanceId[i], out picId))
                {
                    continue;
                }

                pic = CY.UME.Core.Business.Picture.Load(picId);

                if (pic == null)
                {
                    continue;
                }

                sb.Append(",{");
                sb.Append("picName:");
                sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(pic.Name));
                sb.Append(",pictureId:");
                sb.Append(picId);
                sb.Append(",picDate:'");
                sb.Append(CY.Utility.Common.StringUtility.getDateDifference(pic.DateCreated));
                sb.Append("',ReplyNum:" + pic.ReplyNum);
                sb.Append("}");
            }

            sb.Append("]");
            sb.Append("},");

            result = sb.ToString();

            isCut = true;
            return result;
        }
Esempio n. 5
0
        /// <summary>
        /// 3获取单个博客(blog)信息
        /// </summary>
        /// <param name="notice"></param>
        /// <returns></returns>
        private string GetBlogInfo(CY.UME.Core.Business.Notice notice, out bool isCut)
        {
            isCut = false;
            string result = String.Empty;
            StringBuilder sb = new StringBuilder();
            CY.UME.Core.Business.Account author;
            CY.UME.Core.Business.Blog blog;

            long blogId;
            if (!CY.Utility.Common.ParseUtility.TryParseInt64(notice.InstanceId, out blogId))
            {
                return result;
            }
            else
            {
                if (blogId < 1) { return result; }
                else
                {
                    blog = CY.UME.Core.Business.Blog.Load(blogId);
                }
            }

            if (blog == null)
            {
                notice.DeleteOnSave();
                notice.Save();

                return result;
            }

            author = CY.UME.Core.Business.Account.Load(notice.AuthorId);
            if (author == null)
            {
                return result;
            }

            string strContent = blog.BlogContent.Replace("\r\n", "");
            strContent = CY.Utility.Common.StringUtility.NoHTML(strContent);
            strContent = System.Web.HttpContext.Current.Server.HtmlDecode(strContent);
            strContent = strContent.Replace("&nbsp;", " ");
            strContent = CY.Utility.Common.StringUtility.CutString(strContent.Trim(), 200, "...");
            strContent = strContent.Replace("&", "&amp;");

            sb.Append("{id:");
            sb.Append(notice.Id);
            sb.Append(",type:'" + notice.Type);
            sb.Append("',authorId:");
            sb.Append(notice.AuthorId);
            sb.Append(",authorName:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(author.Name));
            sb.Append(",content:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(notice.Content));
            sb.Append(",blogId:'");
            sb.Append(blogId);
            sb.Append("',blogSubject:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(blog.Subject));
            sb.Append(",blogContent:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(strContent));
            sb.Append(",blogPubDate:'");
            sb.Append(CY.Utility.Common.StringUtility.getDateDifference(blog.DateCreated));
            sb.Append("',ReplyNum:" + blog.ReplyNum);
            sb.Append("},");

            result = sb.ToString();

            isCut = true;
            return result;
        }