public ActionResult DeleteAccount() { string type = Request.QueryString["profile"].ToString(); string profileid = Request.QueryString["profileid"].ToString(); Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; if (type == "fb") { Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); ApiobjFacebookAccount.DeleteFacebookAccount(objUser.Id.ToString(), profileid, Session["group"].ToString()); } else if (type == "twt") { Api.TwitterAccount.TwitterAccount apiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount(); apiobjTwitterAccount.DeleteTwitterAccount(objUser.Id.ToString(), profileid, Session["group"].ToString()); } else if (type == "linkedin") { Api.LinkedinAccount.LinkedinAccount apiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount(); apiobjLinkedinAccount.DeleteLinkedinAccount(objUser.Id.ToString(), profileid, Session["group"].ToString()); } else if (type == "instagram") { Api.InstagramAccount.InstagramAccount apiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount(); apiobjInstagramAccount.DeleteInstagramAccount(objUser.Id.ToString(), profileid, Session["group"].ToString()); } else if (type == "tumblr") { Api.TumblrAccount.TumblrAccount apiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount(); apiobjTumblrAccount.DeleteTumblrAccount(objUser.Id.ToString(), profileid, Session["group"].ToString()); } else if (type == "youtube") { Api.YoutubeAccount.YoutubeAccount apiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount(); apiobjYoutubeAccount.DeleteYoutubeAccount(objUser.Id.ToString(), profileid, Session["group"].ToString()); } return(Content("Deleted")); }
public ActionResult DeleteAccount() { string type = Request.QueryString["profile"].ToString(); string profileid = Request.QueryString["profileid"].ToString(); Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; // Edited By Antima[15/12/2014] string GroupId = Session["group"].ToString(); Api.Team.Team objApiTeam = new Api.Team.Team(); objApiTeam.Timeout = 300000; Domain.Socioboard.Domain.Team team = (Domain.Socioboard.Domain.Team)new JavaScriptSerializer().Deserialize(objApiTeam.GetTeamByGroupId(Session["group"].ToString()), typeof(Domain.Socioboard.Domain.Team)); Guid AdminUserId = team.UserId; try { if (AdminUserId == objUser.Id) { if (type == "fb") { Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); ApiobjFacebookAccount.DeleteFacebookAccount(objUser.Id.ToString(), profileid, Session["group"].ToString()); } else if (type == "twt") { Api.TwitterAccount.TwitterAccount apiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount(); apiobjTwitterAccount.DeleteTwitterAccount(objUser.Id.ToString(), profileid, Session["group"].ToString()); } else if (type == "linkedin") { Api.LinkedinAccount.LinkedinAccount apiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount(); apiobjLinkedinAccount.DeleteLinkedinAccount(objUser.Id.ToString(), profileid, Session["group"].ToString()); } else if (type == "instagram") { Api.InstagramAccount.InstagramAccount apiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount(); apiobjInstagramAccount.DeleteInstagramAccount(objUser.Id.ToString(), profileid, Session["group"].ToString()); } else if (type == "tumblr") { Api.TumblrAccount.TumblrAccount apiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount(); apiobjTumblrAccount.DeleteTumblrAccount(objUser.Id.ToString(), profileid, Session["group"].ToString()); } else if (type == "youtube") { Api.YoutubeAccount.YoutubeAccount apiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount(); apiobjYoutubeAccount.DeleteYoutubeAccount(objUser.Id.ToString(), profileid, Session["group"].ToString()); } else if (type == "liComPage") { Api.LinkedinCompanyPage.LinkedinCompanyPage apiobjLinkedinCompanyPage = new Api.LinkedinCompanyPage.LinkedinCompanyPage(); apiobjLinkedinCompanyPage.DeleteLinkedinCompanyPage(objUser.Id.ToString(), profileid, Session["group"].ToString()); } else if (type == "gplus") { Api.GooglePlusAccount.GooglePlusAccount objGooglePlusAccount = new Api.GooglePlusAccount.GooglePlusAccount(); objGooglePlusAccount.DeleteGplusAccount(objUser.Id.ToString(), profileid, Session["group"].ToString()); } return Content("Deleted"); } else { return Content("Not Deleted"); } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return Content("Not Deleted"); } }
public async Task<ActionResult> DeleteAccount() { string type = Request.QueryString["profile"].ToString(); string profileid = Request.QueryString["profileid"].ToString(); Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; // Edited By Antima[15/12/2014] string GroupId = Session["group"].ToString(); //Api.Team.Team objApiTeam = new Api.Team.Team(); //objApiTeam.Timeout = 300000; //Domain.Socioboard.Domain.Team team = (Domain.Socioboard.Domain.Team)new JavaScriptSerializer().Deserialize(objApiTeam.GetTeamByGroupId(Session["group"].ToString()), typeof(Domain.Socioboard.Domain.Team)); //Guid AdminUserId = team.UserId; //string output = string.Empty; //HttpResponseMessage response1 = await WebApiReq.DelReq("api/ApiGroupProfiles/DeleteProfileFromGroup?profileid=" + profileid + "&groupid=" + GroupId + "&userid=" + objUser.Id+ "&profiletype="+type, "Bearer", Session["access_token"].ToString()); //if (response1.IsSuccessStatusCode) //{ // output = await response1.Content.ReadAsAsync<string>(); //} try { //if (output.Equals("Deleted")) //{ if (type == "fb") { Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); ApiobjFacebookAccount.DeleteFacebookAccount(objUser.Id.ToString(), profileid, Session["group"].ToString(),""); } else if (type == "twt") { Api.TwitterAccount.TwitterAccount apiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount(); apiobjTwitterAccount.DeleteTwitterAccount(objUser.Id.ToString(), profileid, Session["group"].ToString(), "twitter"); } else if (type == "linkedin") { string accesstoken = ""; string returndata = ""; List<KeyValuePair<string, string>> Parameters = new List<KeyValuePair<string, string>>(); Parameters.Add(new KeyValuePair<string, string>("UserId", objUser.Id.ToString())); Parameters.Add(new KeyValuePair<string, string>("ProfileId", profileid)); Parameters.Add(new KeyValuePair<string, string>("GroupId", GroupId)); if (Session["access_token"] != null) { accesstoken = Session["access_token"].ToString(); } HttpResponseMessage response = await WebApiReq.PostReq("api/ApiLinkedIn/DeleteLinkedinAccount", Parameters, "Bearer", accesstoken); if (response.IsSuccessStatusCode) { returndata = await response.Content.ReadAsAsync<string>(); } } else if (type == "instagram") { Api.InstagramAccount.InstagramAccount apiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount(); apiobjInstagramAccount.DeleteInstagramAccount(objUser.Id.ToString(), profileid, Session["group"].ToString(),type); } else if (type == "tumblr") { Api.TumblrAccount.TumblrAccount apiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount(); apiobjTumblrAccount.DeleteTumblrAccount(objUser.Id.ToString(), profileid, Session["group"].ToString()); } else if (type == "youtube") { Api.YoutubeAccount.YoutubeAccount apiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount(); apiobjYoutubeAccount.DeleteYoutubeAccount(objUser.Id.ToString(), profileid, Session["group"].ToString(), type); } else if (type == "liComPage") { string accesstoken = ""; string returndata = ""; List<KeyValuePair<string, string>> Parameters = new List<KeyValuePair<string, string>>(); Parameters.Add(new KeyValuePair<string, string>("UserId", objUser.Id.ToString())); Parameters.Add(new KeyValuePair<string, string>("ProfileId", profileid)); Parameters.Add(new KeyValuePair<string, string>("GroupId", GroupId)); if (Session["access_token"] != null) { accesstoken = Session["access_token"].ToString(); } HttpResponseMessage response = await WebApiReq.PostReq("api/ApiLinkedIn/DeleteLinkedinCompanyPage", Parameters, "Bearer", accesstoken); if (response.IsSuccessStatusCode) { returndata = await response.Content.ReadAsAsync<string>(); } } else if (type == "gplus") { Api.GooglePlusAccount.GooglePlusAccount objGooglePlusAccount = new Api.GooglePlusAccount.GooglePlusAccount(); objGooglePlusAccount.DeleteGplusAccount(objUser.Id.ToString(), profileid, Session["group"].ToString(), "gplus"); } else if (type == "ga") { Api.GoogleAnalyticsAccount.GoogleAnalyticsAccount ApiGoogleAnalyticsAccount = new Api.GoogleAnalyticsAccount.GoogleAnalyticsAccount(); ApiGoogleAnalyticsAccount.DeleteGoogelAnalyticsAccount(objUser.Id.ToString(), profileid, Session["group"].ToString(), "googleanalytics"); } return Content("Deleted"); //} //else //{ // return Content("Not Deleted"); //} } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return Content("Not Deleted"); } }
public ActionResult DeleteAccount() { string type = Request.QueryString["profile"].ToString(); string profileid = Request.QueryString["profileid"].ToString(); Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; // Edited By Antima[15/12/2014] string GroupId = Session["group"].ToString(); Api.Team.Team objApiTeam = new Api.Team.Team(); objApiTeam.Timeout = 300000; Domain.Socioboard.Domain.Team team = (Domain.Socioboard.Domain.Team) new JavaScriptSerializer().Deserialize(objApiTeam.GetTeamByGroupId(Session["group"].ToString()), typeof(Domain.Socioboard.Domain.Team)); Guid AdminUserId = team.UserId; try { if (AdminUserId == objUser.Id) { if (type == "fb") { Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); ApiobjFacebookAccount.DeleteFacebookAccount(objUser.Id.ToString(), profileid, Session["group"].ToString()); } else if (type == "twt") { Api.TwitterAccount.TwitterAccount apiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount(); apiobjTwitterAccount.DeleteTwitterAccount(objUser.Id.ToString(), profileid, Session["group"].ToString()); } else if (type == "linkedin") { Api.LinkedinAccount.LinkedinAccount apiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount(); apiobjLinkedinAccount.DeleteLinkedinAccount(objUser.Id.ToString(), profileid, Session["group"].ToString()); } else if (type == "instagram") { Api.InstagramAccount.InstagramAccount apiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount(); apiobjInstagramAccount.DeleteInstagramAccount(objUser.Id.ToString(), profileid, Session["group"].ToString()); } else if (type == "tumblr") { Api.TumblrAccount.TumblrAccount apiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount(); apiobjTumblrAccount.DeleteTumblrAccount(objUser.Id.ToString(), profileid, Session["group"].ToString()); } else if (type == "youtube") { Api.YoutubeAccount.YoutubeAccount apiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount(); apiobjYoutubeAccount.DeleteYoutubeAccount(objUser.Id.ToString(), profileid, Session["group"].ToString()); } else if (type == "liComPage") { Api.LinkedinCompanyPage.LinkedinCompanyPage apiobjLinkedinCompanyPage = new Api.LinkedinCompanyPage.LinkedinCompanyPage(); apiobjLinkedinCompanyPage.DeleteLinkedinCompanyPage(objUser.Id.ToString(), profileid, Session["group"].ToString()); } else if (type == "gplus") { Api.GooglePlusAccount.GooglePlusAccount objGooglePlusAccount = new Api.GooglePlusAccount.GooglePlusAccount(); objGooglePlusAccount.DeleteGplusAccount(objUser.Id.ToString(), profileid, Session["group"].ToString()); } return(Content("Deleted")); } else { return(Content("Not Deleted")); } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(Content("Not Deleted")); } }