Ejemplo n.º 1
0
        public void GetTopMenus(System.Web.HttpContext context)
        {
            context.Response.ContentType = "application/json";
            string text = "{";

            System.Collections.Generic.IList <MenuInfo> topMenus = WeiboHelper.GetTopMenus();
            if (topMenus.Count <= 0)
            {
                text += "\"status\":\"-1\"";
                return;
            }
            text += "\"status\":\"0\",\"data\":[";
            foreach (MenuInfo current in topMenus)
            {
                System.Collections.Generic.IList <MenuInfo> menusByParentId = WeiboHelper.GetMenusByParentId(current.MenuId);
                object obj = text;
                text = string.Concat(new object[]
                {
                    obj,
                    "{\"menuid\": \"",
                    current.MenuId,
                    "\","
                });
                text += "\"childdata\":[";
                if (menusByParentId.Count > 0)
                {
                    foreach (MenuInfo current2 in menusByParentId)
                    {
                        object obj2 = text;
                        text = string.Concat(new object[]
                        {
                            obj2,
                            "{\"menuid\": \"",
                            current2.MenuId,
                            "\","
                        });
                        object obj3 = text;
                        text = string.Concat(new object[]
                        {
                            obj3,
                            "\"parentmenuid\": \"",
                            current2.ParentMenuId,
                            "\","
                        });
                        text = text + "\"type\": \"" + current2.Type + "\",";
                        text = text + "\"name\": \"" + Globals.String2Json(current2.Name) + "\",";
                        text = text + "\"content\": \"" + Globals.String2Json(current2.Content) + "\"},";
                    }
                    text = text.Substring(0, text.Length - 1);
                }
                text += "],";
                text  = text + "\"type\": \"" + current.Type + "\",";
                text  = text + "\"name\": \"" + Globals.String2Json(current.Name) + "\",";
                text  = text + "\"content\": \"" + Globals.String2Json(current.Content) + "\"},";
            }
            text  = text.Substring(0, text.Length - 1);
            text += "]";
            text += "}";
            context.Response.Write(text);
        }
Ejemplo n.º 2
0
        public void GetMenu(System.Web.HttpContext context)
        {
            context.Response.ContentType = "application/json";
            string   text     = "{";
            MenuInfo menuInfo = new MenuInfo();
            int      menuId   = 0;

            if (!int.TryParse(context.Request["MenuId"], out menuId))
            {
                return;
            }
            menuInfo = WeiboHelper.GetMenu(menuId);
            if (menuInfo != null)
            {
                text += "\"status\":\"0\",\"data\":[";
                object obj = text;
                text = string.Concat(new object[]
                {
                    obj,
                    "{\"menuid\": \"",
                    menuInfo.MenuId,
                    "\","
                });
                text  = text + "\"type\": \"" + menuInfo.Type + "\",";
                text  = text + "\"name\": \"" + Globals.String2Json(menuInfo.Name) + "\",";
                text  = text + "\"content\": \"" + Globals.String2Json(menuInfo.Content) + "\"}";
                text += "]";
            }
            text += "}";
            context.Response.Write(text);
        }
Ejemplo n.º 3
0
        public void EditMenus(System.Web.HttpContext context)
        {
            context.Response.ContentType = "application/json";
            string   s        = "{\"status\":\"1\"}";
            MenuInfo menuInfo = new MenuInfo();

            menuInfo.Content = context.Request["Content"];
            menuInfo.Name    = context.Request["Name"];
            menuInfo.Type    = context.Request["Type"];
            if (!string.IsNullOrEmpty(context.Request["ParentMenuId"]))
            {
                menuInfo.ParentMenuId = int.Parse(context.Request["ParentMenuId"]);
            }
            else
            {
                menuInfo.ParentMenuId = 0;
            }
            int menuId = 0;

            if (!int.TryParse(context.Request["MenuId"], out menuId))
            {
                return;
            }
            menuInfo.MenuId = menuId;
            if (WeiboHelper.UpdateMenu(menuInfo))
            {
                s = "{\"status\":\"0\"}";
            }
            context.Response.Write(s);
        }
