You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.1 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. //using Swift.DAL.SocialWall.Feeds;
  8. using Swift.web.Library;
  9. using System.Runtime.Serialization;
  10. using Newtonsoft.Json;
  11. using System.Web.Script.Serialization;
  12. using System.Text;
  13. using System.Data;
  14. using Swift.API.TPAPIs.GMESocialWallAPI;
  15. using Swift.API;
  16. namespace Swift.web.Remit.SocialWall.Feeds
  17. {
  18. public partial class BlockUnblockFeed : System.Web.UI.Page
  19. {
  20. protected void Page_Load(object sender, EventArgs e)
  21. {
  22. var methodName = Request.Form["methodName"];
  23. if(!IsPostBack)
  24. {
  25. if (methodName == "BlockUnblockFeed")
  26. {
  27. var feedId = Request.Form["feedId"];
  28. var msg = Request.Form["Message"];
  29. BlockFeed(feedId, msg);
  30. }
  31. }
  32. }
  33. private void BlockFeed(string feedId,string msg)
  34. {
  35. var dbResult = new DbResult();
  36. ISocialWallAPIService _socialWall = new SocialWallAPIService();
  37. var data = new BlockUnblockFeedParameters()
  38. {
  39. feedId = feedId
  40. ,userId = GetStatic.ReadWebConfig("socialWallAdmin")
  41. ,blockedMessage=msg
  42. };
  43. var feeds = _socialWall.BlockUnblockFeed(data, out dbResult);
  44. if(dbResult.ErrorCode=="0")
  45. {
  46. dbResult.SetError(dbResult.ErrorCode, dbResult.Msg, null);
  47. }
  48. else
  49. {
  50. dbResult.SetError(dbResult.ErrorCode, dbResult.Msg, null);
  51. }
  52. JsonSerialize(dbResult);
  53. }
  54. private void JsonSerialize<T>(T obk)
  55. {
  56. JavaScriptSerializer jsonData = new JavaScriptSerializer();
  57. string jsonString = jsonData.Serialize(obk);
  58. HttpContext.Current.Response.ContentType = "application/json";
  59. HttpContext.Current.Response.Write(jsonString);
  60. HttpContext.Current.Response.End();
  61. }
  62. }
  63. }