示例#1
0
        public ArticleItemsInfo GetArticleItemsInfo(int itemid)
        {
            StringBuilder    builder = new StringBuilder();
            ArticleItemsInfo info    = new ArticleItemsInfo();

            builder.Append("select Id,ArticleId,Title,Content,ImageUrl,Url,LinkType,PubTime,mediaid from vshop_ArticleItems ");
            builder.Append(" where Id=@Id order by ID asc ");
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(builder.ToString());

            this.database.AddInParameter(sqlStringCommand, "Id", DbType.Int32, itemid);
            DataTable table = this.database.ExecuteDataSet(sqlStringCommand).Tables[0];

            if (table.Rows.Count > 0)
            {
                info.Id        = int.Parse(table.Rows[0]["ID"].ToString());
                info.Title     = table.Rows[0]["Title"].ToString();
                info.LinkType  = (LinkType)int.Parse(table.Rows[0]["LinkType"].ToString());
                info.ArticleId = int.Parse(table.Rows[0]["ArticleId"].ToString());
                info.ImageUrl  = table.Rows[0]["ImageUrl"].ToString();
                info.Url       = table.Rows[0]["Url"].ToString();
                info.Content   = table.Rows[0]["Content"].ToString();
                info.PubTime   = DateTime.Parse(table.Rows[0]["PubTime"].ToString());
                if (table.Rows[0]["MediaId"] != null)
                {
                    info.MediaId = table.Rows[0]["MediaId"].ToString();
                    return(info);
                }
                info.MediaId = "";
                return(info);
            }
            return(null);
        }
 protected override void AttachChildControls()
 {
     this.itemID     = Globals.RequestQueryNum("iid");
     this.singleID   = Globals.RequestQueryNum("sid");
     this.imgUrl     = (HiImage)this.FindControl("imgUrl");
     this.litContent = (Literal)this.FindControl("litContent");
     this.LitJs      = (Literal)this.FindControl("LitJs");
     if (this.singleID > 0)
     {
         ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(this.singleID);
         if (articleInfo != null)
         {
             this.htmlTitle       = articleInfo.Title;
             this.imgUrl.ImageUrl = articleInfo.ImageUrl;
             this.litContent.Text = articleInfo.Content;
             string imageUrl = articleInfo.ImageUrl;
             if (!imageUrl.ToLower().StartsWith("http"))
             {
                 imageUrl = Globals.GetWebUrlStart() + imageUrl;
             }
             string str2 = Globals.ReplaceHtmlTag(articleInfo.Memo, 50);
             this.LitJs.Text = "<script>wxinshare_title ='" + this.Page.Server.HtmlEncode(this.htmlTitle.Replace("\n", "").Replace("\r", "")) + "';wxinshare_desc = '" + this.Page.Server.HtmlEncode(str2.Replace("\n", "").Replace("\r", "")) + "';wxinshare_link = location.href;wxinshare_imgurl = '" + imageUrl + "';</script>";
         }
         else
         {
             base.GotoResourceNotFound("");
         }
     }
     else if (this.itemID > 0)
     {
         ArticleItemsInfo articleItemsInfo = ArticleHelper.GetArticleItemsInfo(this.itemID);
         if (articleItemsInfo != null)
         {
             this.htmlTitle       = articleItemsInfo.Title;
             this.imgUrl.ImageUrl = articleItemsInfo.ImageUrl;
             this.litContent.Text = articleItemsInfo.Content;
             string str3 = articleItemsInfo.ImageUrl;
             if (!str3.ToLower().StartsWith("http"))
             {
                 str3 = Globals.GetWebUrlStart() + str3;
             }
             string str4 = Globals.ReplaceHtmlTag(articleItemsInfo.Content, 50);
             this.LitJs.Text = "<script>wxinshare_title ='" + this.Page.Server.HtmlEncode(this.htmlTitle.Replace("\n", "").Replace("\r", "")) + "';wxinshare_desc = '" + this.Page.Server.HtmlEncode(str4.Replace("\n", "").Replace("\r", "")) + "';wxinshare_link = location.href;wxinshare_imgurl = '" + str3 + "';</script>";
         }
         else
         {
             base.GotoResourceNotFound("");
         }
     }
     else
     {
         base.GotoResourceNotFound("");
     }
     PageTitle.AddSiteNameTitle(this.htmlTitle);
 }