Ejemplo n.º 4
0
        static void GetCompleted(int state, List <UserInfoModel> list)
        {
            //通知完成
            Console.WriteLine($"[{pageindex}/{totalpage}] GetCompleted:" + list.Count);
            //保存数据
            data.AddRange(list);
            File.WriteAllText(savename, JsonConvert.SerializeObject(data));
            //判断是否还有数据
            pageindex++;
            if (pageindex <= totalpage)
            {
                //还有数据
                ulist = WeiboHelper.GetPageLikeLinks(mid, pageindex);
                GetWeiboUser getWeiboUser = new GetWeiboUser(ulist.UserLinks, 30);
                getWeiboUser.GetCompleted += GetCompleted;

                getWeiboUser.Get();
            }
            else
            {
                timer.Change(Timeout.Infinite, 1000);
                //没有
                Console.WriteLine($"抓取已完成,耗时 {time} 秒。总计 {totalpage} 页数据,抓取到用户 {data.Count} 位。");
                File.WriteAllText(savename, JsonConvert.SerializeObject(data));
                Console.WriteLine($"数据保存在程序启动目录:{savename}");
                time      = 0;
                pageindex = 1;
                data.Clear();
            }
        }
        public void EditMenus(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            string   s    = "{\"status\":\"1\"}";
            MenuInfo menu = new MenuInfo
            {
                Content = context.Request["Content"],
                Name    = context.Request["Name"],
                Type    = context.Request["Type"]
            };

            if (!string.IsNullOrEmpty(context.Request["ParentMenuId"]))
            {
                menu.ParentMenuId = int.Parse(context.Request["ParentMenuId"]);
            }
            else
            {
                menu.ParentMenuId = 0;
            }
            int result = 0;

            if (!int.TryParse(context.Request["MenuId"], out result))
            {
                s = "{\"status\":\"1\"}";
            }
            else
            {
                menu.MenuId = result;
                if (WeiboHelper.UpdateMenu(menu))
                {
                    s = "{\"status\":\"0\"}";
                }
                context.Response.Write(s);
            }
        }
        public void AddMenus(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            string   s    = "{\"status\":\"1\"}";
            MenuInfo menu = new MenuInfo
            {
                Content = context.Request["Content"].Trim(),
                Name    = context.Request["Name"].Trim()
            };

            if (context.Request["ParentMenuId"] != null)
            {
                menu.ParentMenuId = (context.Request["ParentMenuId"] == "") ? 0 : int.Parse(context.Request["ParentMenuId"]);
            }
            else
            {
                menu.ParentMenuId = 0;
            }
            menu.Type = context.Request["Type"];
            if (WeiboHelper.CanAddMenu(menu.ParentMenuId))
            {
                if (WeiboHelper.SaveMenu(menu))
                {
                    s = "{\"status\":\"0\"}";
                }
            }
            else
            {
                s = "{\"status\":\"2\"}";
            }
            context.Response.Write(s);
        }
Ejemplo n.º 7
0
        public void GetMessageInfo(System.Web.HttpContext context)
        {
            string      text        = "{\"status\":\"0\"}";
            MessageInfo messageInfo = WeiboHelper.GetMessageInfo(int.Parse(context.Request["MessageId"]));

            if (messageInfo != null)
            {
                text = "{\"status\":\"1\",";
                text = text + "\"SenderMessage\":\"" + Globals.String2Json(messageInfo.SenderMessage) + "\",";
                text = text + "\"DisplayName\":\"" + Globals.String2Json(messageInfo.DisplayName) + "\",";
                text = text + "\"Summary\":\"" + Globals.String2Json(messageInfo.Summary) + "\",";
                text = text + "\"Image\":\"" + messageInfo.Image + "\",";
                text = text + "\"Url\":\"" + messageInfo.Url + "\",";
                object obj = text;
                text = string.Concat(new object[]
                {
                    obj,
                    "\"ArticleId\":\"",
                    messageInfo.ArticleId,
                    "\""
                });
                text += "}";
            }
            context.Response.Write(text);
        }
