Exemplo n.º 1
0
        private void LoginUsingInputData(object Parameter)
        {
            try
            {
                if (!IsStopScrapper)
                {
                    lstScrapperStopThread.Add(Thread.CurrentThread);
                    lstScrapperStopThread.Distinct();
                    Thread.CurrentThread.IsBackground = true;
                }

                string account     = string.Empty;
                string post        = string.Empty;
                Array  paramsArray = new object[1];

                paramsArray = (Array)Parameter;

                KeyValuePair <string, LinkedInMaster> item = (KeyValuePair <string, LinkedInMaster>)paramsArray.GetValue(0);
                account = item.Key;
                try
                {
                    account = account.Split(':')[0];
                }
                catch { }

                GlobusHttpHelper HttpHelper = new GlobusHttpHelper();
                LinkedinLogin    Login      = new LinkedinLogin();

                Login.accountUser   = account;
                Login.accountPass   = item.Value._Password;
                Login.proxyAddress  = item.Value._ProxyAddress;
                Login.proxyPort     = item.Value._ProxyPort;
                Login.proxyUserName = item.Value._ProxyUsername;
                Login.proxyPassword = item.Value._ProxyPassword;
                Login.Postalcode    = item.Value._Postalcode;
                Login.Distance      = item.Value._Distance;
                Login.IndustryType  = item.Value._IndustryType;
                Login.LastName      = item.Value._LastName;
                // StatusUpdate.StatusUpdate obj_StatusUpdate = new StatusUpdate.StatusUpdate(Login.accountUser, Login.accountPass, Login.proxyAddress, Login.proxyPort, Login.proxyUserName, Login.proxyPassword);
                InBoardPro.LinkinScrappRecord obj_Scrapper = new InBoardPro.LinkinScrappRecord(Login.accountUser, Login.accountPass, Login.proxyAddress, Login.proxyPort, Login.proxyUserName, Login.proxyPassword, Login.Postalcode, Login.Distance, Login.IndustryType, Login.LastName);
                //Login.logger.addToLogger += new EventHandler(logger_StatusUpdateaddToLogger);
                //obj_StatusUpdate.logger.addToLogger += new EventHandler(logger_StatusUpdateaddToLogger);
                obj_Scrapper.InBoardProGetDataResultLogEvents.addToLogger += ScrapperRecordsLogEvents_addToLogger;
                Login.logger.addToLogger += new EventHandler(ScrapperRecordsLogEvents_addToLogger);

                if (!Login.IsLoggedIn)
                {
                    // AddLoggerScrapData("Logging With : " + Login.accountUser);
                    Login.LoginHttpHelper(ref HttpHelper);
                }
                try
                {
                    if (Login.IsLoggedIn)
                    {
                        // AddLoggerScrapData("LoggedIn With : " + Login.accountUser);
                        obj_Scrapper.lastName     = Login.LastName;
                        obj_Scrapper.industryType = Login.IndustryType;
                        obj_Scrapper.postalCode   = Login.Postalcode;
                        obj_Scrapper.GetRecords1(ref HttpHelper);
                    }
                }

                catch { }

                obj_Scrapper.InBoardProGetDataResultLogEvents.addToLogger -= ScrapperRecordsLogEvents_addToLogger;
                Login.logger.addToLogger -= new EventHandler(ScrapperRecordsLogEvents_addToLogger);
            }
            catch { }
            finally
            {
                AddLoggerScrapData("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                AddLoggerScrapData("----------------------------------------------------------------------------------------------------------------------------");
            }
        }
        private void LoginUsingInputData(object Parameter)
        {
            try
            {

                if (!IsStopScrapper)
                {
                    lstScrapperStopThread.Add(Thread.CurrentThread);
                    lstScrapperStopThread.Distinct();
                    Thread.CurrentThread.IsBackground = true;
                }

                string account = string.Empty;
                string post = string.Empty;
                Array paramsArray = new object[1];

                paramsArray = (Array)Parameter;

                KeyValuePair<string, LinkedInMaster> item = (KeyValuePair<string, LinkedInMaster>)paramsArray.GetValue(0);
                account = item.Key;
                GlobusHttpHelper HttpHelper = new GlobusHttpHelper();
                LinkedinLogin Login = new LinkedinLogin();

                Login.accountUser = item.Key;
                Login.accountPass = item.Value._Password;
                Login.proxyAddress = item.Value._ProxyAddress;
                Login.proxyPort = item.Value._ProxyPort;
                Login.proxyUserName = item.Value._ProxyUsername;
                Login.proxyPassword = item.Value._ProxyPassword;
                Login.Postalcode = item.Value._Postalcode;
                Login.Distance = item.Value._Distance;
                Login.IndustryType = item.Value._IndustryType;
                Login.LastName = item.Value._LastName;
                // StatusUpdate.StatusUpdate obj_StatusUpdate = new StatusUpdate.StatusUpdate(Login.accountUser, Login.accountPass, Login.proxyAddress, Login.proxyPort, Login.proxyUserName, Login.proxyPassword);
                InBoardPro.LinkinScrappRecord obj_Scrapper = new InBoardPro.LinkinScrappRecord(Login.accountUser, Login.accountPass, Login.proxyAddress, Login.proxyPort, Login.proxyUserName, Login.proxyPassword, Login.Postalcode, Login.Distance, Login.IndustryType, Login.LastName);
                //Login.logger.addToLogger += new EventHandler(logger_StatusUpdateaddToLogger);
                //obj_StatusUpdate.logger.addToLogger += new EventHandler(logger_StatusUpdateaddToLogger);
                obj_Scrapper.InBoardProGetDataResultLogEvents.addToLogger += ScrapperRecordsLogEvents_addToLogger;
                Login.logger.addToLogger += new EventHandler(ScrapperRecordsLogEvents_addToLogger);

                if (!Login.IsLoggedIn)
                {
                    // AddLoggerScrapData("Logging With : " + Login.accountUser);
                    Login.LoginHttpHelper(ref HttpHelper);
                }
                try
                {
                    if (Login.IsLoggedIn)
                    {
                        // AddLoggerScrapData("LoggedIn With : " + Login.accountUser);
                        obj_Scrapper.lastName = Login.LastName;
                        obj_Scrapper.industryType = Login.IndustryType;
                        obj_Scrapper.postalCode = Login.Postalcode;
                        obj_Scrapper.GetRecords(ref HttpHelper);
                    }
                }

                catch { }

                obj_Scrapper.InBoardProGetDataResultLogEvents.addToLogger -= ScrapperRecordsLogEvents_addToLogger;
                Login.logger.addToLogger -= new EventHandler(ScrapperRecordsLogEvents_addToLogger);
            }
            catch { }
            finally
            {
                AddLoggerScrapData("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                AddLoggerScrapData("----------------------------------------------------------------------------------------------------------------------------");
            }
        }