示例#3
0
        public void UpdateArticleItem(ArticleItemsInfo iteminfo)
        {
            DbCommand sqlStringCommand;
            int       num;
            string    query = string.Empty;

            if (iteminfo.Id > 0)
            {
                query            = "update vshop_ArticleItems set Title=@Title,Content=@Content,ImageUrl=@ImageUrl,Url=@Url,LinkType=@LinkType,PubTime=@PubTime where Id=@Id";
                sqlStringCommand = this.database.GetSqlStringCommand(query);
                this.database.AddInParameter(sqlStringCommand, "Id", DbType.Int32, iteminfo.Id);
                this.database.AddInParameter(sqlStringCommand, "Title", DbType.String, iteminfo.Title);
                this.database.AddInParameter(sqlStringCommand, "Content", DbType.String, iteminfo.Content);
                this.database.AddInParameter(sqlStringCommand, "ImageUrl", DbType.String, iteminfo.ImageUrl);
                this.database.AddInParameter(sqlStringCommand, "Url", DbType.String, iteminfo.Url);
                this.database.AddInParameter(sqlStringCommand, "LinkType", DbType.Int32, iteminfo.LinkType);
                this.database.AddInParameter(sqlStringCommand, "PubTime", DbType.DateTime, iteminfo.PubTime);
                num = this.database.ExecuteNonQuery(sqlStringCommand);
            }
            else
            {
                StringBuilder builder = new StringBuilder();
                builder.Append("insert into vshop_ArticleItems(");
                builder.Append("ArticleId,Title,Content,ImageUrl,Url,LinkType,PubTime)");
                builder.Append(" values (");
                builder.Append("@ArticleId,@Title,@Content,@ImageUrl,@Url,@LinkType,@PubTime);select @@identity");
                sqlStringCommand = this.database.GetSqlStringCommand(builder.ToString());
                this.database.AddInParameter(sqlStringCommand, "ArticleId", DbType.Int32, iteminfo.ArticleId);
                this.database.AddInParameter(sqlStringCommand, "Title", DbType.String, iteminfo.Title);
                this.database.AddInParameter(sqlStringCommand, "Content", DbType.String, iteminfo.Content);
                this.database.AddInParameter(sqlStringCommand, "ImageUrl", DbType.String, iteminfo.ImageUrl);
                this.database.AddInParameter(sqlStringCommand, "Url", DbType.String, iteminfo.Url);
                this.database.AddInParameter(sqlStringCommand, "LinkType", DbType.Int32, iteminfo.LinkType);
                this.database.AddInParameter(sqlStringCommand, "PubTime", DbType.DateTime, iteminfo.PubTime);
                num = int.Parse(this.database.ExecuteScalar(sqlStringCommand).ToString());
                if (iteminfo.LinkType == LinkType.ArticleDetail)
                {
                    string str2 = "update vshop_ArticleItems set Url=@Url where Id=@Id";
                    sqlStringCommand = this.database.GetSqlStringCommand(str2);
                    iteminfo.Id      = num;
                    iteminfo.Url     = this.articledetailUrl.Replace("$1", "iid=" + iteminfo.Id.ToString());
                    this.database.AddInParameter(sqlStringCommand, "Url", DbType.String, iteminfo.Url);
                    this.database.AddInParameter(sqlStringCommand, "Id", DbType.Int32, iteminfo.Id);
                    this.database.ExecuteNonQuery(sqlStringCommand);
                }
            }
        }
示例#4
0
 protected override void AttachChildControls()
 {
     this.itemID     = Globals.RequestQueryNum("iid");
     this.singleID   = Globals.RequestQueryNum("sid");
     this.imgUrl     = (HiImage)this.FindControl("imgUrl");
     this.litContent = (Literal)this.FindControl("litContent");
     if (this.singleID > 0)
     {
         ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(this.singleID);
         if (articleInfo != null)
         {
             this.htmlTitle       = articleInfo.Title;
             this.imgUrl.ImageUrl = articleInfo.ImageUrl;
             this.litContent.Text = articleInfo.Content;
         }
         else
         {
             base.GotoResourceNotFound("");
         }
     }
     else if (this.itemID > 0)
     {
         ArticleItemsInfo articleItemsInfo = ArticleHelper.GetArticleItemsInfo(this.itemID);
         if (articleItemsInfo != null)
         {
             this.htmlTitle       = articleItemsInfo.Title;
             this.imgUrl.ImageUrl = articleItemsInfo.ImageUrl;
             this.litContent.Text = articleItemsInfo.Content;
         }
         else
         {
             base.GotoResourceNotFound("");
         }
     }
     else
     {
         base.GotoResourceNotFound("");
     }
     PageTitle.AddSiteNameTitle(this.htmlTitle);
 }
