コード例 #1
0
        public DataTable getCountryAnalyticsApi(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.getGoogelAnalyticsAccountHomeDetailsById(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();
                    xDoc.LoadXml(objAlyt.getAnalyticsData(objGaAcc.GaProfileId, "metrics=ga:visits&dimensions=ga:country", "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:country"))
                            objGaStats.gaCountry = dtAnalytics.Rows[i]["title"].ToString().Substring(11);
                        objGaStats.gaVisits = dtAnalytics.Rows[i]["ga:visitors"].ToString();
                        objGaStats.GaProfileId = objGaAcc.GaProfileId;
                        objGaStats.Id = Guid.NewGuid();
                        objGaStats.UserId = user;
                        if (!objGaStatsRepo.checkGoogleAnalyticsDateStatsExists(objGaAcc.GaProfileId, "country", dtAnalytics.Rows[i]["title"].ToString(), user))
                            objGaStatsRepo.addGoogleAnalyticsStats(objGaStats);
                        else
                            objGaStatsRepo.updateGoogleAnalyticsStats(objGaStats);
                    }
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }
            return dtAnalytics;
        }
コード例 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         User user = (User)HttpContext.Current.Session["LoggedUser"];
      
         // objGaHelper.getAnalytics();
         GoogleAnalyticsStatsRepository objGaStatsRepo = new GoogleAnalyticsStatsRepository();
         GoogleAnalyticsAccountRepository objGaAccRepo = new GoogleAnalyticsAccountRepository();
         ArrayList arrAcc = objGaAccRepo.getGoogelAnalyticsAccountsOfUser(user.Id);
         foreach (var item in arrAcc)
         {
             Array temp = (Array)item;
             //objGaHelper.getYearWiseAnalyticsApi(item);
             ddlAccounts.Items.Add(new ListItem(temp.GetValue(1).ToString(), temp.GetValue(0).ToString()));
         }
         getProfilesofAccount(ddlAccounts.SelectedValue);
         getanalytics();
         //ddlAccounts.Items.Insert(0, "--Select--");
     }
 }