Ejemplo n.º 8
0
        private void BtnKey_Click(object sender, System.EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtkey.Value.Trim()))
            {
                this.ShowMsg("关键词不能为空!", false);
                return;
            }
            ReplyKeyInfo replyKeyInfo = new ReplyKeyInfo();

            replyKeyInfo.Keys = this.txtkey.Value;
            replyKeyInfo.Type = 1;
            if (!string.IsNullOrEmpty(this.hidid.Value))
            {
                replyKeyInfo.Id = int.Parse(this.hidid.Value);
                if (WeiboHelper.UpdateReplyKeyInfo(replyKeyInfo))
                {
                    this.ShowMsg("关键词修改成功!", true);
                    this.bind();
                    return;
                }
                this.ShowMsg("关键词修改失败!", false);
                return;
            }
            else
            {
                if (WeiboHelper.SaveReplyKeyInfo(replyKeyInfo))
                {
                    this.ShowMsg("关键词添加成功!", true);
                    this.bind();
                    return;
                }
                this.ShowMsg("关键词添加失败!", false);
                return;
            }
        }
Ejemplo n.º 9
0
 private void repreplykey_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == System.Web.UI.WebControls.ListItemType.Item || e.Item.ItemType == System.Web.UI.WebControls.ListItemType.AlternatingItem)
     {
         System.Web.UI.WebControls.Repeater repeater = (System.Web.UI.WebControls.Repeater)e.Item.FindControl("repreply");
         int replyKeyId = (int)System.Web.UI.DataBinder.Eval(e.Item.DataItem, "id");
         repeater.DataSource = WeiboHelper.GetReplyInfo(replyKeyId);
         repeater.DataBind();
     }
 }
Ejemplo n.º 10
0
 private void repreplykey_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
     {
         Repeater repeater   = (Repeater)e.Item.FindControl("repreply");
         int      replyKeyId = (int)DataBinder.Eval(e.Item.DataItem, "id");
         repeater.DataSource = WeiboHelper.GetReplyInfo(replyKeyId);
         repeater.DataBind();
     }
 }
        public void replydel(HttpContext context)
        {
            string s = "{\"status\":\"0\"}";

            if (WeiboHelper.DeleteReplyInfo(int.Parse(context.Request["id"])))
            {
                s = "{\"status\":\"1\"}";
            }
            context.Response.Write(s);
        }
Ejemplo n.º 12
0
        public void savemenu(System.Web.HttpContext context)
        {
            string text = "{";

            System.Collections.Generic.IList <MenuInfo> topMenus = WeiboHelper.GetTopMenus();
            if (topMenus.Count <= 0)
            {
                return;
            }
            text += "\"button\":[";
            foreach (MenuInfo current in topMenus)
            {
                System.Collections.Generic.IList <MenuInfo> menusByParentId = WeiboHelper.GetMenusByParentId(current.MenuId);
                text = text + "{\"name\": \"" + Globals.String2Json(current.Name) + "\",";
                if (menusByParentId.Count > 0)
                {
                    text += "\"sub_button\":[";
                    foreach (MenuInfo current2 in menusByParentId)
                    {
                        text = text + "{\"type\": \"" + current2.Type + "\",";
                        text = text + "\"name\": \"" + Globals.String2Json(current2.Name) + "\",";
                        if (current2.Type == "click")
                        {
                            text = text + "\"key\": \"" + Globals.String2Json(current2.Content) + "\"},";
                        }
                        else
                        {
                            text = text + "\"url\": \"" + Globals.String2Json(current2.Content) + "\"},";
                        }
                    }
                    text  = text.Substring(0, text.Length - 1);
                    text += "]},";
                }
                else
                {
                    text = text + "\"type\": \"" + current.Type + "\",";
                    if (current.Type == "click")
                    {
                        text = text + "\"key\": \"" + Globals.String2Json(current.Content) + "\"},";
                    }
                    else
                    {
                        text = text + "\"url\": \"" + Globals.String2Json(current.Content) + "\"},";
                    }
                }
            }
            text  = text.Substring(0, text.Length - 1);
            text += "]";
            text += "}";
            WeiBo weiBo = new WeiBo();

            text = weiBo.createmenu(text);
            context.Response.Write(text);
        }
        public void reply(HttpContext context)
        {
            ReplyKeyInfo replyKeyInfo = new ReplyKeyInfo();
            string       s            = "{\"status\":\"0\"}";

            replyKeyInfo.Id       = int.Parse(context.Request["ID"]);
            replyKeyInfo.Matching = context.Request["Matching"];
            if (WeiboHelper.UpdateMatching(replyKeyInfo))
            {
                s = "{\"status\":\"1\"}";
            }
            context.Response.Write(s);
        }
