//public static Dictionary<string, Dictionary<List<object>, List<object>>> GetGroupsMenuAccordingToGroup() //{ // User objUser = (User)System.Web.HttpContext.Current.Session["User"]; // Dictionary<string, Dictionary<List<object>, List<object>>> _ReturnDicValue = new Dictionary<string, Dictionary<List<object>, List<object>>>(); // Dictionary<List<object>, List<object>> dic_profilessnap = new Dictionary<List<object>, List<object>>(); // List<object> socialaccounts = null; // List<object> accountsgroup = null; // socialaccounts = new List<object>(); // accountsgroup = new List<object>(); // Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); // List<FacebookAccount> lstFacebookAccount = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>))); // foreach (var FacebookAccount in lstFacebookAccount) // { // List<FacebookGroup> lstFacebookGroup = GetGroupName(FacebookAccount.AccessToken.ToString()); // if (lstFacebookGroup == null || lstFacebookGroup.Count==0) // { // accountsgroup.Add(null); // } // foreach (var FacebookGroup in lstFacebookGroup) // { // accountsgroup.Add(FacebookGroup); // } // socialaccounts.Add(FacebookAccount); // } // dic_profilessnap.Add(socialaccounts, accountsgroup); // _ReturnDicValue.Add("facebook", dic_profilessnap); // dic_profilessnap = new Dictionary<List<object>, List<object>>(); // socialaccounts = new List<object>(); // accountsgroup = new List<object>(); // Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount(); // Api.Linkedin.Linkedin ApiobjLinkedin = new Api.Linkedin.Linkedin(); // List<LinkedInAccount> lstLinkedinAccount = (List<LinkedInAccount>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetAllLinkedinAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<LinkedInAccount>))); // foreach (var LinkedInAccount in lstLinkedinAccount) // { // //var testJsonStr= ApiobjLinkedin.GetLinkedGroupsDetail(LinkedInAccount.LinkedinUserId.ToString(), LinkedInAccount.UserId.ToString()); // //List<LinkedInGroup> objLinkedInGroup = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LinkedInGroup>>(testJsonStr); // List<LinkedInGroup.Group_Updates> objLinkedInGroup = (List<LinkedInGroup.Group_Updates>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedin.GetLinkedGroupsDetail(LinkedInAccount.LinkedinUserId.ToString(), LinkedInAccount.UserId.ToString()), typeof(List<LinkedInGroup.Group_Updates>))); // //Newtonsoft.Json.Linq.JObject obj = JObject.Parse(testJsonStr); // foreach (var LinkedInGroup in objLinkedInGroup) // { // accountsgroup.Add(LinkedInGroup); // } // socialaccounts.Add(LinkedInAccount); // } // dic_profilessnap.Add(socialaccounts, accountsgroup); // _ReturnDicValue.Add("linkedin", dic_profilessnap); // return _ReturnDicValue; //} public static Dictionary<string, Dictionary<object, List<object>>> GetGroupsMenuAccordingToGroup() { User objUser = (User)System.Web.HttpContext.Current.Session["User"]; Dictionary<string, Dictionary<object, List<object>>> _ReturnDicValue = new Dictionary<string, Dictionary<object, List<object>>>(); Dictionary<object, List<object>> dic_profilessnap = new Dictionary<object, List<object>>(); object socialaccounts = null; List<object> accountsgroup = null; socialaccounts = new object(); Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); ApiobjFacebookAccount.Timeout = 300000; List<FacebookAccount> lstFacebookAccount = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>))); foreach (var FacebookAccount in lstFacebookAccount) { accountsgroup = new List<object>(); List<FacebookGroup> lstFacebookGroup = GetGroupName(FacebookAccount.AccessToken.ToString()); foreach (var FacebookGroup in lstFacebookGroup) { accountsgroup.Add(FacebookGroup); } socialaccounts = (object)FacebookAccount; dic_profilessnap.Add(socialaccounts, accountsgroup); } _ReturnDicValue.Add("facebook", dic_profilessnap); dic_profilessnap = new Dictionary<object, List<object>>(); socialaccounts = new object(); accountsgroup = new List<object>(); Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount(); ApiobjLinkedinAccount.Timeout = 300000; Api.Linkedin.Linkedin ApiobjLinkedin = new Api.Linkedin.Linkedin(); List<LinkedInAccount> lstLinkedinAccount = (List<LinkedInAccount>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetAllLinkedinAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<LinkedInAccount>))); foreach (var LinkedInAccount in lstLinkedinAccount) { accountsgroup = new List<object>(); List<LinkedInGroup.Group_Updates> objLinkedInGroup = (List<LinkedInGroup.Group_Updates>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedin.GetLinkedGroupsDetail(LinkedInAccount.LinkedinUserId.ToString(), LinkedInAccount.UserId.ToString()), typeof(List<LinkedInGroup.Group_Updates>))); foreach (var LinkedInGroup in objLinkedInGroup) { accountsgroup.Add(LinkedInGroup); } socialaccounts = (object)LinkedInAccount; dic_profilessnap.Add(socialaccounts, accountsgroup); } _ReturnDicValue.Add("linkedin", dic_profilessnap); return _ReturnDicValue; }
public async Task <ActionResult> GroupShareathonEdit(string Id) { User objuser = (User)Session["User"]; string accesstoken = string.Empty; if (Session["access_token"] != null) { accesstoken = Session["access_token"].ToString(); } List <KeyValuePair <string, string> > param = new List <KeyValuePair <string, string> >(); List <KeyValuePair <string, string> > lst = new List <KeyValuePair <string, string> >(); ShareathonGroup sharethons = null; HttpResponseMessage response = await WebApiReq.GetReq("api/ApiShareathon/GetGroupShareaton?Id=" + Id, "Bearer", accesstoken); if (response.IsSuccessStatusCode) { sharethons = await response.Content.ReadAsAsync <Domain.Socioboard.Domain.ShareathonGroup>(); //FacebookClient fb = new FacebookClient(); //fb.AccessToken = sharethons.AccessToken; //System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls; //dynamic profile = fb.Get("v2.0/" + sharethons.Facebookgroupid + "?fields=id,name"); //ViewBag.GroupId = (Convert.ToString(profile["id"])); //ViewBag.Groupname = (Convert.ToString(profile["name"])); string [] nameId = sharethons.Facebooknameid.Split(','); string id = ""; for (int i = 0; i < nameId.Length; i++) { string [] name = Regex.Split(nameId[i], "###"); id = name[0] + "," + id; //lst.Add(new KeyValuePair<string,string>(nameId[i], name[1])); } ViewBag.GroupId = id; Api.Facebook.Facebook ApiFacebook = new Api.Facebook.Facebook(); List <AddFacebookGroup> lstFacebookGroup = new List <AddFacebookGroup>(); string fcebookgrp = ApiFacebook.GetAllFacebookGroups(sharethons.AccessToken); lstFacebookGroup = (List <AddFacebookGroup>)(new JavaScriptSerializer().Deserialize(fcebookgrp, typeof(List <AddFacebookGroup>))); if (lstFacebookGroup.Count > 0) { ViewBag.facebbokgroup = lstFacebookGroup; } else { ViewBag.facebbokgroup = null; } } Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); List <FacebookAccount> facebookaccounts = (List <FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objuser.Id.ToString(), Session["group"].ToString()), typeof(List <FacebookAccount>))); ViewBag.FbAccounts = facebookaccounts; ViewBag.UserId = objuser.Id; ViewBag.Group = lst; return(View(sharethons)); }
public static Dictionary<string, List<object>> GetFeedsMenuAccordingToGroup() { Dictionary<string, List<object>> dic_profilessnap = new Dictionary<string, List<object>>(); try { User objUser = (User)System.Web.HttpContext.Current.Session["User"]; Api.Groups.Groups ApiobjGroups = new Api.Groups.Groups(); ApiobjGroups.Timeout = 300000; Groups objGroups = (Groups)(new JavaScriptSerializer().Deserialize(ApiobjGroups.GetGroupDetailsByGroupId(System.Web.HttpContext.Current.Session["group"].ToString()), typeof(Groups))); List<object> socialaccounts = null; socialaccounts = new List<object>(); Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); ApiobjFacebookAccount.Timeout = 300000; List<FacebookAccount> lstFacebookAccount = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objGroups.UserId.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>))); foreach (var FacebookAccount in lstFacebookAccount) { socialaccounts.Add(FacebookAccount); } dic_profilessnap.Add("facebook", socialaccounts); socialaccounts = new List<object>(); Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount(); ApiobjTwitterAccount.Timeout = 300000; List<TwitterAccount> lstTwitterAccount = (List<TwitterAccount>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetAllTwitterAccountsByUserIdAndGroupId(objGroups.UserId.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<TwitterAccount>))); foreach (var TwitterAccount in lstTwitterAccount) { socialaccounts.Add(TwitterAccount); } dic_profilessnap.Add("twitter", socialaccounts); socialaccounts = new List<object>(); Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount(); ApiobjLinkedinAccount.Timeout = 300000; List<LinkedInAccount> lstLinkedinAccount = (List<LinkedInAccount>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetAllLinkedinAccountsByUserIdAndGroupId(objGroups.UserId.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<LinkedInAccount>))); foreach (var LinkedInAccount in lstLinkedinAccount) { socialaccounts.Add(LinkedInAccount); } dic_profilessnap.Add("linkedin", socialaccounts); socialaccounts = new List<object>(); Api.LinkedinCompanyPage.LinkedinCompanyPage ApiobjLinkedinCompanyPage = new Api.LinkedinCompanyPage.LinkedinCompanyPage(); ApiobjLinkedinCompanyPage.Timeout = 300000; List<LinkedinCompanyPage> lstLinkedinCompanyPage = (List<LinkedinCompanyPage>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinCompanyPage.GetAllLinkedinCompanyPageByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<LinkedinCompanyPage>))); foreach (var LiCompanyPage in lstLinkedinCompanyPage) { socialaccounts.Add(LiCompanyPage); } dic_profilessnap.Add("linkedincompanypage", socialaccounts); socialaccounts = new List<object>(); Api.InstagramAccount.InstagramAccount ApiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount(); ApiobjInstagramAccount.Timeout = 300000; List<InstagramAccount> lstInstagramAccount = (List<InstagramAccount>)(new JavaScriptSerializer().Deserialize(ApiobjInstagramAccount.GetAllInstagramAccountsByUserIdAndGroupId(objGroups.UserId.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<InstagramAccount>))); foreach (var InstagramAccount in lstInstagramAccount) { socialaccounts.Add(InstagramAccount); } dic_profilessnap.Add("instagram", socialaccounts); socialaccounts = new List<object>(); Api.TumblrAccount.TumblrAccount ApiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount(); ApiobjTumblrAccount.Timeout = 300000; List<TumblrAccount> lstTumblrAccount = (List<TumblrAccount>)(new JavaScriptSerializer().Deserialize(ApiobjTumblrAccount.GetAllTumblrAccountsByUserIdAndGroupId(objGroups.UserId.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<TumblrAccount>))); foreach (var TumblrAccount in lstTumblrAccount) { socialaccounts.Add(TumblrAccount); } dic_profilessnap.Add("tumblr", socialaccounts); socialaccounts = new List<object>(); Api.YoutubeAccount.YoutubeAccount ApiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount(); ApiobjYoutubeAccount.Timeout = 300000; List<YoutubeAccount> lstYoutubeAccount = (List<YoutubeAccount>)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeAccount.GetAllYoutubeAccountsByUserIdAndGroupId(objGroups.UserId.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<YoutubeAccount>))); foreach (var YoutubeAccount in lstYoutubeAccount) { socialaccounts.Add(YoutubeAccount); } dic_profilessnap.Add("youtube", socialaccounts); socialaccounts = new List<object>(); Api.GooglePlusAccount.GooglePlusAccount ApiobjGooglePlusAccount = new Api.GooglePlusAccount.GooglePlusAccount(); ApiobjGooglePlusAccount.Timeout = 300000; List<GooglePlusAccount> lstGooglePlusAccount = (List<GooglePlusAccount>)(new JavaScriptSerializer().Deserialize(ApiobjGooglePlusAccount.GetAllBloggerAccountByUserIdAndGroupId(objGroups.UserId.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<GooglePlusAccount>))); foreach (var _GooglePlusAccount in lstGooglePlusAccount) { socialaccounts.Add(_GooglePlusAccount); } dic_profilessnap.Add("gplus", socialaccounts); } catch (Exception ex) { logger.Error(ex.StackTrace); logger.Error(ex.Message); } return dic_profilessnap; }
public async Task <ActionResult> EditGroup(ShareathonGroupViewModel shareathon) { string groupId = ""; string nameId = ""; for (int i = 0; i < shareathon.FacebookGroupId.Length; i++) { string dataid = shareathon.FacebookGroupId[i]; string[] grpid = Regex.Split(dataid, "###"); groupId = grpid[0] + "," + groupId; nameId = shareathon.FacebookGroupId[i] + "," + nameId; } User objUser = (User)Session["User"]; List <KeyValuePair <string, string> > Parameters = new List <KeyValuePair <string, string> >(); Parameters.Add(new KeyValuePair <string, string>("Facebookaccountid", shareathon.Facebookaccountid.ToString())); Parameters.Add(new KeyValuePair <string, string>("Id", shareathon.Id.ToString())); Parameters.Add(new KeyValuePair <string, string>("Userid", objUser.Id.ToString())); Parameters.Add(new KeyValuePair <string, string>("FacebookPageUrl", shareathon.FacebookPageUrl)); Parameters.Add(new KeyValuePair <string, string>("FacebookGroupId", groupId)); Parameters.Add(new KeyValuePair <string, string>("Timeintervalminutes", shareathon.Timeintervalminutes.ToString())); string accesstoken = string.Empty; string UserId = objUser.Id.ToString(); if (Session["access_token"] != null) { accesstoken = Session["access_token"].ToString(); } HttpResponseMessage response = await WebApiReq.PostReq("api/ApiShareathon/EditShareathonGroup", Parameters, "Bearer", accesstoken); if (response.IsSuccessStatusCode) { return(RedirectToAction("GroupIndex")); } Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); List <FacebookAccount> facebookaccounts = (List <FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <FacebookAccount>))); List <FacebookAccount> facebookpages = (List <FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookPageByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <FacebookAccount>))); ViewBag.FbPages = facebookpages; Session["FbPages"] = ViewBag.FbPages; ViewBag.FbAccounts = facebookaccounts; ViewBag.UserId = objUser.Id; return(View()); }
public ActionResult GroupCreate() { User objuser = (User)Session["User"]; Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); List <FacebookAccount> facebookacoount = (List <FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objuser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <FacebookAccount>))); ViewBag.FbAccounts = facebookacoount; ViewBag.UserId = objuser.Id; return(View()); }
public ActionResult GroupCreate() { User objuser=(User)Session["User"]; Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); List<FacebookAccount> facebookacoount = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objuser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>))); ViewBag.FbAccounts = facebookacoount; ViewBag.UserId = objuser.Id; return View(); }
public async Task<ActionResult> GroupShareathonEdit(string Id) { User objuser = (User)Session["User"]; string accesstoken = string.Empty; if (Session["access_token"] != null) { accesstoken = Session["access_token"].ToString(); } List<KeyValuePair<string, string>> param = new List<KeyValuePair<string, string>>(); List<KeyValuePair<string, string>> lst = new List<KeyValuePair<string, string>>(); ShareathonGroup sharethons = null; HttpResponseMessage response = await WebApiReq.GetReq("api/ApiShareathon/GetGroupShareaton?Id=" + Id, "Bearer", accesstoken); if (response.IsSuccessStatusCode) { sharethons = await response.Content.ReadAsAsync<Domain.Socioboard.Domain.ShareathonGroup>(); string [] nameId=sharethons.Facebooknameid.Split(','); string id = ""; for (int i = 0; i < nameId.Length; i++) { string [] name=Regex.Split(nameId[i],"###"); id = name[0] + "," + id; //lst.Add(new KeyValuePair<string,string>(nameId[i], name[1])); } ViewBag.GroupId = id; Api.Facebook.Facebook ApiFacebook = new Api.Facebook.Facebook(); List<AddFacebookGroup> lstFacebookGroup = new List<AddFacebookGroup>(); string fcebookgrp = ApiFacebook.GetAllFacebookGroups(sharethons.AccessToken); lstFacebookGroup = (List<AddFacebookGroup>)(new JavaScriptSerializer().Deserialize(fcebookgrp, typeof(List<AddFacebookGroup>))); if (lstFacebookGroup.Count > 0) { ViewBag.facebbokgroup = lstFacebookGroup; } else { ViewBag.facebbokgroup = null; } } Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); List<FacebookAccount> facebookaccounts = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objuser.Id.ToString(), Session["group"].ToString()), typeof(List<FacebookAccount>))); ViewBag.FbAccounts = facebookaccounts.Where(t=>t.FbUserId!="").ToList(); ViewBag.UserId = objuser.Id; ViewBag.Group = lst; return View(sharethons); }
public ActionResult Create() { User objUser = (User)Session["User"]; Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); List<FacebookAccount> lstFacebookAccount = new List<FacebookAccount>(); List<FacebookAccount> facebookaccounts = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>))); List<FacebookAccount> facebookpages = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookPageByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>))); foreach (FacebookAccount item in facebookpages) { if(item!=null) { lstFacebookAccount.Add(item); } } if (lstFacebookAccount.Count>0) { ViewBag.FbPages = lstFacebookAccount; Session["FbPages"] = ViewBag.FbPages; } else { ViewBag.FbPages = null; } ViewBag.FbAccounts = facebookaccounts.Where(t=>t.FbUserId!="").ToList(); ViewBag.UserId = objUser.Id; return View(); }
public async Task<ActionResult> EditGroup(ShareathonGroupViewModel shareathon) { string groupId = ""; string nameId = ""; for (int i = 0; i < shareathon.FacebookGroupId.Length; i++) { string dataid = shareathon.FacebookGroupId[i]; string[] grpid = Regex.Split(dataid, "###"); groupId = grpid[0] + "," + groupId; nameId = shareathon.FacebookGroupId[i] + "," + nameId; } User objUser = (User)Session["User"]; List<KeyValuePair<string, string>> Parameters = new List<KeyValuePair<string, string>>(); Parameters.Add(new KeyValuePair<string, string>("Facebookaccountid", shareathon.Facebookaccountid.ToString())); Parameters.Add(new KeyValuePair<string, string>("Id", shareathon.Id.ToString())); Parameters.Add(new KeyValuePair<string, string>("Userid", objUser.Id.ToString())); Parameters.Add(new KeyValuePair<string, string>("FacebookPageUrl", shareathon.FacebookPageUrl)); Parameters.Add(new KeyValuePair<string, string>("FacebookGroupId", groupId)); Parameters.Add(new KeyValuePair<string, string>("Facebooknameid", nameId)); Parameters.Add(new KeyValuePair<string, string>("Timeintervalminutes", shareathon.Timeintervalminutes.ToString())); string accesstoken = string.Empty; string UserId = objUser.Id.ToString(); if (Session["access_token"] != null) { accesstoken = Session["access_token"].ToString(); } HttpResponseMessage response = await WebApiReq.PostReq("api/ApiShareathon/EditShareathonGroup", Parameters, "Bearer", accesstoken); if (response.IsSuccessStatusCode) { return RedirectToAction("GroupIndex"); } List<FacebookAccount> lstFacebookAccount = new List<FacebookAccount>(); Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); List<FacebookAccount> facebookaccounts = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>))); List<FacebookAccount> facebookpages = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookPageByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>))); foreach (FacebookAccount item in facebookpages) { if (item != null) { lstFacebookAccount.Add(item); } } if (lstFacebookAccount.Count > 0) { ViewBag.FbPages = lstFacebookAccount; Session["FbPages"] = ViewBag.FbPages; } else { ViewBag.FbPages = null; } ViewBag.FbAccounts = facebookaccounts.Where(t => t.FbUserId != "").ToList(); ViewBag.UserId = objUser.Id; return View(); }
public static Dictionary <string, List <object> > GetFeedsMenuAccordingToGroup() { User objUser = (User)System.Web.HttpContext.Current.Session["User"]; Dictionary <string, List <object> > dic_profilessnap = new Dictionary <string, List <object> >(); List <object> socialaccounts = null; socialaccounts = new List <object>(); Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); List <FacebookAccount> lstFacebookAccount = (List <FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <FacebookAccount>))); foreach (var FacebookAccount in lstFacebookAccount) { socialaccounts.Add(FacebookAccount); } dic_profilessnap.Add("facebook", socialaccounts); socialaccounts = new List <object>(); Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount(); List <TwitterAccount> lstTwitterAccount = (List <TwitterAccount>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetAllTwitterAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <TwitterAccount>))); foreach (var TwitterAccount in lstTwitterAccount) { socialaccounts.Add(TwitterAccount); } dic_profilessnap.Add("twitter", socialaccounts); socialaccounts = new List <object>(); Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount(); List <LinkedInAccount> lstLinkedinAccount = (List <LinkedInAccount>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetAllLinkedinAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <LinkedInAccount>))); foreach (var LinkedInAccount in lstLinkedinAccount) { socialaccounts.Add(LinkedInAccount); } dic_profilessnap.Add("linkedin", socialaccounts); socialaccounts = new List <object>(); Api.InstagramAccount.InstagramAccount ApiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount(); List <InstagramAccount> lstInstagramAccount = (List <InstagramAccount>)(new JavaScriptSerializer().Deserialize(ApiobjInstagramAccount.GetAllInstagramAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <InstagramAccount>))); foreach (var InstagramAccount in lstInstagramAccount) { socialaccounts.Add(InstagramAccount); } dic_profilessnap.Add("instagram", socialaccounts); socialaccounts = new List <object>(); Api.TumblrAccount.TumblrAccount ApiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount(); List <TumblrAccount> lstTumblrAccount = (List <TumblrAccount>)(new JavaScriptSerializer().Deserialize(ApiobjTumblrAccount.GetAllTumblrAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <TumblrAccount>))); foreach (var TumblrAccount in lstTumblrAccount) { socialaccounts.Add(TumblrAccount); } dic_profilessnap.Add("tumblr", socialaccounts); socialaccounts = new List <object>(); Api.YoutubeAccount.YoutubeAccount ApiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount(); List <YoutubeAccount> lstYoutubeAccount = (List <YoutubeAccount>)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeAccount.GetAllYoutubeAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <YoutubeAccount>))); foreach (var YoutubeAccount in lstYoutubeAccount) { socialaccounts.Add(YoutubeAccount); } dic_profilessnap.Add("youtube", socialaccounts); return(dic_profilessnap); }
public static Dictionary <string, Dictionary <List <object>, List <object> > > GetGroupsMenuAccordingToGroup() { User objUser = (User)System.Web.HttpContext.Current.Session["User"]; Dictionary <string, Dictionary <List <object>, List <object> > > _ReturnDicValue = new Dictionary <string, Dictionary <List <object>, List <object> > >(); Dictionary <List <object>, List <object> > dic_profilessnap = new Dictionary <List <object>, List <object> >(); List <object> socialaccounts = null; List <object> accountsgroup = null; socialaccounts = new List <object>(); accountsgroup = new List <object>(); Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); List <FacebookAccount> lstFacebookAccount = (List <FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <FacebookAccount>))); foreach (var FacebookAccount in lstFacebookAccount) { List <FacebookGroup> lstFacebookGroup = GetGroupName(FacebookAccount.AccessToken.ToString()); foreach (var FacebookGroup in lstFacebookGroup) { accountsgroup.Add(FacebookGroup); } socialaccounts.Add(FacebookAccount); } dic_profilessnap.Add(socialaccounts, accountsgroup); _ReturnDicValue.Add("facebook", dic_profilessnap); dic_profilessnap = new Dictionary <List <object>, List <object> >(); socialaccounts = new List <object>(); accountsgroup = new List <object>(); Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount(); Api.Linkedin.Linkedin ApiobjLinkedin = new Api.Linkedin.Linkedin(); List <LinkedInAccount> lstLinkedinAccount = (List <LinkedInAccount>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetAllLinkedinAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <LinkedInAccount>))); foreach (var LinkedInAccount in lstLinkedinAccount) { //var testJsonStr= ApiobjLinkedin.GetLinkedGroupsDetail(LinkedInAccount.LinkedinUserId.ToString(), LinkedInAccount.UserId.ToString()); //List<LinkedInGroup> objLinkedInGroup = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LinkedInGroup>>(testJsonStr); List <LinkedInGroup.Group_Updates> objLinkedInGroup = (List <LinkedInGroup.Group_Updates>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedin.GetLinkedGroupsDetail(LinkedInAccount.LinkedinUserId.ToString(), LinkedInAccount.UserId.ToString()), typeof(List <LinkedInGroup.Group_Updates>))); //Newtonsoft.Json.Linq.JObject obj = JObject.Parse(testJsonStr); foreach (var LinkedInGroup in objLinkedInGroup) { accountsgroup.Add(LinkedInGroup); } socialaccounts.Add(LinkedInAccount); } dic_profilessnap.Add(socialaccounts, accountsgroup); _ReturnDicValue.Add("linkedin", dic_profilessnap); return(_ReturnDicValue); }
public static Dictionary<string, Dictionary<List<object>, List<object>>> GetGroupsMenuAccordingToGroup() { User objUser = (User)System.Web.HttpContext.Current.Session["User"]; Dictionary<string, Dictionary<List<object>, List<object>>> _ReturnDicValue = new Dictionary<string, Dictionary<List<object>, List<object>>>(); Dictionary<List<object>, List<object>> dic_profilessnap = new Dictionary<List<object>, List<object>>(); List<object> socialaccounts = null; List<object> accountsgroup = null; socialaccounts = new List<object>(); accountsgroup = new List<object>(); Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); List<FacebookAccount> lstFacebookAccount = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>))); foreach (var FacebookAccount in lstFacebookAccount) { List<FacebookGroup> lstFacebookGroup = GetGroupName(FacebookAccount.AccessToken.ToString()); foreach (var FacebookGroup in lstFacebookGroup) { accountsgroup.Add(FacebookGroup); } socialaccounts.Add(FacebookAccount); } dic_profilessnap.Add(socialaccounts, accountsgroup); _ReturnDicValue.Add("facebook", dic_profilessnap); dic_profilessnap = new Dictionary<List<object>, List<object>>(); socialaccounts = new List<object>(); accountsgroup = new List<object>(); Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount(); Api.Linkedin.Linkedin ApiobjLinkedin = new Api.Linkedin.Linkedin(); List<LinkedInAccount> lstLinkedinAccount = (List<LinkedInAccount>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetAllLinkedinAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<LinkedInAccount>))); foreach (var LinkedInAccount in lstLinkedinAccount) { //var testJsonStr= ApiobjLinkedin.GetLinkedGroupsDetail(LinkedInAccount.LinkedinUserId.ToString(), LinkedInAccount.UserId.ToString()); //List<LinkedInGroup> objLinkedInGroup = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LinkedInGroup>>(testJsonStr); List<LinkedInGroup.Group_Updates> objLinkedInGroup = (List<LinkedInGroup.Group_Updates>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedin.GetLinkedGroupsDetail(LinkedInAccount.LinkedinUserId.ToString(), LinkedInAccount.UserId.ToString()), typeof(List<LinkedInGroup.Group_Updates>))); //Newtonsoft.Json.Linq.JObject obj = JObject.Parse(testJsonStr); foreach (var LinkedInGroup in objLinkedInGroup) { accountsgroup.Add(LinkedInGroup); } socialaccounts.Add(LinkedInAccount); } dic_profilessnap.Add(socialaccounts, accountsgroup); _ReturnDicValue.Add("linkedin", dic_profilessnap); return _ReturnDicValue; }
public static Dictionary<string, List<object>> GetFeedsMenuAccordingToGroup() { User objUser = (User)System.Web.HttpContext.Current.Session["User"]; Dictionary<string, List<object>> dic_profilessnap = new Dictionary<string, List<object>>(); List<object> socialaccounts = null; socialaccounts = new List<object>(); Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); List<FacebookAccount> lstFacebookAccount = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>))); foreach (var FacebookAccount in lstFacebookAccount) { socialaccounts.Add(FacebookAccount); } dic_profilessnap.Add("facebook", socialaccounts); socialaccounts = new List<object>(); Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount(); List<TwitterAccount> lstTwitterAccount = (List<TwitterAccount>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetAllTwitterAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<TwitterAccount>))); foreach (var TwitterAccount in lstTwitterAccount) { socialaccounts.Add(TwitterAccount); } dic_profilessnap.Add("twitter", socialaccounts); socialaccounts = new List<object>(); Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount(); List<LinkedInAccount> lstLinkedinAccount = (List<LinkedInAccount>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetAllLinkedinAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<LinkedInAccount>))); foreach (var LinkedInAccount in lstLinkedinAccount) { socialaccounts.Add(LinkedInAccount); } dic_profilessnap.Add("linkedin", socialaccounts); socialaccounts = new List<object>(); Api.InstagramAccount.InstagramAccount ApiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount(); List<InstagramAccount> lstInstagramAccount = (List<InstagramAccount>)(new JavaScriptSerializer().Deserialize(ApiobjInstagramAccount.GetAllInstagramAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<InstagramAccount>))); foreach (var InstagramAccount in lstInstagramAccount) { socialaccounts.Add(InstagramAccount); } dic_profilessnap.Add("instagram", socialaccounts); socialaccounts = new List<object>(); Api.TumblrAccount.TumblrAccount ApiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount(); List<TumblrAccount> lstTumblrAccount = (List<TumblrAccount>)(new JavaScriptSerializer().Deserialize(ApiobjTumblrAccount.GetAllTumblrAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<TumblrAccount>))); foreach (var TumblrAccount in lstTumblrAccount) { socialaccounts.Add(TumblrAccount); } dic_profilessnap.Add("tumblr", socialaccounts); socialaccounts = new List<object>(); Api.YoutubeAccount.YoutubeAccount ApiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount(); List<YoutubeAccount> lstYoutubeAccount = (List<YoutubeAccount>)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeAccount.GetAllYoutubeAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<YoutubeAccount>))); foreach (var YoutubeAccount in lstYoutubeAccount) { socialaccounts.Add(YoutubeAccount); } dic_profilessnap.Add("youtube", socialaccounts); return dic_profilessnap; }
public async Task <ActionResult> Edit(ShareathonViewModel shareathon) { string id = ""; for (int i = 0; i < shareathon.FacebookPageId.Length; i++) { string dataid = shareathon.FacebookPageId[i]; id = dataid + "," + id; } User objUser = (User)Session["User"]; List <KeyValuePair <string, string> > Parameters = new List <KeyValuePair <string, string> >(); Parameters.Add(new KeyValuePair <string, string>("Id", shareathon.Id.ToString())); Parameters.Add(new KeyValuePair <string, string>("Facebookaccountid", shareathon.Facebookaccountid.ToString())); Parameters.Add(new KeyValuePair <string, string>("Userid", objUser.Id.ToString())); Parameters.Add(new KeyValuePair <string, string>("Facebookpageid", id.TrimEnd(','))); Parameters.Add(new KeyValuePair <string, string>("Timeintervalminutes", shareathon.Timeintervalminutes.ToString())); string accesstoken = string.Empty; string UserId = objUser.Id.ToString(); if (Session["access_token"] != null) { accesstoken = Session["access_token"].ToString(); } HttpResponseMessage response = await WebApiReq.PostReq("api/ApiShareathon/EditShareathon", Parameters, "Bearer", accesstoken); if (response.IsSuccessStatusCode) { return(RedirectToAction("Index")); } List <FacebookAccount> lstFacebookAccount = new List <FacebookAccount>(); Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); List <FacebookAccount> facebookaccounts = (List <FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <FacebookAccount>))); List <FacebookAccount> facebookpages = (List <FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookPageByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <FacebookAccount>))); foreach (FacebookAccount item in facebookpages) { if (item != null) { lstFacebookAccount.Add(item); } } if (lstFacebookAccount.Count > 0) { ViewBag.FbPages = lstFacebookAccount; Session["FbPages"] = ViewBag.FbPages; } else { ViewBag.FbPages = null; } ViewBag.FbAccounts = facebookaccounts.Where(t => t.FbUserId != "").ToList(); ViewBag.UserId = objUser.Id; return(View()); }
public ActionResult Create() { User objUser = (User)Session["User"]; Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); List <FacebookAccount> lstFacebookAccount = new List <FacebookAccount>(); List <FacebookAccount> facebookaccounts = (List <FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <FacebookAccount>))); List <FacebookAccount> facebookpages = (List <FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookPageByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <FacebookAccount>))); foreach (FacebookAccount item in facebookpages) { if (item != null) { lstFacebookAccount.Add(item); } } if (lstFacebookAccount.Count > 0) { ViewBag.FbPages = lstFacebookAccount; Session["FbPages"] = ViewBag.FbPages; } else { ViewBag.FbPages = null; } ViewBag.FbAccounts = facebookaccounts.Where(t => t.FbUserId != "").ToList(); ViewBag.UserId = objUser.Id; return(View()); }
public async Task<ActionResult> Edit(ShareathonViewModel shareathon) { string id = ""; for (int i = 0; i < shareathon.FacebookPageId.Length; i++) { string dataid = shareathon.FacebookPageId[i]; id = dataid + "," + id; } User objUser = (User)Session["User"]; List<KeyValuePair<string, string>> Parameters = new List<KeyValuePair<string, string>>(); Parameters.Add(new KeyValuePair<string, string>("Id", shareathon.Id.ToString())); Parameters.Add(new KeyValuePair<string, string>("Facebookaccountid", shareathon.Facebookaccountid.ToString())); Parameters.Add(new KeyValuePair<string, string>("Userid", objUser.Id.ToString())); Parameters.Add(new KeyValuePair<string, string>("Facebookpageid", id.TrimEnd(','))); Parameters.Add(new KeyValuePair<string, string>("Timeintervalminutes", shareathon.Timeintervalminutes.ToString())); string accesstoken = string.Empty; string UserId = objUser.Id.ToString(); if (Session["access_token"] != null) { accesstoken = Session["access_token"].ToString(); } HttpResponseMessage response = await WebApiReq.PostReq("api/ApiShareathon/EditShareathon", Parameters, "Bearer", accesstoken); if (response.IsSuccessStatusCode) { return RedirectToAction("Index"); } Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); List<FacebookAccount> facebookaccounts = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>))); List<FacebookAccount> facebookpages = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookPageByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>))); ViewBag.FbPages = facebookpages; Session["FbPages"] = ViewBag.FbPages; ViewBag.FbAccounts = facebookaccounts; ViewBag.UserId = objUser.Id; return View(); }