示例#5
0
        public ArticleItemsInfo GetArticleItemsInfo(int itemid)
        {
            StringBuilder    stringBuilder    = new StringBuilder();
            ArticleItemsInfo articleItemsInfo = new ArticleItemsInfo();

            stringBuilder.Append("select Id,ArticleId,Title,Content,ImageUrl,Url,LinkType,PubTime,mediaid from vshop_ArticleItems ");
            stringBuilder.Append(" where Id=@Id order by ID asc ");
            System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand(stringBuilder.ToString());
            this.database.AddInParameter(sqlStringCommand, "Id", System.Data.DbType.Int32, itemid);
            System.Data.DataTable dataTable = this.database.ExecuteDataSet(sqlStringCommand).Tables[0];
            ArticleItemsInfo      result;

            if (dataTable.Rows.Count > 0)
            {
                articleItemsInfo.Id        = int.Parse(dataTable.Rows[0]["ID"].ToString());
                articleItemsInfo.Title     = dataTable.Rows[0]["Title"].ToString();
                articleItemsInfo.LinkType  = (LinkType)int.Parse(dataTable.Rows[0]["LinkType"].ToString());
                articleItemsInfo.ArticleId = int.Parse(dataTable.Rows[0]["ArticleId"].ToString());
                articleItemsInfo.ImageUrl  = dataTable.Rows[0]["ImageUrl"].ToString();
                articleItemsInfo.Url       = dataTable.Rows[0]["Url"].ToString();
                articleItemsInfo.Content   = dataTable.Rows[0]["Content"].ToString();
                articleItemsInfo.PubTime   = DateTime.Parse(dataTable.Rows[0]["PubTime"].ToString());
                if (dataTable.Rows[0]["MediaId"] != null)
                {
                    articleItemsInfo.MediaId = dataTable.Rows[0]["MediaId"].ToString();
                }
                else
                {
                    articleItemsInfo.MediaId = "";
                }
                result = articleItemsInfo;
            }
            else
            {
                result = null;
            }
            return(result);
        }
示例#6
0
        protected string GetTitleShow(object messagetypename, object articleid, object responseid)
        {
            string text = string.Empty;
            int    num  = Globals.ToNum(articleid);
            int    id   = Globals.ToNum(responseid);
            string a;

            if ((a = messagetypename.ToString()) != null)
            {
                if (!(a == "多图文"))
                {
                    if (!(a == "单图文"))
                    {
                        if (a == "文本")
                        {
                            TextReplyInfo textReplyInfo = AliFuwuReplyHelper.GetReply(id) as TextReplyInfo;
                            if (textReplyInfo != null)
                            {
                                text = textReplyInfo.Text;
                                text = System.Text.RegularExpressions.Regex.Replace(text, "<[^>]+>", "");
                                text = System.Text.RegularExpressions.Regex.Replace(text, "&[^;]+;", "");
                                text = Globals.SubStr(text, 100, "...");
                                if (string.IsNullOrEmpty(text) && textReplyInfo.Text.Contains("<img "))
                                {
                                    text = "<span style='color:green;'>图文内容</span>";
                                }
                            }
                        }
                    }
                    else if (num > 0)
                    {
                        ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(num);
                        if (articleInfo != null)
                        {
                            int num2 = 1;
                            text = string.Concat(new object[]
                            {
                                "<p>[<span style='color:green;'>图文",
                                num2,
                                "</span>] ",
                                Globals.SubStr(articleInfo.Title, 40, "..."),
                                "</p>"
                            });
                        }
                    }
                    else
                    {
                        NewsReplyInfo newsReplyInfo = AliFuwuReplyHelper.GetReply(id) as NewsReplyInfo;
                        if (newsReplyInfo != null)
                        {
                            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                            if (newsReplyInfo.NewsMsg != null && newsReplyInfo.NewsMsg.Count > 0)
                            {
                                int num3 = 0;
                                foreach (NewsMsgInfo current in newsReplyInfo.NewsMsg)
                                {
                                    num3++;
                                    stringBuilder.Append(string.Concat(new object[]
                                    {
                                        "<p>[<span style='color:green;'>图文",
                                        num3,
                                        "</span>] ",
                                        Globals.SubStr(current.Title, 40, "..."),
                                        "</p>"
                                    }));
                                }
                            }
                            text = stringBuilder.ToString();
                        }
                    }
                }
                else
                {
                    if (num > 0)
                    {
                        ArticleInfo articleInfo2 = ArticleHelper.GetArticleInfo(num);
                        if (articleInfo2 == null)
                        {
                            return(text);
                        }
                        int num4 = 1;
                        text = string.Concat(new object[]
                        {
                            "<p>[<span style='color:green;'>图文",
                            num4,
                            "</span>] ",
                            Globals.SubStr(articleInfo2.Title, 40, "..."),
                            "</p>"
                        });
                        if (articleInfo2.ItemsInfo == null)
                        {
                            return(text);
                        }
                        using (System.Collections.Generic.IEnumerator <ArticleItemsInfo> enumerator2 = articleInfo2.ItemsInfo.GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                ArticleItemsInfo current2 = enumerator2.Current;
                                num4++;
                                object obj = text;
                                text = string.Concat(new object[]
                                {
                                    obj,
                                    "<p>[<span style='color:green;'>图文",
                                    num4,
                                    "</span>] ",
                                    Globals.SubStr(current2.Title, 40, "..."),
                                    "</p>"
                                });
                            }
                            return(text);
                        }
                    }
                    NewsReplyInfo newsReplyInfo2 = AliFuwuReplyHelper.GetReply(id) as NewsReplyInfo;
                    if (newsReplyInfo2 != null)
                    {
                        System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder();
                        if (newsReplyInfo2.NewsMsg != null && newsReplyInfo2.NewsMsg.Count > 0)
                        {
                            int num5 = 0;
                            foreach (NewsMsgInfo current3 in newsReplyInfo2.NewsMsg)
                            {
                                num5++;
                                stringBuilder2.Append(string.Concat(new object[]
                                {
                                    "<p>[<span style='color:green;'>图文",
                                    num5,
                                    "</span>] ",
                                    Globals.SubStr(current3.Title, 40, "..."),
                                    "</p>"
                                }));
                            }
                        }
                        text = stringBuilder2.ToString();
                    }
                }
            }
            return(text);
        }
