public void deletemenu(System.Web.HttpContext context) { WeiBo weiBo = new WeiBo(); string s = weiBo.deletemenu(); context.Response.Write(s); }
public void WeiBoSqlHelper_GetList() { var result = new WeiBo().GetList(); Assert.IsNotNull(result); Assert.IsTrue(result.Count > 0); }
public void userinfo(System.Web.HttpContext context) { WeiBo weiBo = new WeiBo(); string s = weiBo.userinfo(); context.Response.Write(s); }
public void getfriends(System.Web.HttpContext context) { WeiBo weiBo = new WeiBo(); string s = weiBo.getfriends(); context.Response.Write(s); }
public void user_timeline(System.Web.HttpContext context) { WeiBo weiBo = new WeiBo(); string s = weiBo.user_timeline(int.Parse(context.Request["page"])); context.Response.Write(s); }
public void commentscreate(System.Web.HttpContext context) { WeiBo weiBo = new WeiBo(); string s = weiBo.commentscreate(context.Request["id"], context.Request["comment"]); context.Response.Write(s); }
public void deletemenu(HttpContext context) { WeiBo bo = new WeiBo(); string s = ""; s = bo.deletemenu(); context.Response.Write(s); }
public void createmenu(System.Web.HttpContext context) { WeiBo weiBo = new WeiBo(); string s = ""; if (!string.IsNullOrEmpty(context.Request["comment"])) { s = weiBo.createmenu(context.Request["comment"]); } context.Response.Write(s); }
public void statusesupdate(System.Web.HttpContext context) { WeiBo weiBo = new WeiBo(); string s = ""; if (!string.IsNullOrEmpty(context.Request["status"])) { s = weiBo.statusesupdate(context.Request["status"].ToString().Replace("alert", "Alert"), context.Request["img"]); } context.Response.Write(s); }
public void statusesupdate(HttpContext context) { WeiBo bo = new WeiBo(); string s = ""; if (!string.IsNullOrEmpty(context.Request["status"])) { s = bo.statusesupdate(context.Request["status"], context.Request["img"]); } context.Response.Write(s); }
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 SendToUIDMessage(HttpContext context) { WeiBo bo = new WeiBo(); string msgtype = context.Request["msgtype"]; string displayname = context.Request["displayname"]; string summary = context.Request["summary"]; string image = context.Request["image"]; string url = context.Request["url"]; string content = context.Request["Content"]; string articleId = context.Request["ArticleId"]; string s = bo.SendToUIDMessage(msgtype, displayname, summary, image, url, content, articleId); 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\": \"" + info.Name + "\","; if (menusByParentId.Count > 0) { comment = comment + "\"sub_button\":["; foreach (MenuInfo info2 in menusByParentId) { comment = comment + "{\"type\": \"" + info2.Type + "\","; comment = comment + "\"name\": \"" + info2.Name + "\","; if (info2.Type == "click") { comment = comment + "\"key\": \"" + info2.Content + "\"},"; } else { comment = comment + "\"url\": \"" + info2.Content + "\"},"; } } comment = comment.Substring(0, comment.Length - 1); comment = comment + "]},"; } else { comment = comment + "\"type\": \"" + info.Type + "\","; if (info.Type == "click") { comment = comment + "\"key\": \"" + info.Content + "\"},"; } else { comment = comment + "\"url\": \"" + info.Content + "\"},"; } } } comment = comment.Substring(0, comment.Length - 1) + "]" + "}"; comment = new WeiBo().createmenu(comment); context.Response.Write(comment); } }
private void RepMessage_ItemDataBound(object sender, RepeaterItemEventArgs e) { if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) { string id = DataBinder.Eval(e.Item.DataItem, "Sender_id").ToString(); WeiBo bo = new WeiBo(); JObject obj2 = JObject.Parse(bo.userinfo(id)); Literal literal = (Literal)e.Item.FindControl("LitUserName"); if (obj2["id"] != null) { Image image = (Image)e.Item.FindControl("Pic"); image.ImageUrl = obj2["profile_image_url"].ToString(); literal.Text = obj2["screen_name"].ToString(); } if (string.IsNullOrEmpty(literal.Text)) { literal.Text = "您访问太过频繁,微博接口禁止调用。"; } } }
private void RepMessage_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) { string id = System.Web.UI.DataBinder.Eval(e.Item.DataItem, "Sender_id").ToString(); WeiBo weiBo = new WeiBo(); string json = weiBo.userinfo(id); JObject jObject = JObject.Parse(json); System.Web.UI.WebControls.Literal literal = (System.Web.UI.WebControls.Literal)e.Item.FindControl("LitUserName"); if (jObject["id"] != null) { System.Web.UI.WebControls.Image image = (System.Web.UI.WebControls.Image)e.Item.FindControl("Pic"); image.ImageUrl = jObject["profile_image_url"].ToString(); literal.Text = jObject["screen_name"].ToString(); } if (string.IsNullOrEmpty(literal.Text)) { literal.Text = "您访问太过频繁,微博接口禁止调用。"; } } }
public void sendmessage(System.Web.HttpContext context) { WeiBo weiBo = new WeiBo(); string type = context.Request["msgtype"]; string receiver_id = context.Request["SenderId"]; string s = context.Request["MessageId"]; string msgtype = context.Request["msgtype"]; string text = context.Request["displayname"]; string summary = context.Request["summary"]; string image = context.Request["image"]; string url = context.Request["url"]; string text2 = context.Request["Content"]; string text3 = context.Request["ArticleId"]; string data = this.SendToUIDMessage(msgtype, text, summary, image, url, text2, text3); string text4 = weiBo.sendmessage(type, receiver_id, data); JObject jObject = JObject.Parse(text4); if (jObject["result"] != null && jObject["result"].ToString() == "true") { MessageInfo messageInfo = new MessageInfo(); if (!string.IsNullOrEmpty(text3)) { messageInfo.ArticleId = int.Parse(text3); } messageInfo.DisplayName = text; messageInfo.Summary = summary; messageInfo.SenderMessage = text2; messageInfo.Url = url; messageInfo.Image = image; messageInfo.SenderDate = System.DateTime.Now; messageInfo.MessageId = int.Parse(s); messageInfo.Status = 1; WeiboHelper.UpdateMessage(messageInfo); } context.Response.Write(text4); }
public void sendmessage(HttpContext context) { WeiBo bo = new WeiBo(); string type = context.Request["msgtype"]; string str2 = context.Request["SenderId"]; string s = context.Request["MessageId"]; string msgtype = context.Request["msgtype"]; string displayname = context.Request["displayname"]; string summary = context.Request["summary"]; string image = context.Request["image"]; string url = context.Request["url"]; string content = context.Request["Content"]; string articleId = context.Request["ArticleId"]; string data = this.SendToUIDMessage(msgtype, displayname, summary, image, url, content, articleId); string str12 = bo.sendmessage(type, str2, data); JObject obj2 = JObject.Parse(str12); if ((obj2["result"] != null) && (obj2["result"].ToString() == "true")) { MessageInfo messageInfo = new MessageInfo(); if (!string.IsNullOrEmpty(articleId)) { messageInfo.ArticleId = int.Parse(articleId); } messageInfo.DisplayName = displayname; messageInfo.Summary = summary; messageInfo.SenderMessage = content; messageInfo.Url = url; messageInfo.Image = image; messageInfo.SenderDate = DateTime.Now; messageInfo.MessageId = int.Parse(s); messageInfo.Status = 1; WeiboHelper.UpdateMessage(messageInfo); } context.Response.Write(str12); }
// 授权方式: oAuth2.0授权 选择其它授权方式 //获取粉丝 public void GetMyFenSi() { string access_token = "cb62cb49b85629f29c2f33d3ce13dc81"; string s = Session["oauth_token"].ToString(); string openid = Session["openid"].ToString(); string openkey = Session["openkey"].ToString(); string para = "reqnum=20&mode=0&startindex=0&install=0&" + "sex=0&format=xml&access_token=" + access_token + "&" + "oauth_consumer_key=" + appKey + "&openid=" + openid + "&" + "oauth_version=2.a&clientip=" + Request.UserHostAddress + "&scope=all&appfrom=php-sdk2.0beta&" + "seqid=1374547282&serverip=183.60.10.172"; byte[] postBytes = Encoding.GetEncoding("utf-8").GetBytes(para); HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create("https://open.t.qq.com/api/friends/fanslist_name"); req.Method = "post"; req.ContentType = "application/x-www-form-urlencoded"; req.ContentLength = postBytes.Length; using (Stream reqStream = req.GetRequestStream()) { reqStream.Write(postBytes, 0, postBytes.Length); } using (WebResponse wr = req.GetResponse()) { //在这里对接收到的页面内容进行处理 StreamReader sr = new StreamReader(wr.GetResponseStream()); string data = sr.ReadToEnd().Trim(); WeiBo weibo = YK.Common.JsonHelper.ParseFormByJson <WeiBo>(data); GridView1.DataSource = weibo.data.info; GridView1.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { optionName = Request["optionName"].ToString(); listid = Request["listid"].ToString(); userId = Convert.ToInt32(Request["userId"]); guestid = Convert.ToInt32(Request["guestid"]); switch (optionName) { case "save": wb.authorId = Convert.ToInt32(Request["authorId"]); wb.authorName = Request["authorName"]; wb.content = Request["content"]; wb.createTime = DateTime.Now; wb.isOriginal = Request["isOriginal"]; wb.transmitNumber = Convert.ToInt32(Request["transmitNumber"]); wb.zanNumber = Convert.ToInt32(Request["zanNumber"]); wb.reviewNumber = Convert.ToInt32(Request["reviewNumber"]); wb.favsNumber = Convert.ToInt32(Request["favsNumber"]); wb.orTime = DateTime.Now; //为防止数据为空报错,设置的默认数据不显示不影响程序 if (wb.content != null && wb.content != "" && wb.authorName != null && wb.authorName != "" && wb.authorId != 0) { if (wbll.save(wb)) { } } break; case "btnZan": wb.weiboId = Convert.ToInt32(Request["weiboId"]); WeiBo wb2 = wbll.findWeiboByweiboId(wb.weiboId); wb2.zanNumber = wb2.zanNumber + 1; if (wbll.updateZanFavsReviewTrans(wb2)) { Response.Write("<Script>alert('点赞成功')</Script>"); } break; case "btnFavs": wb.weiboId = Convert.ToInt32(Request["weiboId"]); if (fbll.findFavoritesByweiboIdandfavPersonId(wb.weiboId, guestid) != null) { Response.Write("<Script>alert('该微博已在收藏夹中')</Script>"); } else { WeiBo wb3 = wbll.findWeiboByweiboId(wb.weiboId); wb3.favsNumber = wb3.favsNumber + 1; f.weiboId = wb.weiboId; f.favPersonId = guestid; f.createTime = DateTime.Now; if (wbll.updateZanFavsReviewTrans(wb3) && fbll.save(f)) { //Response.Write("<Script>alert('收藏成功')</Script>"); } } break; case "review": wb.weiboId = Convert.ToInt32(Request["weiboId"]); WeiBo wb4 = wbll.findWeiboByweiboId(wb.weiboId); wb4.reviewNumber = wb4.reviewNumber + 1; if (wbll.updateZanFavsReviewTrans(wb4)) { Response.Write("<Script>alert('评论成功')</Script>"); } break; case "addFocus": fms.onselfId = userId; fms.otherId = Convert.ToInt32(Request["authorId"]); fms.createTime = DateTime.Now; if (fms.onselfId == fms.otherId) { Response.Write("<Script>alert('对自己加关注无效')</Script>"); } else { if (fmbll.findFansMarksByonselfIdandotherId(fms.onselfId, fms.otherId) != null) { Response.Write("<Script>alert('已添加关注')</Script>"); } else { if (fmbll.save(fms)) { Response.Write("<Script>alert('关注成功')</Script>"); } } } break; case "btnTrans": WeiBo wbt = wbll.findWeiboByweiboId(Convert.ToInt32(Request["weiboId"])); wb.authorId = wbt.authorId; wb.authorName = wbt.authorName; wb.content = wbt.content; wb.createTime = wb.createTime; wb.isOriginal = "转发"; wb.transmitNumber = wbt.transmitNumber + 1; wb.zanNumber = wbt.zanNumber; wb.reviewNumber = wbt.reviewNumber; wb.favsNumber = wbt.favsNumber; wb.orTime = DateTime.Now; wb.orAuthorId = guestid; wb.orAuthorName = Request["guestname"].ToString(); wb.orContent = Request["transContent"].ToString(); if (wb.content != null && wb.content != "" && wb.authorName != null && wb.authorName != "" && wb.authorId != 0) { if (wbll.save(wb)) { } } break; } dlDataBind(userId, listid); } }
public void getfriends(HttpContext context) { string s = new WeiBo().getfriends(); context.Response.Write(s); }
public void friends_timeline(HttpContext context) { string s = new WeiBo().friends_timeline(int.Parse(context.Request["page"])); context.Response.Write(s); }
public bool save(WeiBo WeiBo) { return(dll.save(WeiBo)); }
public void userinfo(HttpContext context) { string s = new WeiBo().userinfo(); context.Response.Write(s); }
//根据weiboId更新微博(Zan) public bool updateZanFavsReviewTrans(WeiBo wb) { return(dll.updateZanFavsReviewTrans(wb)); }
public void repost(HttpContext context) { string s = new WeiBo().repost(context.Request["id"], context.Request["comment"]); context.Response.Write(s); }