当前位置: 首页>>代码示例>>C#>>正文


C# CY.DeleteOnSave方法代码示例

本文整理汇总了C#中CY.DeleteOnSave方法的典型用法代码示例。如果您正苦于以下问题:C# CY.DeleteOnSave方法的具体用法?C# CY.DeleteOnSave怎么用?C# CY.DeleteOnSave使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CY的用法示例。


在下文中一共展示了CY.DeleteOnSave方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetTopicInfo

        /// <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;
//.........这里部分代码省略.........
开发者ID:dalinhuang,项目名称:ume-v3,代码行数:101,代码来源:GetFriendNotice.ashx.cs

示例2: GetRelativeGroupInfo

        /// <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();
        }
开发者ID:dalinhuang,项目名称:ume-v3,代码行数:80,代码来源:GetFriendNotice.ashx.cs

示例3: GetMiniBlogInfo

        /// <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;
//.........这里部分代码省略.........
开发者ID:dalinhuang,项目名称:ume-v3,代码行数:101,代码来源:GetFriendNotice.ashx.cs

示例4: GetPictureInfo

        /// <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("]");
//.........这里部分代码省略.........
开发者ID:dalinhuang,项目名称:ume-v3,代码行数:101,代码来源:GetFriendNotice.ashx.cs

示例5: GetBlogInfo

        /// <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;
        }
开发者ID:dalinhuang,项目名称:ume-v3,代码行数:73,代码来源:GetFriendNotice.ashx.cs


注:本文中的CY.DeleteOnSave方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。