示例#7
0
        private string GetKFSendImageJson(string openid, ArticleInfo articleinfo)
        {
            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            if (articleinfo != null && articleinfo != null)
            {
                switch (articleinfo.ArticleType)
                {
                case ArticleType.News:
                    break;

                case (ArticleType)3:
                    goto IL_200;

                case ArticleType.List:
                {
                    stringBuilder.Append(string.Concat(new string[]
                        {
                            "{\"title\":\"",
                            this.String2Json(articleinfo.Title),
                            "\",\"description\":\"",
                            this.String2Json(articleinfo.Memo),
                            "\",\"url\":\"",
                            this.String2Json(this.FormatUrl(articleinfo.Url)),
                            "\",\"picurl\":\"",
                            this.String2Json(this.FormatUrl(articleinfo.ImageUrl)),
                            "\"}"
                        }));
                    System.Collections.Generic.IList <ArticleItemsInfo> itemsInfo = articleinfo.ItemsInfo;
                    using (System.Collections.Generic.IEnumerator <ArticleItemsInfo> enumerator = itemsInfo.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            ArticleItemsInfo current = enumerator.Current;
                            stringBuilder.Append(string.Concat(new string[]
                                {
                                    ",{\"title\":\"",
                                    this.String2Json(current.Title),
                                    "\",\"description\":\"\",\"url\":\"",
                                    this.String2Json(this.FormatUrl(current.Url)),
                                    "\",\"picurl\":\"",
                                    this.String2Json(this.FormatUrl(current.ImageUrl)),
                                    "\"}"
                                }));
                        }
                        goto IL_200;
                    }
                    break;
                }

                default:
                    goto IL_200;
                }
                stringBuilder.Append(string.Concat(new string[]
                {
                    "{\"title\":\"",
                    this.String2Json(articleinfo.Title),
                    "\",\"description\":\"",
                    this.String2Json(articleinfo.Memo),
                    "\",\"url\":\"",
                    this.String2Json(this.FormatUrl(articleinfo.Url)),
                    "\",\"picurl\":\"",
                    this.String2Json(this.FormatUrl(articleinfo.ImageUrl)),
                    "\"}"
                }));
            }
IL_200:
            return(string.Concat(new string[]
            {
                "{\"touser\":\"",
                openid,
                "\",\"msgtype\":\"news\",\"news\":{\"articles\": [",
                stringBuilder.ToString(),
                "]}}"
            }));
        }
