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.

89 lines
2.9 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.Common;
  16. using Swift.web.Component.Grid;
  17. using Swift.web.Component.Grid.gridHelper;
  18. using Swift.API;
  19. using Swift.DAL.OnlineAgent;
  20. namespace Swift.web.Remit.SocialWall.Feeds
  21. {
  22. public partial class FeedDetail : System.Web.UI.Page
  23. {
  24. OnlineCustomerDao cust = new OnlineCustomerDao();
  25. protected void Page_Load(object sender, EventArgs e)
  26. {
  27. if(!IsPostBack)
  28. {
  29. PopulateCountryList();
  30. }
  31. var feedId = GetStatic.ReadQueryString("feedId","");
  32. var methodName = Request.Form["methodName"];
  33. if (methodName=="SearchFeeds")
  34. {
  35. SearchFeed();
  36. }
  37. }
  38. private void SearchFeed()
  39. {
  40. var dbResult = new DbResult();
  41. var data = new FeedRequest()
  42. {
  43. //userId = Request.Form["userId"],
  44. userId = GetStatic.ReadWebConfig("socialWallAdmin"),
  45. country = Request.Form["country"],
  46. onlyReported = Request.Form["onlyReported"],
  47. before = Request.Form["before"],
  48. after = Request.Form["after"],
  49. limit = Request.Form["limit"]
  50. };
  51. ISocialWallAPIService _socialWall = new SocialWallAPIService();
  52. var feedResponse = new FeedResponse();
  53. feedResponse = _socialWall.GetFeeds(data,out dbResult);
  54. if(dbResult.ErrorCode=="0")
  55. {
  56. JsonSerialize(feedResponse);
  57. }
  58. else
  59. {
  60. GetStatic.SweetAlertErrorMessage(Page, "Error", dbResult.Msg);
  61. }
  62. }
  63. private void PopulateCountryList()
  64. {
  65. DataTable dt = cust.GetAllReceiverCountryList(GetStatic.GetUser());
  66. if (dt.Rows.Count == 0 || dt == null)
  67. {
  68. return;
  69. }
  70. ddlOperativeCountry.DataSource = dt;
  71. ddlOperativeCountry.DataTextField = "countryName";
  72. ddlOperativeCountry.DataValueField = "countryName";
  73. ddlOperativeCountry.DataBind();
  74. ddlOperativeCountry.Items.Insert(0, new ListItem("-Select Country-", "-Select Country-"));
  75. ddlOperativeCountry.SelectedIndex = 0;
  76. }
  77. private void JsonSerialize<T>(T obk)
  78. {
  79. JavaScriptSerializer jsonData = new JavaScriptSerializer();
  80. string jsonString = jsonData.Serialize(obk);
  81. Response.ContentType = "application/json";
  82. Response.Write(jsonString);
  83. Response.End();
  84. }
  85. }
  86. }