Ejemplo n.º 14
0
        public void GetMessageInfo(HttpContext context)
        {
            string      s           = "{\"status\":\"0\"}";
            MessageInfo messageInfo = WeiboHelper.GetMessageInfo(int.Parse(context.Request["MessageId"]));

            if (messageInfo != null)
            {
                s = "{\"status\":\"1\",";
                object obj2 = ((((s + "\"SenderMessage\":\"" + messageInfo.SenderMessage + "\",") + "\"DisplayName\":\"" + messageInfo.DisplayName + "\",") + "\"Summary\":\"" + messageInfo.Summary + "\",") + "\"Image\":\"" + messageInfo.Image + "\",") + "\"Url\":\"" + messageInfo.Url + "\",";
                s = string.Concat(new object[] { obj2, "\"ArticleId\":\"", messageInfo.ArticleId, "\"" }) + "}";
            }
            context.Response.Write(s);
        }
Ejemplo n.º 15
0
        static void Main(string[] args)
        {
            Console.Title = "WeiboLike";
            timer         = new Timer(new TimerCallback(TimerUp), null, Timeout.Infinite, 1000);

            while (true)
            {
                //Console.WriteLine("请输入用户ID:");
                //string uid = Console.ReadLine();
                //if (string.IsNullOrEmpty(uid))
                //{
                //    continue;
                //}
                //Console.WriteLine("请输入微博ID:");
                //string weiboid = Console.ReadLine();
                //if (string.IsNullOrEmpty(weiboid))
                //{
                //    continue;
                //}
                Console.WriteLine("请粘贴微博URL链接:");
                string[] uidweiboid = WeiboHelper.GetUidWeiboID(Console.ReadLine());
                if (string.IsNullOrEmpty(uidweiboid[0]) || string.IsNullOrEmpty(uidweiboid[1]))
                {
                    Console.WriteLine("从链接获取uid/微博id失败,请重试。");
                    continue;
                }

                Console.WriteLine("正在获取Mid...");
                mid = WeiboHelper.GetMid(uidweiboid[0], uidweiboid[1]);
                if (string.IsNullOrEmpty(mid))
                {
                    Console.WriteLine("没有获取到Mid,请重试。");

                    continue;
                }
                Console.WriteLine("已获取到MID:" + mid);
                Console.WriteLine("请输入微博数据保存文件名:");
                savename = Console.ReadLine() + ".json";
                Console.WriteLine("开始抓取本条微博的点赞用户数据...");
                timer.Change(0, 1000);
                //第一步获取点赞基本数据
                ulist     = WeiboHelper.GetPageLikeLinks(mid, 1);
                totalpage = ulist.TotalPage;

                GetWeiboUser getWeiboUser = new GetWeiboUser(ulist.UserLinks, 60);
                getWeiboUser.GetCompleted += GetCompleted;
                getWeiboUser.Get();

                Console.ReadKey();
            }
        }
Ejemplo n.º 16
0
        private static string textMsg(string text, int MessageId)
        {
            JObject jObject = new JObject();

            jObject.Add("text", text);
            WeiboHelper.UpdateMessage(new MessageInfo
            {
                SenderDate    = System.DateTime.Now,
                SenderMessage = text,
                Status        = 2,
                MessageId     = MessageId
            });
            return(jObject.ToString());
        }