示例#8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     wid = GetCurWebId();
     if (string.IsNullOrEmpty(wid))
     {
         return;
     }
     this.ReUrl = Globals.RequestQueryStr("reurl");
     if (string.IsNullOrEmpty(this.ReUrl))
     {
         this.ReUrl = "articles.aspx";
     }
     int.TryParse(Globals.RequestQueryStr("id"), out this.MaterialID);
     if (!(Globals.RequestQueryStr("cmd") == "add"))
     {
         if (this.MaterialID > 0)
         {
             this.htmlOperName = "编辑";
             ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(this.MaterialID);
             if (articleInfo != null)
             {
                 if (articleInfo.ArticleType == ArticleType.News)
                 {
                     base.Response.Redirect("articlesedit.aspx?id=" + this.MaterialID);
                     base.Response.End();
                 }
                 else
                 {
                     IList <ArticleItemsInfo> itemsInfo = articleInfo.ItemsInfo;
                     ArticleItemsInfo         item      = new ArticleItemsInfo {
                         ArticleId = this.MaterialID,
                         Title     = articleInfo.Title,
                         ImageUrl  = articleInfo.ImageUrl,
                         Url       = articleInfo.Url,
                         Content   = articleInfo.Content,
                         LinkType  = articleInfo.LinkType,
                         Id        = 0
                     };
                     itemsInfo.Insert(0, item);
                     this.htmlLinkType = ((int)articleInfo.LinkType).ToString();
                     if (this.htmlLinkType != "1")
                     {
                         this.htmlAddJs = "$('#divContent').hide();$('#urlData').show();";
                     }
                     this.htmlLinkTypeName = articleInfo.LinkType.ToShowText();
                     List <ArticleList> list5 = new List <ArticleList>();
                     int num3 = 1;
                     foreach (ArticleItemsInfo info5 in itemsInfo)
                     {
                         ArticleList list6 = new ArticleList {
                             Id       = info5.Id,
                             Title    = info5.Title,
                             Url      = info5.Url,
                             ImageUrl = info5.ImageUrl,
                             Content  = info5.Content
                         };
                         list6.BoxId    = num3++.ToString();
                         list6.LinkType = info5.LinkType;
                         list6.Status   = "";
                         list5.Add(list6);
                     }
                     this.articleJson = JsonConvert.SerializeObject(list5);
                 }
             }
         }
         else
         {
             this.articleJson = "''";
         }
     }
     else
     {
         base.Response.ContentType = "application/json";
         string             str2 = Globals.RequestFormStr("MultiArticle");
         string             s    = "{\"type\":\"0\",\"tips\":\"操作失败\"}";
         List <ArticleList> list = JsonConvert.DeserializeObject <List <ArticleList> >(str2);
         if ((list != null) && (list.Count > 0))
         {
             int                     num     = 0;
             ArticleInfo             article = new ArticleInfo();
             List <ArticleItemsInfo> list2   = new List <ArticleItemsInfo>();
             DateTime                now     = DateTime.Now;
             string                  str4    = string.Empty;
             foreach (ArticleList list3 in list)
             {
                 if (list3.Title == "")
                 {
                     str4 = "标题不能为空!";
                     break;
                 }
                 if (list3.ImageUrl == "")
                 {
                     str4 = "请选择一张封面!";
                     break;
                 }
                 if ((list3.LinkType == LinkType.ArticleDetail) && (list3.Content == ""))
                 {
                     str4 = "请输入内容!";
                     break;
                 }
                 if ((list3.LinkType != LinkType.ArticleDetail) && (list3.Url == ""))
                 {
                     str4 = "请选择或输入自定义链接!";
                     break;
                 }
                 if (list3.Status != "del")
                 {
                     if (num == 0)
                     {
                         article.Title       = list3.Title;
                         article.ArticleType = ArticleType.List;
                         article.Content     = list3.Content;
                         article.ImageUrl    = list3.ImageUrl;
                         article.Url         = list3.Url;
                         article.LinkType    = list3.LinkType;
                         article.Memo        = "";
                         article.ArticleId   = this.MaterialID;
                         article.PubTime     = now;
                         article.wid         = this.wid;
                         num++;
                     }
                     else
                     {
                         ArticleItemsInfo info2 = list3;
                         info2.PubTime = now;
                         list2.Add(info2);
                         num++;
                     }
                 }
             }
             if (!string.IsNullOrEmpty(str4))
             {
                 s = "{\"type\":\"0\",\"tips\":\"" + str4 + "\"}";
                 base.Response.Write(s);
                 base.Response.End();
             }
             article.ItemsInfo = list2;
             if (article.ArticleId > 0)
             {
                 if (ArticleHelper.UpdateMultiArticle(article))
                 {
                     s = "{\"type\":\"1\",\"id\":\"" + article.ArticleId + "\",\"tips\":\"多图素材修改成功!\"}";
                 }
             }
             else
             {
                 int num2 = ArticleHelper.AddMultiArticle(article);
                 if (num2 > 0)
                 {
                     s = "{\"type\":\"1\",\"id\":\"" + num2 + "\",\"tips\":\"多图素材新增成功!\"}";
                 }
             }
             base.Response.Write(s);
             base.Response.End();
         }
     }
 }
