Esempio n. 1
0
        public string MoveTwitterFeedTOMOngo()
        {
            TwitterFeedRepository twtfeedrepo = new TwitterFeedRepository();
            string          output            = string.Empty;
            bool            exit      = true;
            int             skip      = 0;
            MongoRepository mongorepo = new MongoRepository("TwitterFeed");

            while (exit)
            {
                List <Domain.Socioboard.Domain.TwitterFeed> fbmsgs = twtfeedrepo.getAllTwitterFeedsMongo(skip);
                if (fbmsgs.Count() == 0)
                {
                    exit = false;
                }

                foreach (var item in fbmsgs)
                {
                    Domain.Socioboard.MongoDomain.TwitterFeed mfbmsg = new Domain.Socioboard.MongoDomain.TwitterFeed();
                    mfbmsg.Id = MongoDB.Bson.ObjectId.GenerateNewId();
                    //  mfbmsg.EntryDate = item.EntryDate.ToString();
                    mfbmsg.Feed                  = item.Feed;
                    mfbmsg.FeedDate              = item.FeedDate.ToString("yyyy/MM/dd HH:mm:ss");
                    mfbmsg.FromId                = item.FromId;
                    mfbmsg.FromName              = item.FromName;
                    mfbmsg.FromProfileUrl        = item.FromProfileUrl;
                    mfbmsg.FromScreenName        = item.FromScreenName;
                    mfbmsg.MessageId             = item.MessageId;
                    mfbmsg.InReplyToStatusUserId = item.InReplyToStatusUserId;
                    mfbmsg.MessageId             = item.MessageId;
                    mfbmsg.MediaUrl              = string.Empty;
                    mfbmsg.ProfileId             = item.ProfileId;
                    mfbmsg.Type                  = item.Type;
                    mfbmsg.ScreenName            = item.ScreenName;
                    mfbmsg.SourceUrl             = item.SourceUrl;
                    mfbmsg.strId                 = mfbmsg.Id.ToString();
                    // mfbmsg.UserId = item.UserId.ToString();
                    mongorepo.Add <Domain.Socioboard.MongoDomain.TwitterFeed>(mfbmsg);
                }
                skip = skip + 50;
            }

            return(output);
        }
        public string MoveTwitterFeedTOMOngo() 
        {
            TwitterFeedRepository twtfeedrepo = new TwitterFeedRepository();
            string output = string.Empty;
            bool exit = true;
            int skip = 0;
            MongoRepository mongorepo = new MongoRepository("TwitterFeed");

            while (exit)
            {
                List<Domain.Socioboard.Domain.TwitterFeed> fbmsgs = twtfeedrepo.getAllTwitterFeedsMongo(skip);
                if (fbmsgs.Count() == 0)
                {
                    exit = false;
                }

                foreach (var item in fbmsgs)
                {
                    Domain.Socioboard.MongoDomain.TwitterFeed mfbmsg = new Domain.Socioboard.MongoDomain.TwitterFeed();
                    mfbmsg.Id = MongoDB.Bson.ObjectId.GenerateNewId();
                  //  mfbmsg.EntryDate = item.EntryDate.ToString();
                    mfbmsg.Feed = item.Feed;
                    mfbmsg.FeedDate = item.FeedDate.ToString("yyyy/MM/dd HH:mm:ss");
                    mfbmsg.FromId = item.FromId;
                    mfbmsg.FromName = item.FromName;
                    mfbmsg.FromProfileUrl = item.FromProfileUrl;
                    mfbmsg.FromScreenName = item.FromScreenName;
                    mfbmsg.MessageId = item.MessageId;
                    mfbmsg.InReplyToStatusUserId = item.InReplyToStatusUserId;
                    mfbmsg.MessageId = item.MessageId;
                    mfbmsg.MediaUrl = string.Empty ;
                    mfbmsg.ProfileId = item.ProfileId;
                    mfbmsg.Type = item.Type;
                    mfbmsg.ScreenName = item.ScreenName;
                    mfbmsg.SourceUrl = item.SourceUrl;
                    mfbmsg.strId = mfbmsg.Id.ToString();
                   // mfbmsg.UserId = item.UserId.ToString();
                    mongorepo.Add<Domain.Socioboard.MongoDomain.TwitterFeed>(mfbmsg);
                }
                skip = skip + 50;
            }

            return output;
        }
        public string GetTicketsofGroup(string GroupId, string UserId)
        {
            string AssignedUser = string.Empty;
            try
            {
                GroupProfileRepository objGroupProfileRepository = new GroupProfileRepository();
                FacebookFeedRepository objFacebookFeedRepository = new FacebookFeedRepository();
                TwitterFeedRepository objTwitterFeedRepository = new TwitterFeedRepository();
                List<Domain.Socioboard.Domain.FeedSentimentalAnalysis> lstNegativeFeedsOfUser = new List<Domain.Socioboard.Domain.FeedSentimentalAnalysis>();
                List<Domain.Socioboard.Domain.GroupProfile> objGroupProfile = new List<Domain.Socioboard.Domain.GroupProfile>();
                List<FBTwitterFeeds> objListFBTwitterFeeds = new List<FBTwitterFeeds>();

                objGroupProfile = objGroupProfileRepository.getAllGroupProfiles(Guid.Parse(UserId), Guid.Parse(GroupId));

                if (objGroupProfile.Count > 0)
                {
                    lstNegativeFeedsOfUser = _FeedSentimentalAnalysisRepository.getAllNegativeFeedsOfUser(Guid.Parse(UserId));
                }
                else
                {
                    lstNegativeFeedsOfUser = _FeedSentimentalAnalysisRepository.getNegativeFeedsOfUser(Guid.Parse(UserId));
                }
                if (lstNegativeFeedsOfUser != null)
                {
                    foreach (var item in lstNegativeFeedsOfUser)
                    {
                        FBTwitterFeeds objFBTwitterFeeds = new FBTwitterFeeds();
                        UserRepository objUserRepository = new UserRepository();
                        Domain.Socioboard.Domain.User user = objUserRepository.getUsersById(item.AssigneUserId);
                        if (objGroupProfileRepository.checkProfileExistsingroup(Guid.Parse(GroupId), item.ProfileId))
                        {
                            string Network = item.Network;
                            if (Network == "facebook")
                            {
                                Domain.Socioboard.Domain.FacebookFeed facebookfeed = objFacebookFeedRepository.getFacebookFeedByProfileId(item.ProfileId, item.FeedId);
                                if (facebookfeed != null)
                                {
                                    objFBTwitterFeeds.FacebookFeed = facebookfeed;
                                }
                            }
                            if (Network == "twitter")
                            {
                                Domain.Socioboard.Domain.TwitterFeed twtfeed = objTwitterFeedRepository.getTwitterFeedByProfileId(item.ProfileId, item.FeedId);
                                if (twtfeed != null)
                                {
                                    objFBTwitterFeeds.TwitterFeed = twtfeed;
                                }
                            }
                            if (objFBTwitterFeeds.TwitterFeed != null)
                            {
                                try
                                {
                                    objFBTwitterFeeds.TicketNo = item.TicketNo;
                                    if (user != null)
                                    {
                                        objFBTwitterFeeds.AssignedUser = user.UserName;
                                    }
                                    else
                                    {
                                        objFBTwitterFeeds.AssignedUser = "";
                                    }
                                    objListFBTwitterFeeds.Add(objFBTwitterFeeds);
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.StackTrace);
                                }
                            }
                            if (objFBTwitterFeeds.FacebookFeed != null)
                            {
                                try
                                {
                                    objFBTwitterFeeds.TicketNo = item.TicketNo;
                                    if (user != null)
                                    {
                                        objFBTwitterFeeds.AssignedUser = user.UserName;
                                    }
                                    else
                                    {
                                        objFBTwitterFeeds.AssignedUser = "";
                                    }
                                    objListFBTwitterFeeds.Add(objFBTwitterFeeds);
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.StackTrace);
                                }
                            }
                        }
                    } 
                }
               
                return new JavaScriptSerializer().Serialize(objListFBTwitterFeeds);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return "SomethingWentWrong";
            }

        }
        public string GetTicketsofGroup(string GroupId, string UserId)
        {
            string AssignedUser = string.Empty;

            try
            {
                GroupProfileRepository objGroupProfileRepository = new GroupProfileRepository();
                FacebookFeedRepository objFacebookFeedRepository = new FacebookFeedRepository();
                TwitterFeedRepository  objTwitterFeedRepository  = new TwitterFeedRepository();
                List <Domain.Socioboard.Domain.FeedSentimentalAnalysis> lstNegativeFeedsOfUser = new List <Domain.Socioboard.Domain.FeedSentimentalAnalysis>();
                List <Domain.Socioboard.Domain.GroupProfile>            objGroupProfile        = new List <Domain.Socioboard.Domain.GroupProfile>();
                List <FBTwitterFeeds> objListFBTwitterFeeds = new List <FBTwitterFeeds>();

                objGroupProfile = objGroupProfileRepository.getAllGroupProfiles(Guid.Parse(UserId), Guid.Parse(GroupId));

                if (objGroupProfile.Count > 0)
                {
                    lstNegativeFeedsOfUser = _FeedSentimentalAnalysisRepository.getAllNegativeFeedsOfUser(Guid.Parse(UserId));
                }
                else
                {
                    lstNegativeFeedsOfUser = _FeedSentimentalAnalysisRepository.getNegativeFeedsOfUser(Guid.Parse(UserId));
                }
                if (lstNegativeFeedsOfUser != null)
                {
                    foreach (var item in lstNegativeFeedsOfUser)
                    {
                        FBTwitterFeeds objFBTwitterFeeds   = new FBTwitterFeeds();
                        UserRepository objUserRepository   = new UserRepository();
                        Domain.Socioboard.Domain.User user = objUserRepository.getUsersById(item.AssigneUserId);
                        if (objGroupProfileRepository.checkProfileExistsingroup(Guid.Parse(GroupId), item.ProfileId))
                        {
                            string Network = item.Network;
                            if (Network == "facebook")
                            {
                                Domain.Socioboard.Domain.FacebookFeed facebookfeed = objFacebookFeedRepository.getFacebookFeedByProfileId(item.ProfileId, item.FeedId);
                                if (facebookfeed != null)
                                {
                                    objFBTwitterFeeds.FacebookFeed = facebookfeed;
                                }
                            }
                            if (Network == "twitter")
                            {
                                Domain.Socioboard.Domain.TwitterFeed twtfeed = objTwitterFeedRepository.getTwitterFeedByProfileId(item.ProfileId, item.FeedId);
                                if (twtfeed != null)
                                {
                                    objFBTwitterFeeds.TwitterFeed = twtfeed;
                                }
                            }
                            if (objFBTwitterFeeds.TwitterFeed != null)
                            {
                                try
                                {
                                    objFBTwitterFeeds.TicketNo = item.TicketNo;
                                    if (user != null)
                                    {
                                        objFBTwitterFeeds.AssignedUser = user.UserName;
                                    }
                                    else
                                    {
                                        objFBTwitterFeeds.AssignedUser = "";
                                    }
                                    objListFBTwitterFeeds.Add(objFBTwitterFeeds);
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.StackTrace);
                                }
                            }
                            if (objFBTwitterFeeds.FacebookFeed != null)
                            {
                                try
                                {
                                    objFBTwitterFeeds.TicketNo = item.TicketNo;
                                    if (user != null)
                                    {
                                        objFBTwitterFeeds.AssignedUser = user.UserName;
                                    }
                                    else
                                    {
                                        objFBTwitterFeeds.AssignedUser = "";
                                    }
                                    objListFBTwitterFeeds.Add(objFBTwitterFeeds);
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.StackTrace);
                                }
                            }
                        }
                    }
                }

                return(new JavaScriptSerializer().Serialize(objListFBTwitterFeeds));
            }
            catch (Exception ex)
            {
                logger.Error(ex.StackTrace);
                logger.Error(ex.Message);
                Console.WriteLine(ex.StackTrace);
                return("SomethingWentWrong");
            }
        }