Exemple #1
0
 public GroupService(INotices notice)
 {
     _notice = notice;
     _accountSettingsManager = new AccountSettingsManager();
     _seleniumManager        = new SeleniumManager();
     _settingsManager        = new SettingsManager();
     _accountManager         = new AccountManager();
 }
 public FacebookMessagesService(INotices noticeProxy)
 {
     _noticeService          = new NoticeService();
     _friendManager          = new FriendManager();
     _accountManager         = new AccountManager();
     _accountSettingsManager = new AccountSettingsManager();
     _seleniumManager        = new SeleniumManager();
     _notice = noticeProxy;
 }
Exemple #3
0
 public FriendsService(INotices noticeProxy)
 {
     _notice                   = noticeProxy;
     _accountManager           = new AccountManager();
     _friendManager            = new FriendManager();
     _accountSettingsManager   = new AccountSettingsManager();
     _accountStatisticsManager = new StatisticsManager();
     _seleniumManager          = new SeleniumManager();
     _analysisFriendsManager   = new AnalysisFriendsManager();
 }
Exemple #4
0
 public SendMessageCore(INotices noticeProxy)
 {
     _friendsBlackListManager = new FriendsBlackListManager();
     _friendManager           = new FriendManager();
     _accountManager          = new AccountManager();
     _facebookMessageManager  = new FacebookMessageManager();
     _messageManager          = new MessageManager();
     _stopWordsManager        = new StopWordsManager();
     _notice = noticeProxy;
 }
        public List <AnalysisFriendData> CheckForAnyInDataBase(AccountViewModel account, List <AnalysisFriendData> friends, INotices notices, string functionName)
        {
            var friendsInDb         = new GetAllFriendByQueryHandler(new DataBaseContext()).Handle(new GetAllFriendByQuery());
            var analisysFriendsInDb = new GetAnalisysFriendsByStatusQueryHandler(new DataBaseContext()).Handle(new GetAnalisysFriendsByStatusQuery
            {
                Status = StatusesFriend.ToAdd
            });

            var refreshFriendList = new List <AnalysisFriendData>();

            notices.AddNotice(functionName, account.Id, string.Format("Друзей для проверки - {0}", friends.Count));

            foreach (var analysisFriendData in friends)
            {
                var includeInFriends        = friendsInDb.Any(data => data.FacebookId == analysisFriendData.FacebookId);
                var includeInAnalyseFriends = analisysFriendsInDb.Any(data => data.FacebookId == analysisFriendData.FacebookId);

                if (!includeInFriends)// && !includeInAnalyseFriends)
                {
                    refreshFriendList.Add(analysisFriendData);
                    continue;
                }
                if (analysisFriendData.Type == FriendTypes.Incoming)
                {
                    notices.AddNotice(functionName, account.Id, string.Format("С ним мы общались. Отменяем заявку- {0}({1})", analysisFriendData.FriendName, analysisFriendData.FacebookId));

                    new CancelFriendshipRequestEngine().Execute(new CancelFriendshipRequestModel
                    {
                        Cookie            = account.Cookie,
                        Proxy             = _accountManager.GetAccountProxy(account),
                        FriendFacebookId  = analysisFriendData.FacebookId,
                        AccountFacebookId = account.FacebookId,
                        UrlParameters     = new GetUrlParametersQueryHandler(new DataBaseContext()).Handle(new GetUrlParametersQuery
                        {
                            NameUrlParameter = NamesUrlParameter.CancelRequestFriendship
                        })
                    });
                }
            }

            return(refreshFriendList);
        }