示例#9
0
        public AbstractResponse GetResponse(Hidistro.Entities.VShop.ReplyInfo reply, string openId)
        {
            string log = string.Concat(new string[]
            {
                reply.MessageType.ToString(),
                "||",
                reply.MessageType.ToString(),
                "||",
                reply.MessageTypeName
            });

            Globals.Debuglog(log, "_DebuglogYY.txt");
            if (reply.MessageType == MessageType.Text)
            {
                TextReplyInfo textReplyInfo = reply as TextReplyInfo;
                TextResponse  textResponse  = new TextResponse();
                textResponse.CreateTime = System.DateTime.Now;
                textResponse.Content    = Globals.FormatWXReplyContent(textReplyInfo.Text);
                if (reply.Keys == "登录")
                {
                    string arg = Globals.GetWebUrlStart() + "/Vshop/MemberCenter.aspx";
                    textResponse.Content = textResponse.Content.Replace("$login$", string.Format("<a href=\"{0}\">一键登录</a>", arg));
                }
                return(textResponse);
            }
            NewsResponse newsResponse = new NewsResponse();

            newsResponse.CreateTime = System.DateTime.Now;
            newsResponse.Articles   = new System.Collections.Generic.List <Article>();
            if (reply.ArticleID > 0)
            {
                ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(reply.ArticleID);
                if (articleInfo.ArticleType == ArticleType.News)
                {
                    Article item = new Article
                    {
                        Description = articleInfo.Memo,
                        PicUrl      = this.FormatImgUrl(articleInfo.ImageUrl),
                        Title       = articleInfo.Title,
                        Url         = (string.IsNullOrEmpty(articleInfo.Url) ? string.Format("http://{0}/Vshop/ArticleDetail.aspx?sid={1}", System.Web.HttpContext.Current.Request.Url.Host, articleInfo.ArticleId) : articleInfo.Url)
                    };
                    newsResponse.Articles.Add(item);
                    return(newsResponse);
                }
                if (articleInfo.ArticleType != ArticleType.List)
                {
                    return(newsResponse);
                }
                Article item2 = new Article
                {
                    Description = articleInfo.Memo,
                    PicUrl      = this.FormatImgUrl(articleInfo.ImageUrl),
                    Title       = articleInfo.Title,
                    Url         = (string.IsNullOrEmpty(articleInfo.Url) ? string.Format("http://{0}/Vshop/ArticleDetail.aspx?sid={1}", System.Web.HttpContext.Current.Request.Url.Host, articleInfo.ArticleId) : articleInfo.Url)
                };
                newsResponse.Articles.Add(item2);
                using (System.Collections.Generic.IEnumerator <ArticleItemsInfo> enumerator = articleInfo.ItemsInfo.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ArticleItemsInfo current = enumerator.Current;
                        item2 = new Article
                        {
                            Description = "",
                            PicUrl      = this.FormatImgUrl(current.ImageUrl),
                            Title       = current.Title,
                            Url         = (string.IsNullOrEmpty(current.Url) ? string.Format("http://{0}/Vshop/ArticleDetail.aspx?iid={1}", System.Web.HttpContext.Current.Request.Url.Host, current.Id) : current.Url)
                        };
                        newsResponse.Articles.Add(item2);
                    }
                    return(newsResponse);
                }
            }
            foreach (NewsMsgInfo current2 in (reply as NewsReplyInfo).NewsMsg)
            {
                Article item3 = new Article
                {
                    Description = current2.Description,
                    PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, current2.PicUrl),
                    Title       = current2.Title,
                    Url         = (string.IsNullOrEmpty(current2.Url) ? string.Format("http://{0}/Vshop/ImageTextDetails.aspx?messageId={1}", System.Web.HttpContext.Current.Request.Url.Host, current2.Id) : current2.Url)
                };
                newsResponse.Articles.Add(item3);
            }
            return(newsResponse);
        }
示例#10
0
        public int GetArticleIDByOldArticle(int replyid, MessageType msgtype)
        {
            NewsReplyInfo reply;
            int           num     = 0;
            ArticleInfo   article = new ArticleInfo();

            switch (msgtype)
            {
            case MessageType.News:
                reply = this.GetReply(replyid) as NewsReplyInfo;
                if (((reply == null) || (reply.NewsMsg == null)) || (reply.NewsMsg.Count == 0))
                {
                    return(num);
                }
                article.Title       = reply.NewsMsg[0].Title;
                article.ArticleType = ArticleType.News;
                article.Content     = reply.NewsMsg[0].Content;
                article.ImageUrl    = reply.NewsMsg[0].PicUrl;
                article.Url         = reply.NewsMsg[0].Url;
                article.Memo        = reply.NewsMsg[0].Description;
                article.PubTime     = DateTime.Now;
                if (article.Url.Length <= 10)
                {
                    article.LinkType = LinkType.ArticleDetail;
                }
                else
                {
                    article.LinkType = LinkType.Userdefined;
                }
                return(new ArticleDao().AddSingerArticle(article));

            case (MessageType.News | MessageType.Text):
                return(num);

            case MessageType.List:
                reply               = this.GetReply(replyid) as NewsReplyInfo;
                article.Title       = reply.NewsMsg[0].Title;
                article.ArticleType = ArticleType.List;
                article.Content     = reply.NewsMsg[0].Content;
                article.ImageUrl    = reply.NewsMsg[0].PicUrl;
                article.Url         = reply.NewsMsg[0].Url;
                article.Memo        = reply.NewsMsg[0].Description;
                article.PubTime     = DateTime.Now;
                if (article.Url.Length <= 10)
                {
                    article.LinkType = LinkType.ArticleDetail;
                    break;
                }
                article.LinkType = LinkType.Userdefined;
                break;

            default:
                return(num);
            }
            List <ArticleItemsInfo> list = new List <ArticleItemsInfo>();

            if ((reply.NewsMsg != null) && (reply.NewsMsg.Count > 0))
            {
                int num2 = 0;
                foreach (NewsMsgInfo info3 in reply.NewsMsg)
                {
                    num2++;
                    if (num2 != 1)
                    {
                        ArticleItemsInfo item = new ArticleItemsInfo {
                            Title     = info3.Title,
                            Content   = info3.Content,
                            ImageUrl  = info3.PicUrl,
                            Url       = info3.Url,
                            ArticleId = 0
                        };
                        if (item.Url.Length > 10)
                        {
                            item.LinkType = LinkType.Userdefined;
                        }
                        else
                        {
                            item.LinkType = LinkType.ArticleDetail;
                        }
                        list.Add(item);
                    }
                }
            }
            article.ItemsInfo = list;
            return(new ArticleDao().AddMultiArticle(article));
        }