Ejemplo n.º 17
0
        public void addreply(System.Web.HttpContext context)
        {
            ReplyInfo replyInfo = new ReplyInfo();
            string    s         = "{\"status\":\"0\"}";

            replyInfo.EditDate     = System.DateTime.Now;
            replyInfo.IsDisable    = true;
            replyInfo.Type         = int.Parse(context.Request["Type"]);
            replyInfo.ReplyKeyId   = int.Parse(context.Request["ReplyKeyId"]);
            replyInfo.ReceiverType = context.Request["ReceiverType"];
            if (replyInfo.ReceiverType == "text")
            {
                replyInfo.Content = context.Request["Content"];
            }
            else
            {
                replyInfo.Url = context.Request["Url"];
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                string       text;
                if (!string.IsNullOrEmpty(masterSettings.ShopHomePic))
                {
                    text = Globals.HostPath(System.Web.HttpContext.Current.Request.Url) + masterSettings.ShopHomePic;
                }
                else
                {
                    text = Globals.HostPath(System.Web.HttpContext.Current.Request.Url) + masterSettings.DistributorBackgroundPic.Split(new char[]
                    {
                        '|'
                    })[0];
                }
                replyInfo.Image = text;
                if (string.IsNullOrEmpty(context.Request["Image"]) && string.IsNullOrEmpty(context.Request["Display_name"]) && string.IsNullOrEmpty(context.Request["Summary"]))
                {
                    replyInfo.Displayname = masterSettings.SiteName;
                    replyInfo.Summary     = (string.IsNullOrEmpty(masterSettings.ShopIntroduction) ? masterSettings.SiteName : masterSettings.ShopIntroduction);
                }
                else
                {
                    replyInfo.Image       = (string.IsNullOrEmpty(context.Request["Image"]) ? text : context.Request["Image"]);
                    replyInfo.Displayname = context.Request["Display_name"];
                    replyInfo.Summary     = context.Request["Summary"];
                    replyInfo.ArticleId   = int.Parse(context.Request["ArticleId"]);
                }
            }
            if (WeiboHelper.SaveReplyInfo(replyInfo))
            {
                s = "{\"status\":\"1\"}";
            }
            context.Response.Write(s);
        }
        public void savemenu(HttpContext context)
        {
            string           comment  = "{";
            IList <MenuInfo> topMenus = WeiboHelper.GetTopMenus();

            if (topMenus.Count > 0)
            {
                comment = comment + "\"button\":[";
                foreach (MenuInfo info in topMenus)
                {
                    IList <MenuInfo> menusByParentId = WeiboHelper.GetMenusByParentId(info.MenuId);
                    comment = comment + "{\"name\": \"" + Globals.String2Json(info.Name) + "\",";
                    if (menusByParentId.Count > 0)
                    {
                        comment = comment + "\"sub_button\":[";
                        foreach (MenuInfo info2 in menusByParentId)
                        {
                            comment = comment + "{\"type\": \"" + info2.Type + "\",";
                            comment = comment + "\"name\": \"" + Globals.String2Json(info2.Name) + "\",";
                            if (info2.Type == "click")
                            {
                                comment = comment + "\"key\": \"" + Globals.String2Json(info2.Content) + "\"},";
                            }
                            else
                            {
                                comment = comment + "\"url\": \"" + Globals.String2Json(info2.Content) + "\"},";
                            }
                        }
                        comment = comment.Substring(0, comment.Length - 1);
                        comment = comment + "]},";
                    }
                    else
                    {
                        comment = comment + "\"type\": \"" + info.Type + "\",";
                        if (info.Type == "click")
                        {
                            comment = comment + "\"key\": \"" + Globals.String2Json(info.Content) + "\"},";
                        }
                        else
                        {
                            comment = comment + "\"url\": \"" + Globals.String2Json(info.Content) + "\"},";
                        }
                    }
                }
                comment = comment.Substring(0, comment.Length - 1) + "]" + "}";
                comment = new global::ControlPanel.WeiBo.WeiBo().createmenu(comment);
                context.Response.Write(comment);
            }
        }
Ejemplo n.º 19
0
        private static string textMsg(string text, int MessageId)
        {
            JObject obj2 = new JObject();

            obj2.Add("text", (JToken)text);
            MessageInfo messageInfo = new MessageInfo {
                SenderDate    = DateTime.Now,
                SenderMessage = text,
                Status        = 2,
                MessageId     = MessageId
            };

            WeiboHelper.UpdateMessage(messageInfo);
            return(obj2.ToString());
        }
