/// <updateGoogelAnalyticsUser> /// update Googel Analytics User Details /// </summary> /// <param name="gaaccount">Set Values in a GoogleAnalyticsAccount Class Property and Pass the same Object of GoogleAnalyticsAccount Class.(Domain.GoogleAnalyticsAccount)</param> public void updateGoogelAnalyticsUser(GoogleAnalyticsAccount gaaccount) { //Creates a database connection and opens up a session using (NHibernate.ISession session = SessionFactory.GetNewSession()) { //After Session creation, start Transaction. using (NHibernate.ITransaction transaction = session.BeginTransaction()) { try { //Proceed action, to update google account deatils. session.CreateQuery("Update GoogleAnalyticsAccount set GaAccountName =:gausername,GaProfileId=:gaprofileid,GaProfileName=:gaprofilename,AccessToken =:access,RefreshToken=:refreshtoken,EmailId=:emailid,IsActive=:status where GaAccountId = :gauserid and UserId = :userid") .SetParameter("gausername", gaaccount.GaAccountName) .SetParameter("gaprofilename", gaaccount.GaProfileName) .SetParameter("gaprofileid", gaaccount.GaProfileId) .SetParameter("access", gaaccount.AccessToken) .SetParameter("refreshtoken", gaaccount.RefreshToken) //.SetParameter("visits", gaaccount.Visits) //.SetParameter("newvisits", gaaccount.NewVisits) //.SetParameter("avgvisits", gaaccount.AvgVisits) .SetParameter("emailid", gaaccount.EmailId) .SetParameter("gauserid", gaaccount.GaAccountId) .SetParameter("userid", gaaccount.UserId) .SetParameter("status", gaaccount.IsActive) .ExecuteUpdate(); transaction.Commit(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); // return 0; } } //End Transaction } //End Session }
/// <getGoogelAnalyticsAccountHomeDetailsById> /// Get the Googel Analytics Account Home Details By Id and google account id. /// </summary> /// <param name="gauserid">Google account id (String)</param> /// <param name="userId">Id of user(Guid)</param> /// <returns>Return object of Google analytic class.(Domein.GoogleAnalyticsAccount)</returns> public GoogleAnalyticsAccount getGoogelAnalyticsAccountHomeDetailsById(Guid userId, string gauserid) { //Creates a database connection and opens up a session using (NHibernate.ISession session = SessionFactory.GetNewSession()) { //After Session creation, start Transaction. using (NHibernate.ITransaction transaction = session.BeginTransaction()) { try { NHibernate.IQuery query = session.CreateQuery("from GoogleAnalyticsAccount where GaAccountId = :GaAccountId and UserId=:userId"); query.SetParameter("GaAccountId", gauserid); query.SetParameter("userId", userId); GoogleAnalyticsAccount result = new GoogleAnalyticsAccount(); foreach (GoogleAnalyticsAccount item in query.Enumerable <GoogleAnalyticsAccount>()) { result = item; break; } return(result); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(null); } } //End Transaction } //End session }
/// <getUserDetails> /// Get user details by Google Account id. /// </summary> /// <param name="gaUserId">Id of google account(String)</param> /// <returns>Return object of Google analytic class.(Domein.GoogleAnalyticsAccount)</returns> public GoogleAnalyticsAccount getUserDetails(string gaUserId) { //Creates a database connection and opens up a session using (NHibernate.ISession session = SessionFactory.GetNewSession()) { //After Session creation, start Transaction. using (NHibernate.ITransaction transaction = session.BeginTransaction()) { try { //Proceed action to get details of account by Google account Id. NHibernate.IQuery query = session.CreateQuery("from GoogleAnalyticsAccount where GaAccountId = :gaUserId"); query.SetParameter("gaUserId", gaUserId); List <GoogleAnalyticsAccount> lst = new List <GoogleAnalyticsAccount>(); foreach (GoogleAnalyticsAccount item in query.Enumerable()) { lst.Add(item); break; } GoogleAnalyticsAccount fbacc = lst[0]; return(fbacc); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(null); } } //End Transaction } //End Session }
/// <getGoogelAnalyticsAccountHomeDetailsById> /// Get Googel Analytics Account Home Details By Id and Google account id. /// </summary> /// <param name="gauserid">Google account id (String)</param> /// <param name="userId">Id of user(Guid)</param> /// <returns>Return object of Google analytic class.(Domein.GoogleAnalyticsAccount)</returns> public GoogleAnalyticsAccount getGoogelAnalyticsAccountHomeDetailsById(string gauserid, Guid userId) { //Creates a database connection and opens up a session using (NHibernate.ISession session = SessionFactory.GetNewSession()) { //After Session creation, start Transaction. using (NHibernate.ITransaction transaction = session.BeginTransaction()) { try { //Proceed action, to get details of account. NHibernate.IQuery query = session.CreateQuery("from GoogleAnalyticsAccount where GaAccountId = :GaAccountId and UserId=:userId"); query.SetParameter("GaAccountId", gauserid); query.SetParameter("userId", userId); GoogleAnalyticsAccount result = query.UniqueResult <GoogleAnalyticsAccount>(); return(result); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(null); } } //End Transaction } //End session }
public DataTable getDayWiseAnalyticsApi(string profileId, Guid user) { DataTable dtAnalytics = new DataTable(); try { Analytics objAlyt = new Analytics(); oAuthTokenGa obj = new oAuthTokenGa(); GoogleAnalyticsAccountRepository objGaAccRepo = new GoogleAnalyticsAccountRepository(); GoogleAnalyticsStats objGaStats = new GoogleAnalyticsStats(); GoogleAnalyticsStatsRepository objGaStatsRepo = new GoogleAnalyticsStatsRepository(); GoogleAnalyticsAccount objGaAcc = objGaAccRepo.getGoogelAnalyticsAccountDetailsById(profileId, user); string strRefresh = obj.GetAccessToken(objGaAcc.RefreshToken); if (!strRefresh.StartsWith("[")) { strRefresh = "[" + strRefresh + "]"; } JArray objArray = JArray.Parse(strRefresh); foreach (var itemRefresh in objArray) { objGaAcc.AccessToken = itemRefresh["access_token"].ToString(); } XmlDocument xDoc = new XmlDocument(); DateTime startdt = DateTime.Now.AddMonths(-3); DateTime enddt = DateTime.Now; xDoc.LoadXml(objAlyt.getAnalyticsData(objGaAcc.GaProfileId, "metrics=ga:visits&dimensions=ga:day", startdt.ToShortDateString().Replace("/", "-"), "2013-07-25", objGaAcc.AccessToken)); dtAnalytics = getdatafromXml(xDoc); for (int i = 0; i < dtAnalytics.Rows.Count; i++) { objGaStats.EntryDate = DateTime.Now; objGaStats.GaAccountId = objGaAcc.GaAccountId; if (dtAnalytics.Rows[i]["title"].ToString().Contains("ga:day")) { objGaStats.gaDate = dtAnalytics.Rows[i]["title"].ToString().Substring(8); } objGaStats.gaVisits = dtAnalytics.Rows[i]["ga:visitors"].ToString(); objGaStats.Id = Guid.NewGuid(); objGaStats.UserId = user; objGaStats.GaProfileId = objGaAcc.GaProfileId; if (!objGaStatsRepo.checkGoogleAnalyticsDateStatsExists(objGaAcc.GaProfileId, "day", dtAnalytics.Rows[i]["title"].ToString(), user)) { objGaStatsRepo.addGoogleAnalyticsStats(objGaStats); } else { objGaStatsRepo.updateGoogleAnalyticsStats(objGaStats); } } } catch (Exception Err) { Console.Write(Err.StackTrace); } return(dtAnalytics); }
public DataTable getRegionWiseAnalyticsApi(string profileId) { DataTable dtAnalytics = new DataTable(); try { User user = (User)HttpContext.Current.Session["LoggedUser"]; Analytics objAlyt = new Analytics(); oAuthTokenGa obj = new oAuthTokenGa(); GoogleAnalyticsAccountRepository objGaAccRepo = new GoogleAnalyticsAccountRepository(); GoogleAnalyticsStats objGaStats = new GoogleAnalyticsStats(); GoogleAnalyticsStatsRepository objGaStatsRepo = new GoogleAnalyticsStatsRepository(); GoogleAnalyticsAccount objGaAcc = objGaAccRepo.getGoogelAnalyticsAccountDetailsById(profileId, user.Id); string strRefresh = obj.GetAccessToken(objGaAcc.RefreshToken); if (!strRefresh.StartsWith("[")) { strRefresh = "[" + strRefresh + "]"; } JArray objArray = JArray.Parse(strRefresh); foreach (var itemRefresh in objArray) { objGaAcc.AccessToken = itemRefresh["access_token"].ToString(); } XmlDocument xDoc = new XmlDocument(); xDoc.LoadXml(objAlyt.getAnalyticsData(objGaAcc.GaProfileId, "metrics=ga:visits&dimensions=ga:year", "2013-01-01", "2013-07-15", objGaAcc.AccessToken)); dtAnalytics = getdatafromXml(xDoc); for (int i = 0; i < dtAnalytics.Rows.Count; i++) { objGaStats.EntryDate = DateTime.Now; objGaStats.GaAccountId = objGaAcc.GaAccountId; if (dtAnalytics.Rows[i]["title"].ToString().Contains("ga:year")) { objGaStats.gaYear = dtAnalytics.Rows[i]["title"].ToString().Substring(8); } objGaStats.gaVisits = dtAnalytics.Rows[i]["ga:visitors"].ToString(); objGaStats.Id = Guid.NewGuid(); objGaStats.UserId = user.Id; objGaStats.GaProfileId = objGaAcc.GaProfileId; if (!objGaStatsRepo.checkGoogleAnalyticsDateStatsExists(objGaAcc.GaProfileId, "year", dtAnalytics.Rows[i]["title"].ToString(), user.Id)) { objGaStatsRepo.addGoogleAnalyticsStats(objGaStats); } else { objGaStatsRepo.updateGoogleAnalyticsStats(objGaStats); } } } catch (Exception Err) { Console.Write(Err.StackTrace); } return(dtAnalytics); }
/// <addGoogleAnalyticsUser> /// Add New Google Analytics User /// </summary> /// <param name="gaaccount">Set Values in a GoogleAnalyticsAccount Class Property and Pass the same Object of GoogleAnalyticsAccount Class.(Domain.GoogleAnalyticsAccount)</param> public void addGoogleAnalyticsUser(GoogleAnalyticsAccount gaaccount) { //Creates a database connection and opens up a session using (NHibernate.ISession session = SessionFactory.GetNewSession()) { //After Session creation, start Transaction. using (NHibernate.ITransaction transaction = session.BeginTransaction()) { //Proceed action, to save data. session.Save(gaaccount); transaction.Commit(); } //End Transaction } //End Session }
/// <getGoogelAnalyticsAccountDetailsById> /// Get the details of googel analytics account by Google account id and user id. /// </summary> /// <param name="gauserid">Id of goole accont(String)</param> /// <param name="userId">Id of user(Guid)</param> /// <returns>Return object of Google analytic class.(Domein.GoogleAnalyticsAccount)</returns> public GoogleAnalyticsAccount getGoogelAnalyticsAccountDetailsById(string gauserid, Guid userId) { //Creates a database connection and opens up a session using (NHibernate.ISession session = SessionFactory.GetNewSession()) { //After Session creation, start Transaction. using (NHibernate.ITransaction transaction = session.BeginTransaction()) { //Proceed action, to get deatils of account NHibernate.IQuery query = session.CreateQuery("from GoogleAnalyticsAccount where GaProfileId = :GaAccountId and UserId=:userId"); query.SetParameter("GaAccountId", gauserid); query.SetParameter("userId", userId); GoogleAnalyticsAccount result = (GoogleAnalyticsAccount)query.UniqueResult(); return(result); } //End Trnsaction } //End Session }
protected void Page_Load(object sender, EventArgs e) { oAuthTokenGa obj = new oAuthTokenGa(); Accounts objAcc = new Accounts(); Analytics objAlyt = new Analytics(); User user = (User)Session["LoggedUser"]; if (!IsPostBack) { if (Session["login"] == null) { if (user == null) { Response.Redirect("Default.aspx"); } } try { string strRefresh = obj.GetRefreshToken(Request.QueryString["code"].ToString()); if (!strRefresh.StartsWith("[")) { strRefresh = "[" + strRefresh + "]"; } JArray objArray = JArray.Parse(strRefresh); GoogleAnalyticsAccount objGaAcc = new GoogleAnalyticsAccount(); GoogleAnalyticsAccountRepository objGaAccRepo = new GoogleAnalyticsAccountRepository(); GanalyticsHelper objGaHelper = new GanalyticsHelper(); SocialProfilesRepository socioprofilerepo = new SocialProfilesRepository(); SocialProfile socioprofile = new SocialProfile(); foreach (var item in objArray) { DataSet dsAccount = objAcc.getGaAccounts(item["access_token"].ToString()); objGaAcc.RefreshToken = item["refresh_token"].ToString(); objGaAcc.AccessToken = item["access_token"].ToString(); objGaAcc.EmailId = dsAccount.Tables["title"].Rows[0]["title_Text"].ToString(); objGaAcc.EntryDate = DateTime.Now; objGaAcc.GaAccountId = dsAccount.Tables["property"].Rows[0]["value"].ToString(); objGaAcc.GaAccountName = dsAccount.Tables["property"].Rows[1]["value"].ToString(); objGaAcc.Id = Guid.NewGuid(); objGaAcc.IsActive = true; objGaAcc.UserId = user.Id; DataSet dsProfile = objAcc.getGaProfiles(item["access_token"].ToString(), objGaAcc.GaAccountId); int profileCount = dsProfile.Tables["property"].Select("name='ga:profileId'").Length; string[,] names = new string[profileCount, 2]; int tempCount = 0; foreach (DataRow dRow in dsProfile.Tables["property"].Rows) { //if (dRow["name"].Equals("ga:profileId") || dRow["name"].Equals("ga:profileName")) { if (dRow["name"].Equals("ga:profileId")) { objGaAcc.GaProfileId = dRow["value"].ToString(); names[tempCount, 0] = dRow["value"].ToString(); } if (dRow["name"].Equals("ga:profileName")) { names[tempCount, 1] = dRow["value"].ToString(); objGaAcc.GaProfileName = dRow["value"].ToString(); } if (tempCount >= profileCount) { break; } if (names[tempCount, 0] != null && names[tempCount, 1] != null) { tempCount++; } } } socioprofile.Id = Guid.NewGuid(); socioprofile.ProfileDate = DateTime.Now; socioprofile.ProfileId = objGaAcc.GaAccountId; socioprofile.ProfileType = "googleanalytics"; socioprofile.UserId = user.Id; if (!objGaAccRepo.checkGoogelAnalyticsUserExists(objGaAcc.GaAccountId, user.Id)) { for (int i = 0; i < profileCount; i++) { objGaAcc.GaProfileId = names[i, 0]; objGaAcc.GaProfileName = names[i, 1]; if (!objGaAccRepo.checkGoogelAnalyticsProfileExists(objGaAcc.GaAccountId, objGaAcc.GaProfileId, user.Id)) { objGaAccRepo.addGoogleAnalyticsUser(objGaAcc); } else { objGaAccRepo.updateGoogelAnalyticsUser(objGaAcc); } objGaHelper.getCountryAnalyticsApi(objGaAcc.GaProfileId, user.Id); objGaHelper.getYearWiseAnalyticsApi(objGaAcc.GaProfileId, user.Id); objGaHelper.getMonthWiseAnalyticsApi(objGaAcc.GaProfileId, user.Id); objGaHelper.getDayWiseAnalyticsApi(objGaAcc.GaProfileId, user.Id); } if (!socioprofilerepo.checkUserProfileExist(socioprofile)) { socioprofilerepo.addNewProfileForUser(socioprofile); } else { socioprofilerepo.updateSocialProfile(socioprofile); } } else { //objGaAccRepo.updateGoogelAnalyticsUser(objGaAcc); for (int i = 0; i < names.Length; i++) { objGaAcc.GaProfileId = names[i, 0]; objGaAcc.GaProfileName = names[i, 1]; if (!objGaAccRepo.checkGoogelAnalyticsProfileExists(objGaAcc.GaAccountId, objGaAcc.GaProfileId, user.Id)) { objGaAccRepo.addGoogleAnalyticsUser(objGaAcc); } else { objGaAccRepo.updateGoogelAnalyticsUser(objGaAcc); } } if (!socioprofilerepo.checkUserProfileExist(socioprofile)) { socioprofilerepo.addNewProfileForUser(socioprofile); } else { socioprofilerepo.updateSocialProfile(socioprofile); } } Response.Redirect("Home.aspx"); } } catch (Exception Err) { logger.Error(Err.StackTrace); try { Response.Redirect("/Home.aspx"); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } }
private static async Task <ISocialSiteAccount> GetSocialAccountFromGroupProfile(Guid objUserid, Domain.Socioboard.Domain.GroupProfile objGroupProfile) { ISocialSiteAccount objSocialSiteAccount = null; string accesstoken = string.Empty; try { accesstoken = System.Web.HttpContext.Current.Session["access_token"].ToString(); } catch { } if (objGroupProfile.ProfileType == "facebook" || objGroupProfile.ProfileType == "facebook_page") { //using (Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount()) //{ // ApiobjFacebookAccount.Timeout = 300000; // objSocialSiteAccount = (FacebookAccount)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.getFacebookAccountDetailsById(objUserid.ToString(), objGroupProfile.ProfileId.ToString()), typeof(FacebookAccount))); //} FacebookAccount fbaccount = new FacebookAccount(); HttpResponseMessage fbresponse = await WebApiReq.GetReq("api/ApiFacebookAccount/GetFacebookAcoount?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken); if (fbresponse.IsSuccessStatusCode) { fbaccount = await fbresponse.Content.ReadAsAsync <Domain.Socioboard.Domain.FacebookAccount>(); objSocialSiteAccount = fbaccount; } } else if (objGroupProfile.ProfileType == "twitter") { //using (Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount()) //{ // ApiobjTwitterAccount.Timeout = 300000; // objSocialSiteAccount = (TwitterAccount)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetTwitterAccountDetailsById(objUserid.ToString(), objGroupProfile.ProfileId.ToString()), typeof(TwitterAccount))); //} TwitterAccount twitterAcc = new TwitterAccount(); HttpResponseMessage twitterresponse = await WebApiReq.GetReq("api/ApiTwitterAccount/GetTwitterAccountDetailsById?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken); if (twitterresponse.IsSuccessStatusCode) { twitterAcc = await twitterresponse.Content.ReadAsAsync <Domain.Socioboard.Domain.TwitterAccount>(); objSocialSiteAccount = twitterAcc; } } else if (objGroupProfile.ProfileType == "linkedin") { //using (Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount()) //{ // ApiobjLinkedinAccount.Timeout = 300000; // objSocialSiteAccount = (LinkedInAccount)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetLinkedinAccountDetailsById(objUserid.ToString(), objGroupProfile.ProfileId.ToString()), typeof(LinkedInAccount))); //} LinkedInAccount LinkedinAcc = new LinkedInAccount(); HttpResponseMessage Linkedinresponse = await WebApiReq.GetReq("api/ApiLinkedinAccount/GetLinkedinAccountDetailsById?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken); if (Linkedinresponse.IsSuccessStatusCode) { LinkedinAcc = await Linkedinresponse.Content.ReadAsAsync <Domain.Socioboard.Domain.LinkedInAccount>(); objSocialSiteAccount = LinkedinAcc; } } else if (objGroupProfile.ProfileType == "instagram") { //using (Api.InstagramAccount.InstagramAccount ApiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount()) //{ // objSocialSiteAccount = (InstagramAccount)(new JavaScriptSerializer().Deserialize(ApiobjInstagramAccount.UserInformation(objUserid.ToString(), objGroupProfile.ProfileId.ToString()), typeof(InstagramAccount))); //} InstagramAccount instAcc = new InstagramAccount(); HttpResponseMessage response = await WebApiReq.GetReq("api/ApiInstagramAccount/GetInstagramAccount?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken); if (response.IsSuccessStatusCode) { instAcc = await response.Content.ReadAsAsync <Domain.Socioboard.Domain.InstagramAccount>(); objSocialSiteAccount = instAcc; } } else if (objGroupProfile.ProfileType == "youtube") { //using (Api.YoutubeAccount.YoutubeAccount ApiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount()) //{ // ApiobjYoutubeAccount.Timeout = 300000; // objSocialSiteAccount = (YoutubeAccount)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeAccount.GetYoutubeAccountDetailsById(objUserid.ToString(), objGroupProfile.ProfileId.ToString()), typeof(YoutubeAccount))); //} YoutubeAccount ytAcc = new YoutubeAccount(); HttpResponseMessage response = await WebApiReq.GetReq("api/ApiYoutubeAccount/GetYoutubeAccount?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken); if (response.IsSuccessStatusCode) { ytAcc = await response.Content.ReadAsAsync <Domain.Socioboard.Domain.YoutubeAccount>(); objSocialSiteAccount = ytAcc; } } else if (objGroupProfile.ProfileType == "tumblr") { //using (Api.TumblrAccount.TumblrAccount ApiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount()) //{ // ApiobjTumblrAccount.Timeout = 300000; // objSocialSiteAccount = (TumblrAccount)(new JavaScriptSerializer().Deserialize(ApiobjTumblrAccount.GetTumblrAccountDetailsById(objUserid.ToString(), objGroupProfile.ProfileId.ToString()), typeof(TumblrAccount))); //} TumblrAccount ytAcc = new TumblrAccount(); HttpResponseMessage response = await WebApiReq.GetReq("api/ApiTumblrAccount/GetTumblrAccountDetailsById?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken); if (response.IsSuccessStatusCode) { ytAcc = await response.Content.ReadAsAsync <Domain.Socioboard.Domain.TumblrAccount>(); objSocialSiteAccount = ytAcc; } } else if (objGroupProfile.ProfileType == "linkedincompanypage") { //using (Api.LinkedinCompanyPage.LinkedinCompanyPage objLinkedinCompanyPage = new Api.LinkedinCompanyPage.LinkedinCompanyPage()) //{ // objLinkedinCompanyPage.Timeout = 300000; // objSocialSiteAccount = (LinkedinCompanyPage)(new JavaScriptSerializer().Deserialize(objLinkedinCompanyPage.GetLinkedinCompanyPageDetailsByUserIdAndPageId(objUserid.ToString(), objGroupProfile.ProfileId.ToString()), typeof(LinkedinCompanyPage))); //} LinkedinCompanyPage licompanypage = new LinkedinCompanyPage(); HttpResponseMessage response = await WebApiReq.GetReq("api/ApiLinkedinCompanyPage/GetLinkedinCompanyPageDetailsByUserIdAndPageId?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken); if (response.IsSuccessStatusCode) { licompanypage = await response.Content.ReadAsAsync <Domain.Socioboard.Domain.LinkedinCompanyPage>(); objSocialSiteAccount = licompanypage; } } else if (objGroupProfile.ProfileType == "gplus") { //using (Api.GooglePlusAccount.GooglePlusAccount ApiobjGooglePlusAccount = new Api.GooglePlusAccount.GooglePlusAccount()) //{ // ApiobjGooglePlusAccount.Timeout = 300000; // objSocialSiteAccount = (GooglePlusAccount)(new JavaScriptSerializer().Deserialize(ApiobjGooglePlusAccount.GetGooglePlusAccountDetailsById(objUserid.ToString(), objGroupProfile.ProfileId), typeof(GooglePlusAccount))); //} GooglePlusAccount googlePlusAccount = new GooglePlusAccount(); HttpResponseMessage response = await WebApiReq.GetReq("api/ApiGooglePlusAccount/GetGooglePlusAccount?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken); if (response.IsSuccessStatusCode) { googlePlusAccount = await response.Content.ReadAsAsync <Domain.Socioboard.Domain.GooglePlusAccount>(); objSocialSiteAccount = googlePlusAccount; } } else if (objGroupProfile.ProfileType == "googleanalytics") { //using (Api.GoogleAnalyticsAccount.GoogleAnalyticsAccount ApiobjGoogleAnalyticsAccount = new Api.GoogleAnalyticsAccount.GoogleAnalyticsAccount()) //{ // ApiobjGoogleAnalyticsAccount.Timeout = 300000; // objSocialSiteAccount = (GoogleAnalyticsAccount)(new JavaScriptSerializer().Deserialize(ApiobjGoogleAnalyticsAccount.GetGooglePlusAccountDetailsById(objUserid.ToString(), objGroupProfile.ProfileId), typeof(GoogleAnalyticsAccount))); //} GoogleAnalyticsAccount googlePlusAccount = new GoogleAnalyticsAccount(); HttpResponseMessage response = await WebApiReq.GetReq("api/ApiGoogleAnalyticsAccount/GetGooglePlusAccountDetailsById?ProfileId=" + objGroupProfile.ProfileId + "&UserId=" + objUserid.ToString(), "Bearer", accesstoken); if (response.IsSuccessStatusCode) { googlePlusAccount = await response.Content.ReadAsAsync <Domain.Socioboard.Domain.GoogleAnalyticsAccount>(); objSocialSiteAccount = googlePlusAccount; } } return(objSocialSiteAccount); }