示例#11
0
        public int GetArticleIDByOldArticle(int replyid, MessageType msgtype)
        {
            int         result      = 0;
            ArticleInfo articleInfo = new ArticleInfo();

            switch (msgtype)
            {
            case MessageType.News:
            {
                NewsReplyInfo newsReplyInfo = this.GetReply(replyid) as NewsReplyInfo;
                if (newsReplyInfo != null && newsReplyInfo.NewsMsg != null && newsReplyInfo.NewsMsg.Count != 0)
                {
                    articleInfo.Title       = newsReplyInfo.NewsMsg[0].Title;
                    articleInfo.ArticleType = ArticleType.News;
                    articleInfo.Content     = newsReplyInfo.NewsMsg[0].Content;
                    articleInfo.ImageUrl    = newsReplyInfo.NewsMsg[0].PicUrl;
                    articleInfo.Url         = newsReplyInfo.NewsMsg[0].Url;
                    articleInfo.Memo        = newsReplyInfo.NewsMsg[0].Description;
                    articleInfo.PubTime     = DateTime.Now;
                    if (articleInfo.Url.Length > 10)
                    {
                        articleInfo.LinkType = LinkType.Userdefined;
                    }
                    else
                    {
                        articleInfo.LinkType = LinkType.ArticleDetail;
                    }
                    result = new ArticleDao().AddSingerArticle(articleInfo);
                }
                break;
            }

            case MessageType.List:
            {
                NewsReplyInfo newsReplyInfo = this.GetReply(replyid) as NewsReplyInfo;
                articleInfo.Title       = newsReplyInfo.NewsMsg[0].Title;
                articleInfo.ArticleType = ArticleType.List;
                articleInfo.Content     = newsReplyInfo.NewsMsg[0].Content;
                articleInfo.ImageUrl    = newsReplyInfo.NewsMsg[0].PicUrl;
                articleInfo.Url         = newsReplyInfo.NewsMsg[0].Url;
                articleInfo.Memo        = newsReplyInfo.NewsMsg[0].Description;
                articleInfo.PubTime     = DateTime.Now;
                if (articleInfo.Url.Length > 10)
                {
                    articleInfo.LinkType = LinkType.Userdefined;
                }
                else
                {
                    articleInfo.LinkType = LinkType.ArticleDetail;
                }
                List <ArticleItemsInfo> list = new List <ArticleItemsInfo>();
                if (newsReplyInfo.NewsMsg != null && newsReplyInfo.NewsMsg.Count > 0)
                {
                    int num = 0;
                    foreach (NewsMsgInfo current in newsReplyInfo.NewsMsg)
                    {
                        num++;
                        if (num != 1)
                        {
                            ArticleItemsInfo articleItemsInfo = new ArticleItemsInfo();
                            articleItemsInfo.Title     = current.Title;
                            articleItemsInfo.Content   = current.Content;
                            articleItemsInfo.ImageUrl  = current.PicUrl;
                            articleItemsInfo.Url       = current.Url;
                            articleItemsInfo.ArticleId = 0;
                            if (articleItemsInfo.Url.Length > 10)
                            {
                                articleItemsInfo.LinkType = LinkType.Userdefined;
                            }
                            else
                            {
                                articleItemsInfo.LinkType = LinkType.ArticleDetail;
                            }
                            list.Add(articleItemsInfo);
                        }
                    }
                }
                articleInfo.ItemsInfo = list;
                result = new ArticleDao().AddMultiArticle(articleInfo);
                break;
            }
            }
            return(result);
        }