Ejemplo n.º 20
0
        private async void ShareToWeibo()
        {
            snsSharingBusy = true;
            string fileName = "TempShareWeibo";
            var    stream   = await ImageHelper.SaveBitmapToLocal(bitmap, fileName, true);

            ////var stream = await ImageHelper.BitmapToStream(bitmap);
            //var buffer = await bitmap.GetPixelsAsync();
            //var arr = buffer.ToArray();
            //MemoryStream ms = new MemoryStream(arr);

            await WeiboHelper.Share(stream, shareText);

            snsSharingBusy = false;
        }
        public void editmessage(HttpContext context)
        {
            ReplyInfo replyInfoMes = new ReplyInfo();
            string    s            = "{\"status\":\"0\"}";

            replyInfoMes = WeiboHelper.GetReplyInfoMes(int.Parse(context.Request["id"].ToString()));
            if (replyInfoMes != null)
            {
                s = "{\"status\":\"1\",";
                object obj2 = s + "\"Content\":\"" + Globals.String2Json(replyInfoMes.Content) + "\",";
                object obj3 = ((((string.Concat(new object[] { obj2, "\"Type\":\"", replyInfoMes.Type, "\"," }) + "\"ReceiverType\":\"" + replyInfoMes.ReceiverType + "\",") + "\"Displayname\":\"" + Globals.String2Json(replyInfoMes.Displayname) + "\",") + "\"Summary\":\"" + Globals.String2Json(replyInfoMes.Summary) + "\",") + "\"Image\":\"" + replyInfoMes.Image + "\",") + "\"Url\":\"" + replyInfoMes.Url + "\",";
                object obj4 = string.Concat(new object[] { obj3, "\"Article\":\"", replyInfoMes.ArticleId, "\"," });
                s = string.Concat(new object[] { obj4, "\"ReplyKeyId\":\"", replyInfoMes.ReplyKeyId, "\"" }) + "}";
            }
            context.Response.Write(s);
        }
Ejemplo n.º 22
0
        public void editreply(HttpContext context)
        {
            ReplyInfo replyInfo = new ReplyInfo();
            string    s         = "{\"status\":\"0\"}";

            replyInfo.Id           = int.Parse(context.Request["id"]);
            replyInfo.EditDate     = DateTime.Now;
            replyInfo.ReceiverType = context.Request["ReceiverType"];
            replyInfo.Type         = int.Parse(context.Request["Type"]);
            if (replyInfo.ReceiverType == "text")
            {
                replyInfo.Content = context.Request["Content"];
            }
            else
            {
                replyInfo.Url = context.Request["Url"];
                string       str2           = "";
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(false, wid);
                if (!string.IsNullOrEmpty(masterSettings.ShopHomePic))
                {
                    str2 = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.ShopHomePic;
                }
                else
                {
                    str2 = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.DistributorBackgroundPic.Split(new char[] { '|' })[0];
                }
                replyInfo.Image = str2;
                if ((string.IsNullOrEmpty(context.Request["Image"]) && string.IsNullOrEmpty(context.Request["Display_name"])) && string.IsNullOrEmpty(context.Request["Summary"]))
                {
                    replyInfo.Displayname = masterSettings.SiteName;
                    replyInfo.Summary     = string.IsNullOrEmpty(masterSettings.ShopIntroduction) ? masterSettings.SiteName : masterSettings.ShopIntroduction;
                }
                else
                {
                    replyInfo.Image       = string.IsNullOrEmpty(context.Request["Image"]) ? str2 : context.Request["Image"];
                    replyInfo.Displayname = context.Request["Display_name"];
                    replyInfo.Summary     = context.Request["Summary"];
                    replyInfo.ArticleId   = int.Parse(context.Request["ArticleId"]);
                }
            }
            if (WeiboHelper.UpdateReplyInfo(replyInfo))
            {
                s = "{\"status\":\"1\"}";
            }
            context.Response.Write(s);
        }