コード例 #3
0
ファイル: delete.cs プロジェクト: JBNavadiya/socioboard
        public string DeleteAllUsersByCreateDate(string date)
        {
            int i = 0;
            int count = 0;
            UserRepository objUserRepository = new UserRepository();
            List<User> lstuser = objUserRepository.GetAllUsersByCreateDate(date);
            ArchiveMessageRepository objArchiveMessageRepository = new ArchiveMessageRepository();
            DiscoverySearchRepository objDiscoverySearchRepository = new DiscoverySearchRepository();
            DraftsRepository objDraftsRepository = new DraftsRepository();
            FacebookAccountRepository objFacebookAccountRepository = new FacebookAccountRepository();
            FacebookFeedRepository objFacebookFeedRepository = new FacebookFeedRepository();
            FacebookInsightPostStatsRepository objFacebookInsightPostStatsRepository = new FacebookInsightPostStatsRepository();
            FacebookInsightStatsRepository objFacebookInsightStatsRepository = new FacebookInsightStatsRepository();
            FacebookMessageRepository objFacebookMessageRepository = new FacebookMessageRepository();
            FacebookStatsRepository objFacebookStatsRepository = new FacebookStatsRepository();
            GoogleAnalyticsAccountRepository objGoogleAnalyticsAccountRepository = new GoogleAnalyticsAccountRepository();
            GoogleAnalyticsStatsRepository objGoogleAnalyticsStatsRepository = new GoogleAnalyticsStatsRepository();
            GooglePlusAccountRepository objGooglePlusAccountRepository = new GooglePlusAccountRepository();
            GooglePlusActivitiesRepository objGooglePlusActivitiesRepository = new GooglePlusActivitiesRepository();
            GroupProfileRepository objGroupProfileRepository = new GroupProfileRepository();
            GroupRepository objGroupRepository = new GroupRepository();
            InstagramAccountRepository objInstagramAccountRepository = new InstagramAccountRepository();
            InstagramCommentRepository objInstagramCommentRepository = new InstagramCommentRepository();
            InstagramFeedRepository objInstagramFeedRepository = new InstagramFeedRepository();
            LinkedInAccountRepository objLinkedInAccountRepository = new LinkedInAccountRepository();
            LinkedInFeedRepository objLinkedInFeedRepository = new LinkedInFeedRepository();
            LogRepository objLogRepository = new LogRepository();
            RssFeedsRepository objRssFeedsRepository = new RssFeedsRepository();
            RssReaderRepository objRssReaderRepository = new RssReaderRepository();
            ScheduledMessageRepository objScheduledMessageRepository = new ScheduledMessageRepository();
            SocialProfilesRepository objSocialProfilesRepository = new SocialProfilesRepository();
            TaskCommentRepository objTaskCommentRepository = new TaskCommentRepository();
            TaskRepository objTaskRepository = new TaskRepository();
            TeamRepository objTeamRepository = new TeamRepository();
            TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository();
            TwitterAccountRepository objTwitterAccountRepository = new TwitterAccountRepository();
            TwitterDirectMessageRepository objTwitterDirectMessageRepository = new TwitterDirectMessageRepository();
            TwitterFeedRepository objTwitterFeedRepository = new TwitterFeedRepository();
            TwitterMessageRepository objTwitterMessageRepository = new TwitterMessageRepository();
            TwitterStatsRepository objTwitterStatsRepository = new TwitterStatsRepository();
            UserActivationRepository objUserActivationRepository = new UserActivationRepository();
            UserPackageRelationRepository objUserPackageRelationRepository = new UserPackageRelationRepository();






            count = lstuser.Count();


            foreach (var item in lstuser)
            {
                i++;
                try
                {

                    if (item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**")
                    {

                    }
                    else
                    {
                        objArchiveMessageRepository.DeleteArchiveMessageByUserid(item.Id);
                        objDiscoverySearchRepository.DeleteDiscoverySearchByUserid(item.Id);
                        objDraftsRepository.DeleteDraftsByUserid(item.Id);
                        objFacebookAccountRepository.DeleteFacebookAccountByUserid(item.Id);
                        objFacebookFeedRepository.DeleteFacebookFeedByUserid(item.Id);
                        objFacebookInsightPostStatsRepository.DeleteFacebookInsightPostStatsByUserid(item.Id);
                        objFacebookInsightStatsRepository.DeleteFacebookInsightStatsByUserid(item.Id);
                        objFacebookMessageRepository.DeleteFacebookMessageByUserid(item.Id);
                        objFacebookStatsRepository.DeleteFacebookStatsByUserid(item.Id);
                        objGoogleAnalyticsAccountRepository.DeleteGoogleAnalyticsAccountByUserid(item.Id);
                        objGoogleAnalyticsStatsRepository.DeleteGoogleAnalyticsStatsByUserid(item.Id);
                        objGooglePlusAccountRepository.DeleteGooglePlusAccountByUserid(item.Id);
                        objGooglePlusActivitiesRepository.DeleteGooglePlusActivitiesByUserid(item.Id);
                        objGroupProfileRepository.DeleteGroupProfileByUserid(item.Id);
                        objGroupRepository.DeleteGroupsByUserid(item.Id);
                        objInstagramAccountRepository.DeleteInstagramAccountByUserid(item.Id);
                        objInstagramCommentRepository.DeleteInstagramCommentByUserid(item.Id);
                        objInstagramFeedRepository.DeleteInstagramFeedByUserid(item.Id);
                        objLinkedInAccountRepository.DeleteLinkedInAccountByUserid(item.Id);
                        objLinkedInFeedRepository.DeleteLinkedInFeedByUserid(item.Id);
                        objLogRepository.DeleteLogByUserid(item.Id);
                        objRssFeedsRepository.DeleteRssFeedsByUserid(item.Id);
                        objRssReaderRepository.DeleteRssReaderByUserid(item.Id);
                        objScheduledMessageRepository.DeleteScheduledMessageByUserid(item.Id);
                        objSocialProfilesRepository.DeleteSocialProfileByUserid(item.Id);
                        objTaskCommentRepository.DeleteTaskCommentByUserid(item.Id);
                        objTaskRepository.DeleteTasksByUserid(item.Id);
                        objTeamRepository.DeleteTeamByUserid(item.Id);
                        objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(item.Id);
                        objTwitterAccountRepository.DeleteTwitterAccountByUserid(item.Id);
                        objTwitterDirectMessageRepository.DeleteTwitterDirectMessagesByUserid(item.Id);
                        objTwitterFeedRepository.DeleteTwitterFeedByUserid(item.Id);
                        objTwitterMessageRepository.DeleteTwitterMessageByUserid(item.Id);
                        objTwitterStatsRepository.DeleteTwitterStatsByUserid(item.Id);
                        objUserActivationRepository.DeleteUserActivationByUserid(item.Id);
                        objUserPackageRelationRepository.DeleteuserPackageRelationByUserid(item.Id);
                        objUserRepository.DeleteUserByUserid(item.Id);
                    }
                }
                catch (Exception ex)
                {

                    Console.WriteLine(ex.Message);
                }
            }
           return i +" "+count;
        }
コード例 #4
0
        public string getDayWiseAnalytics(string gaAccountId)
        {
            string strYearVal = string.Empty;
            try
            {
                User user = (User)HttpContext.Current.Session["LoggedUser"];

                GoogleAnalyticsStats objGaStats = new GoogleAnalyticsStats();
                GoogleAnalyticsStatsRepository objGaStatsRepo = new GoogleAnalyticsStatsRepository();
                ArrayList arrCountry = objGaStatsRepo.getGoogleAnalyticsStatsYearById(gaAccountId, user.Id, 7, "day");

                string strYear = string.Empty;
                string strVal = string.Empty;
                int cnt = 0;
                foreach (var item in arrCountry)
                {
                    cnt++;
                    Array temp = (Array)item;
                    strYear = strYear + temp.GetValue(3).ToString() + ",";
                    strVal = strVal + temp.GetValue(8).ToString() + ",";
                }
                if (cnt < 7)
                {
                    for (int j = 0; j < 7 - cnt; j++)
                    {
                        strYear = strYear + "0,";
                        strVal = strVal + "0,";
                    }
                }
                strYearVal = strYear.Substring(0, strYear.Length - 1) + "@" + strVal.Substring(0, strVal.Length - 1);
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }
            return strYearVal;
        }