public string getdate(string profileId, int days) { string strArray = string.Empty; try { TwitterStatsRepository objtwtstatsRepo = new TwitterStatsRepository(); ArrayList alstTwt = objtwtstatsRepo.getTwitterStatsById(profileId, days); int increament = 0; if (alstTwt.Count > 5) { increament = alstTwt.Count / 5; } // strArray = "["; string str = string.Empty; int cnt = 0; if (alstTwt.Count > 0) { if (increament > 0) { for (int i = 0; i < alstTwt.Count; i = i + increament) { Array temp = (Array)alstTwt[i]; strArray = strArray + temp.GetValue(16).ToString() + ","; cnt++; } } else { foreach (var itemTS in alstTwt) { Array temp = (Array)itemTS; strArray = strArray + temp.GetValue(16).ToString() + ","; cnt++; } } } if (cnt < 7) { for (int j = 0; j < 7 - cnt; j++) { str = str + "0,"; } } strArray = str + strArray; strArray = strArray.Substring(0, strArray.Length - 1); // strArray += "]"; } catch (Exception Err) { Console.Write(Err.StackTrace); } return strArray; }
public string getInfluence(User user, string profileId,int days) { string strArray = string.Empty; try { TwitterStatsRepository objtwtstatsRepo = new TwitterStatsRepository(); ArrayList alstTwt = objtwtstatsRepo.getTwitterStatsById(user.Id, profileId,days); // strArray = "["; int cnt = 0; string str = string.Empty; if (alstTwt.Count > 0) { foreach(var itemInf in alstTwt) { Array temp = (Array)itemInf; strArray = strArray + temp.GetValue(8).ToString() + ","; cnt++; } } if (cnt < 7) { for (int j = 0; j < 7 - cnt; j++) { str=str + "0,"; } } strArray = str + strArray.Substring(0,strArray.Length-1); } catch (Exception Err) { Console.Write(Err.StackTrace); } return strArray; }
//public string getRetweets(User user, string profileId) //{ // TwitterMessageRepository objretwt = new TwitterMessageRepository(); // string strArray = string.Empty; // try // { // int cnt = 0; // ArrayList alstTwt = objretwt.getRetweetStatsByProfileId(user.Id, profileId); // if (alstTwt != null) // { // // strArray = "["; // for (int i = 0; i < alstTwt.Count; i++) // { // strArray = strArray + alstTwt[i].ToString() + ","; // cnt++; // } // } // if (cnt < 7) // { // for (int j = 0; j < 7 - cnt; j++) // { // strArray = strArray + "0,"; // } // } // strArray = strArray.Substring(0, strArray.Length - 1); // } // catch (Exception Err) // { // Console.Write(Err.StackTrace); // } // return strArray; //} public string getEngagements(User user, string profileId,int days) { string strArray = string.Empty; try { TwitterStatsRepository objtwtstatsRepo = new TwitterStatsRepository(); ArrayList alstTwt = objtwtstatsRepo.getTwitterStatsById(user.Id, profileId,days); // strArray = "["; int cnt = 0; if (alstTwt.Count > 0) { foreach(var itemTS in alstTwt) { Array temp = (Array)itemTS; strArray = strArray + temp.GetValue(7).ToString(); cnt++; } } if (cnt < 7) { for (int j = 0; j < 7 - cnt; j++) { strArray = strArray + ",0"; } } // strArray += "]"; } catch (Exception Err) { Console.Write(Err.StackTrace); } return strArray; }