Ejemplo n.º 23
0
        private static string articleMsg(string display_name, string summary, string image, string url, string ArticleId, int MessageId)
        {
            JObject obj2 = new JObject();
            string  str  = "[";

            if (summary == "")
            {
                summary = display_name;
            }
            string str3 = str;

            str = str3 + "{'display_name':'" + display_name + "','summary':'" + summary + "','image':'" + image + "','url':'" + url + "'},";
            if (!string.IsNullOrEmpty(ArticleId) && (int.Parse(ArticleId) > 0))
            {
                IList <ArticleItemsInfo> articleItems = ArticleHelper.GetArticleItems(int.Parse(ArticleId));
                if (articleItems.Count > 0)
                {
                    foreach (ArticleItemsInfo info in articleItems)
                    {
                        string title = "";
                        if (info.Content.Trim() == "")
                        {
                            title = info.Title;
                        }
                        string str4 = str;
                        str = str4 + "{\"display_name\": \"" + info.Title + "\",\"summary\":\"" + title + "\",\"image\":\"http://" + Globals.DomainName + info.ImageUrl + "\",\"url\":\"" + info.Url + "\"},";
                    }
                }
            }
            MessageInfo messageInfo = new MessageInfo {
                SenderDate  = DateTime.Now,
                DisplayName = display_name,
                Summary     = summary,
                Image       = image,
                Url         = url,
                ArticleId   = int.Parse(ArticleId),
                Status      = 2,
                MessageId   = MessageId
            };

            WeiboHelper.UpdateMessage(messageInfo);
            str = str.Substring(0, str.Length - 1) + "]";
            obj2.Add("articles", (JToken)str);
            return(obj2.ToString());
        }
Ejemplo n.º 24
0
 public void bind()
 {
     MessageQuery messageQuery = new MessageQuery();
     if (!this.replycheck.Checked)
     {
         messageQuery.Status = int.Parse(this.status);
     }
     else
     {
         messageQuery.Status = 2;
     }
     messageQuery.PageSize = this.pager.PageSize;
     messageQuery.PageIndex = this.pager.PageIndex;
     DbQueryResult messages = WeiboHelper.GetMessages(messageQuery);
     this.RepMessage.DataSource = messages.Data;
     this.RepMessage.DataBind();
     this.pager.TotalRecords = messages.TotalRecords;
 }
Ejemplo n.º 25
0
 private void repreplykey_ItemCommand(object sender, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "del")
     {
         System.Collections.Generic.IList <ReplyInfo> replyInfo = WeiboHelper.GetReplyInfo(int.Parse(e.CommandArgument.ToString()));
         if (replyInfo.Count > 0)
         {
             this.ShowMsg("关键词中有回复信息,请先删除回复信息!", false);
             return;
         }
         if (WeiboHelper.DeleteReplyKeyInfo(int.Parse(e.CommandArgument.ToString())))
         {
             this.ShowMsg("关键词删除成功!", true);
             this.bind();
             return;
         }
         this.ShowMsg("关键词删除失败!", false);
     }
 }
Ejemplo n.º 26
0
        public void editmessage(System.Web.HttpContext context)
        {
            ReplyInfo replyInfo = new ReplyInfo();
            string    text      = "{\"status\":\"0\"}";

            replyInfo = WeiboHelper.GetReplyInfoMes(int.Parse(context.Request["id"].ToString()));
            if (replyInfo != null)
            {
                text = "{\"status\":\"1\",";
                text = text + "\"Content\":\"" + Globals.String2Json(replyInfo.Content) + "\",";
                object obj = text;
                text = string.Concat(new object[]
                {
                    obj,
                    "\"Type\":\"",
                    replyInfo.Type,
                    "\","
                });
                text = text + "\"ReceiverType\":\"" + replyInfo.ReceiverType + "\",";
                text = text + "\"Displayname\":\"" + Globals.String2Json(replyInfo.Displayname) + "\",";
                text = text + "\"Summary\":\"" + Globals.String2Json(replyInfo.Summary) + "\",";
                text = text + "\"Image\":\"" + replyInfo.Image + "\",";
                text = text + "\"Url\":\"" + replyInfo.Url + "\",";
                object obj2 = text;
                text = string.Concat(new object[]
                {
                    obj2,
                    "\"Article\":\"",
                    replyInfo.ArticleId,
                    "\","
                });
                object obj3 = text;
                text = string.Concat(new object[]
                {
                    obj3,
                    "\"ReplyKeyId\":\"",
                    replyInfo.ReplyKeyId,
                    "\""
                });
                text += "}";
            }
            context.Response.Write(text);
        }