示例#12
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            this.ReUrl = Globals.RequestQueryStr("reurl");
            if (string.IsNullOrEmpty(this.ReUrl))
            {
                this.ReUrl = "articles.aspx";
            }
            int.TryParse(Globals.RequestQueryStr("id"), out this.MaterialID);
            string a = Globals.RequestQueryStr("cmd");

            if (a == "add")
            {
                base.Response.ContentType = "application/json";
                string value = Globals.RequestFormStr("MultiArticle");
                string s     = "{\"type\":\"0\",\"tips\":\"操作失败\"}";
                System.Collections.Generic.List <ArticleList> list = JsonConvert.DeserializeObject <System.Collections.Generic.List <ArticleList> >(value);
                if (list != null && list.Count > 0)
                {
                    int         num         = 0;
                    ArticleInfo articleInfo = new ArticleInfo();
                    System.Collections.Generic.List <ArticleItemsInfo> list2 = new System.Collections.Generic.List <ArticleItemsInfo>();
                    System.DateTime now  = System.DateTime.Now;
                    string          text = string.Empty;
                    foreach (ArticleList current in list)
                    {
                        if (current.Title == "")
                        {
                            text = "标题不能为空!";
                            break;
                        }
                        if (current.ImageUrl == "")
                        {
                            text = "请选择一张封面!";
                            break;
                        }
                        if (current.LinkType == LinkType.ArticleDetail && current.Content == "")
                        {
                            text = "请输入内容!";
                            break;
                        }
                        if (current.LinkType != LinkType.ArticleDetail && current.Url == "")
                        {
                            text = "请选择或输入自定义链接!";
                            break;
                        }
                        if (current.Status != "del")
                        {
                            if (num == 0)
                            {
                                articleInfo.Title       = current.Title;
                                articleInfo.ArticleType = ArticleType.List;
                                articleInfo.Content     = current.Content;
                                articleInfo.ImageUrl    = current.ImageUrl;
                                articleInfo.Url         = current.Url;
                                articleInfo.LinkType    = current.LinkType;
                                articleInfo.Memo        = "";
                                articleInfo.ArticleId   = this.MaterialID;
                                articleInfo.PubTime     = now;
                                articleInfo.IsShare     = current.IsShare;
                                num++;
                            }
                            else
                            {
                                ArticleItemsInfo articleItemsInfo = current;
                                articleItemsInfo.PubTime = now;
                                list2.Add(articleItemsInfo);
                                num++;
                            }
                        }
                    }
                    if (!string.IsNullOrEmpty(text))
                    {
                        s = "{\"type\":\"0\",\"tips\":\"" + text + "\"}";
                        base.Response.Write(s);
                        base.Response.End();
                    }
                    articleInfo.ItemsInfo = list2;
                    if (articleInfo.ArticleId > 0)
                    {
                        bool flag = ArticleHelper.UpdateMultiArticle(articleInfo);
                        if (flag)
                        {
                            s = "{\"type\":\"1\",\"id\":\"" + articleInfo.ArticleId + "\",\"tips\":\"多图素材修改成功!\"}";
                        }
                    }
                    else
                    {
                        int num2 = ArticleHelper.AddMultiArticle(articleInfo);
                        if (num2 > 0)
                        {
                            s = "{\"type\":\"1\",\"id\":\"" + num2 + "\",\"tips\":\"多图素材新增成功!\"}";
                        }
                    }
                    base.Response.Write(s);
                    base.Response.End();
                    return;
                }
            }
            else if (this.MaterialID > 0)
            {
                this.htmlOperName = "编辑";
                ArticleInfo articleInfo2 = ArticleHelper.GetArticleInfo(this.MaterialID);
                if (articleInfo2 != null)
                {
                    if (articleInfo2.ArticleType == ArticleType.News)
                    {
                        base.Response.Redirect("articlesedit.aspx?id=" + this.MaterialID);
                        base.Response.End();
                        return;
                    }
                    System.Collections.Generic.IList <ArticleItemsInfo> itemsInfo = articleInfo2.ItemsInfo;
                    itemsInfo.Insert(0, new ArticleItemsInfo
                    {
                        ArticleId = this.MaterialID,
                        Title     = articleInfo2.Title,
                        ImageUrl  = articleInfo2.ImageUrl,
                        Url       = articleInfo2.Url,
                        Content   = articleInfo2.Content,
                        LinkType  = articleInfo2.LinkType,
                        Id        = 0,
                        IsShare   = articleInfo2.IsShare
                    });
                    this.IsShare.Checked = articleInfo2.IsShare;
                    this.htmlLinkType    = ((int)articleInfo2.LinkType).ToString();
                    if (this.htmlLinkType != "1")
                    {
                        this.htmlAddJs = "$('#urlData').show();";
                    }
                    this.htmlLinkTypeName = articleInfo2.LinkType.ToShowText();
                    System.Collections.Generic.List <ArticleList> list3 = new System.Collections.Generic.List <ArticleList>();
                    int num3 = 1;
                    foreach (ArticleItemsInfo current2 in itemsInfo)
                    {
                        list3.Add(new ArticleList
                        {
                            Id       = current2.Id,
                            Title    = current2.Title,
                            Url      = current2.Url,
                            ImageUrl = current2.ImageUrl,
                            Content  = current2.Content,
                            BoxId    = num3++.ToString(),
                            LinkType = current2.LinkType,
                            Status   = "",
                            IsShare  = current2.IsShare
                        });
                    }
                    this.articleJson = JsonConvert.SerializeObject(list3);
                    return;
                }
            }
            else
            {
                this.articleJson = "''";
            }
        }