Ejemplo n.º 27
0
 private void repreplykey_ItemCommand(object sender, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "del")
     {
         if (WeiboHelper.GetReplyInfo(int.Parse(e.CommandArgument.ToString())).Count > 0)
         {
             this.ShowMsg("关键词中有回复信息,请先删除回复信息!", false);
         }
         else if (WeiboHelper.DeleteReplyKeyInfo(int.Parse(e.CommandArgument.ToString())))
         {
             this.ShowMsg("关键词删除成功!", true);
             this.bind();
         }
         else
         {
             this.ShowMsg("关键词删除失败!", false);
         }
     }
 }
        public void GetTopMenus(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            string           s        = "{";
            IList <MenuInfo> topMenus = WeiboHelper.GetTopMenus();

            if (topMenus.Count <= 0)
            {
                s = s + "\"status\":\"-1\"";
            }
            else
            {
                s = s + "\"status\":\"0\",\"data\":[";
                foreach (MenuInfo info in topMenus)
                {
                    IList <MenuInfo> menusByParentId = WeiboHelper.GetMenusByParentId(info.MenuId);
                    object           obj2            = s;
                    s = string.Concat(new object[] { obj2, "{\"menuid\": \"", info.MenuId, "\"," });
                    s = s + "\"childdata\":[";
                    if (menusByParentId.Count > 0)
                    {
                        foreach (MenuInfo info2 in menusByParentId)
                        {
                            object obj3 = s;
                            s = string.Concat(new object[] { obj3, "{\"menuid\": \"", info2.MenuId, "\"," });
                            object obj4 = s;
                            s = string.Concat(new object[] { obj4, "\"parentmenuid\": \"", info2.ParentMenuId, "\"," });
                            s = s + "\"type\": \"" + info2.Type + "\",";
                            s = s + "\"name\": \"" + Globals.String2Json(info2.Name) + "\",";
                            s = s + "\"content\": \"" + Globals.String2Json(info2.Content) + "\"},";
                        }
                        s = s.Substring(0, s.Length - 1);
                    }
                    s = s + "],";
                    s = s + "\"type\": \"" + info.Type + "\",";
                    s = s + "\"name\": \"" + Globals.String2Json(info.Name) + "\",";
                    s = s + "\"content\": \"" + Globals.String2Json(info.Content) + "\"},";
                }
                s = s.Substring(0, s.Length - 1) + "]" + "}";
                context.Response.Write(s);
            }
        }
Ejemplo n.º 29
0
        public void delmenu(System.Web.HttpContext context)
        {
            context.Response.ContentType = "application/json";
            string s   = "{\"status\":\"1\"}";
            int    num = 0;

            if (!int.TryParse(context.Request["MenuId"], out num))
            {
                return;
            }
            System.Collections.Generic.IList <MenuInfo> menusByParentId = WeiboHelper.GetMenusByParentId(num);
            if (menusByParentId.Count > 0)
            {
                s = "{\"status\":\"2\"}";
            }
            else if (WeiboHelper.DeleteMenu(num))
            {
                s = "{\"status\":\"0\"}";
            }
            context.Response.Write(s);
        }
        public void delmenu(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            string s      = "{\"status\":\"1\"}";
            int    result = 0;

            if (!int.TryParse(context.Request["MenuId"], out result))
            {
                s = "{\"status\":\"1\"}";
            }
            else
            {
                if (WeiboHelper.GetMenusByParentId(result).Count > 0)
                {
                    s = "{\"status\":\"2\"}";
                }
                else if (WeiboHelper.DeleteMenu(result))
                {
                    s = "{\"status\":\"0\"}";
                }
                context.Response.Write(s);
            }
        }