Exemplo n.º 1
0
        public void PostAddGroupUrl(object parameter)
        {
            try
            {
                try
                {
                    if (IsStop)
                    {
                        return;
                    }

                    if (!IsStop)
                    {
                        lstLinkedinJoinGroupUrlThraed.Add(Thread.CurrentThread);
                        lstLinkedinJoinGroupUrlThraed.Distinct().ToList();
                        Thread.CurrentThread.IsBackground = true;
                    }
                }
                catch { }

                if (!string.IsNullOrEmpty(txtNumberOfGroupsPerAccount.Text) && NumberHelper.ValidateNumber(txtNumberOfGroupsPerAccount.Text))
                {
                    Groups.JoinSearchGroup.CountPerAccount = Convert.ToInt32(txtNumberOfGroupsPerAccount.Text);
                }

                Array paramsArray = new object[1];
                paramsArray = (Array)parameter;
                KeyValuePair<string, LinkedInMaster> item = (KeyValuePair<string, LinkedInMaster>)paramsArray.GetValue(0);
                List<string> lstJoinGroupUrl = (List<string>)paramsArray.GetValue(1);

                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;

                Groups.JoinSearchGroup obj_JoinSearchGroup = new Groups.JoinSearchGroup(Login.accountUser, Login.accountPass, Login.proxyAddress, Login.proxyPort, Login.proxyUserName, Login.proxyPassword);
                Login.logger.addToLogger += new EventHandler(logger_SearchGroupaddToLogger);

                int minDelay = 20;
                int maxDelay = 25;

                if (!string.IsNullOrEmpty(txtSearchGroupMinDelay.Text) && NumberHelper.ValidateNumber(txtSearchGroupMinDelay.Text))
                {
                    minDelay = Convert.ToInt32(txtSearchGroupMinDelay.Text);
                }
                if (!string.IsNullOrEmpty(txtSearchGroupMaxDelay.Text) && NumberHelper.ValidateNumber(txtSearchGroupMaxDelay.Text))
                {
                    maxDelay = Convert.ToInt32(txtSearchGroupMaxDelay.Text);
                }

                //if (lstJoinGroupUrl.Count > 0)
                //{
                //    JoinSearchGroup.JoinSearchGroup.lstLinkedinGroupURL = lstJoinGroupUrl;
                //}
                if (!Login.IsLoggedIn)
                {
                    Login.LoginHttpHelper(ref HttpHelper);
                }

                if (Login.IsLoggedIn)
                {
                    GroupStatus dataScrape = new GroupStatus();
                    Dictionary<string, string> Result = obj_JoinSearchGroup.PostAddOpenGroupsUsingUrl(ref HttpHelper, Login.accountUser, minDelay, maxDelay, lstJoinGroupUrl, IsDevideData);
                    LinkdInContacts.Add(Login.accountUser, Result);
                }

                //AddLoggerJoinGroupUrl("[ " + DateTime.Now + " ] => [ Now Joining Groups Process Running ]");

                //string MessagePosted = obj_JoinSearchGroup.PostAddGroupUsingUrl(ref HttpHelper,LinkdInContacts, Login.accountUser, Login.accountPass, minDelay, maxDelay);

            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> PostAddSearchGroups() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> PostAddSearchGroups() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddSearchGroupErrorLogs);
            }
            finally
            {
                counter_JoinGroupUrlID--;

                if (counter_JoinGroupUrlID == 0)
                {
                    btnJoinSearchGroup.Invoke(new MethodInvoker(delegate
                        {
                            AddLoggerJoinGroupUrl("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                            AddLoggerJoinGroupUrl("----------------------------------------------------------------------------------------------------------");
                            btnJoinSearchGroup.Cursor = Cursors.Default;
                        }));
                }
            }
        }
Exemplo n.º 2
0
        //****************for Search Group**********************//

        #region AddSearchGroup
        public void AddSearchGroup(ref GlobusHttpHelper GlobusHttpHelper, string Email, string Password, string proxyAddress, int ProxyPort, string proxyUsername, string proxyPassword)
        {
            LinkedinLogin Login = new LinkedinLogin();

            try
            {
                if (!string.IsNullOrEmpty(CampainGroupCreate.GroupCount) && NumberHelper.ValidateNumber(CampainGroupCreate.GroupCount))
                {
                    Groups.JoinSearchGroup.BoxGroupCount = Convert.ToInt32(CampainGroupCreate.GroupCount);
                }
                else
                {
                    if (string.IsNullOrEmpty(CampainGroupCreate.GroupCount))
                    {
                    }
                    else
                    {
                        MessageBox.Show("Enter No. of Group in Numeric Form !");
                        return;
                    }
                }

                lstJoinSearchGroupThread.Clear();

                if (CampainGroupCreate.SearchKeyword == string.Empty)
                {
                    AddLoggerLinkedInProfileManager("[ " + DateTime.Now + " ] => [ Please Enter Keyword to Search.. ]");
                    MessageBox.Show("Please Enter Keyword to Search..");
                    txtSearchKeyword.Focus();
                    return;
                }

                AddLoggerLinkedInProfileManager("[ " + DateTime.Now + " ] => [ Starting Search for Groups.. ]");

                Login.accountUser   = Email;
                Login.accountPass   = Password;
                Login.proxyAddress  = proxyAddress;
                Login.proxyPort     = ProxyPort.ToString();
                Login.proxyUserName = proxyUsername;
                Login.proxyPassword = proxyPassword;


                Groups.JoinSearchGroup obj_JoinSearchGroup = new Groups.JoinSearchGroup(Email, Password, proxyAddress, ProxyPort.ToString(), proxyUsername, proxyPassword);

                obj_JoinSearchGroup.logger.addToLogger += new EventHandler(logger_LinkedInProfileManageraddToLogger);

                GlobusHttpHelper HttpHelper = new GlobusHttpHelper();

                if (!Login.IsLoggedIn)
                {
                    Login.LoginHttpHelper(ref HttpHelper);
                    AddLoggerLinkedInProfileManager("[ " + DateTime.Now + " ] => [ Logging In With Email : " + Email + " ]");
                }

                AddLoggerLinkedInProfileManager("[ " + DateTime.Now + " ] => [ Searching Groups Process Running..Please wait.. ]");

                if (Login.IsLoggedIn)
                {
                    GroupStatus dataScrape = new GroupStatus();
                    try
                    {
                        CampainGroupCreate.Result = obj_JoinSearchGroup.PostAddOpenGroups(ref HttpHelper, CampainGroupCreate.SearchKeyword.ToString().Trim(), Email);

                        int count = 5;
                        if (!string.IsNullOrEmpty(CampainGroupCreate.GroupCount) && NumberHelper.ValidateNumber(CampainGroupCreate.GroupCount))
                        {
                            count = Convert.ToInt32(CampainGroupCreate.GroupCount);
                        }

                        CampainGroupCreate.LinkdInContacts.Add(Login.accountUser, CampainGroupCreate.Result);
                    }
                    catch (Exception ex)
                    {
                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> --1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> --1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddSearchGroupErrorLogs);
                    }


                    if (CampainGroupCreate.Result.Count == 0)
                    {
                        AddLoggerLinkedInProfileManager("[ " + DateTime.Now + " ] => [ Sorry, there are no group Search results matching your search criteria.. ]");
                    }
                    else
                    {
                        AddLoggerLinkedInProfileManager("[ " + DateTime.Now + " ] => [ Groups..Searched Successfully..For " + Login.accountUser + " ]");
                    }

                    foreach (var item in CampainGroupCreate.Result)
                    {
                        CampainGroupCreate.lstSearchGroup.Add(item.Key + ":" + item.Value);
                    }


                    AddLoggerLinkedInProfileManager("[ " + DateTime.Now + " ] => [ Now Joining Groups ]");

                    string MessagePosted = obj_JoinSearchGroup.PostSearchGroupAddFinal(ref HttpHelper, Email, Password, CampainGroupCreate.lstSearchGroup, 0, 0);

                    Login.logger.addToLogger -= new EventHandler(logger_LinkedInProfileManageraddToLogger);
                    obj_JoinSearchGroup.logger.addToLogger -= new EventHandler(logger_LinkedInProfileManageraddToLogger);
                }
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> btnAddSearchGroup_Click() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> btnAddSearchGroup_Click() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddSearchGroupErrorLogs);
            }
        }
        //****************for Search Group**********************//

        #region AddSearchGroup
        public void AddSearchGroup(ref GlobusHttpHelper GlobusHttpHelper, string Email, string Password, string proxyAddress, int ProxyPort, string proxyUsername, string proxyPassword)
        {
             LinkedinLogin Login = new LinkedinLogin();

             try
             {
                 if (!string.IsNullOrEmpty(CampainGroupCreate.GroupCount) && NumberHelper.ValidateNumber(CampainGroupCreate.GroupCount))
                 {
                     Groups.JoinSearchGroup.BoxGroupCount = Convert.ToInt32(CampainGroupCreate.GroupCount);

                 }
                 else
                 {
                     if (string.IsNullOrEmpty(CampainGroupCreate.GroupCount))
                     {

                     }
                     else
                     {
                         MessageBox.Show("Enter No. of Group in Numeric Form !");
                         return;
                     }
                 }

                 lstJoinSearchGroupThread.Clear();

                 if (CampainGroupCreate.SearchKeyword == string.Empty)
                 {
                     AddLoggerLinkedInProfileManager("[ " + DateTime.Now + " ] => [ Please Enter Keyword to Search.. ]");
                     MessageBox.Show("Please Enter Keyword to Search..");
                     txtSearchKeyword.Focus();
                     return;
                 }

                 AddLoggerLinkedInProfileManager("[ " + DateTime.Now + " ] => [ Starting Search for Groups.. ]");
 
                 Login.accountUser = Email;
                 Login.accountPass = Password;
                 Login.proxyAddress = proxyAddress;
                 Login.proxyPort = ProxyPort.ToString();
                 Login.proxyUserName = proxyUsername;
                 Login.proxyPassword = proxyPassword;


                 Groups.JoinSearchGroup obj_JoinSearchGroup = new Groups.JoinSearchGroup(Email, Password, proxyAddress, ProxyPort.ToString(), proxyUsername, proxyPassword);

                 obj_JoinSearchGroup.logger.addToLogger += new EventHandler(logger_LinkedInProfileManageraddToLogger);

                 GlobusHttpHelper HttpHelper = new GlobusHttpHelper();

                 if (!Login.IsLoggedIn)
                 {
                     Login.LoginHttpHelper(ref HttpHelper);
                     AddLoggerLinkedInProfileManager("[ " + DateTime.Now + " ] => [ Logging In With Email : " + Email + " ]");
                 }

                 AddLoggerLinkedInProfileManager("[ " + DateTime.Now + " ] => [ Searching Groups Process Running..Please wait.. ]");

                 if (Login.IsLoggedIn)
                 {
                     GroupStatus dataScrape = new GroupStatus();
                     try
                     {
                         CampainGroupCreate.Result = obj_JoinSearchGroup.PostAddOpenGroups(ref HttpHelper, CampainGroupCreate.SearchKeyword.ToString().Trim(), Email);

                         int count = 5;
                         if (!string.IsNullOrEmpty(CampainGroupCreate.GroupCount) && NumberHelper.ValidateNumber(CampainGroupCreate.GroupCount))
                         {
                             count = Convert.ToInt32(CampainGroupCreate.GroupCount);
                         }

                         CampainGroupCreate.LinkdInContacts.Add(Login.accountUser, CampainGroupCreate.Result);
                     }
                     catch (Exception ex)
                     {
                         GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> --1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                         GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> --1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddSearchGroupErrorLogs);
                     }


                     if (CampainGroupCreate.Result.Count == 0)
                     {
                         AddLoggerLinkedInProfileManager("[ " + DateTime.Now + " ] => [ Sorry, there are no group Search results matching your search criteria.. ]");
                     }
                     else
                     {
                         AddLoggerLinkedInProfileManager("[ " + DateTime.Now + " ] => [ Groups..Searched Successfully..For " +  Login.accountUser + " ]");

                    }

                     foreach (var item in CampainGroupCreate.Result)
                     {
                        CampainGroupCreate.lstSearchGroup.Add(item.Key + ":" + item.Value);
                     }


                     AddLoggerLinkedInProfileManager("[ " + DateTime.Now + " ] => [ Now Joining Groups ]");

                     string MessagePosted = obj_JoinSearchGroup.PostSearchGroupAddFinal(ref HttpHelper, Email, Password, CampainGroupCreate.lstSearchGroup,0,0);

                     Login.logger.addToLogger -= new EventHandler(logger_LinkedInProfileManageraddToLogger);
                     obj_JoinSearchGroup.logger.addToLogger -= new EventHandler(logger_LinkedInProfileManageraddToLogger);
                    


                 }
             }
             catch (Exception ex)
             {
                 GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> btnAddSearchGroup_Click() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                 GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> btnAddSearchGroup_Click() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddSearchGroupErrorLogs);
             }
        } 
Exemplo n.º 4
0
        public void StartDMMultiThreadedSearchOpenGroups(object parameter)
        {
            try
            {
                if (IsStop)
                {
                    return;
                }

                if (!IsStop)
                {
                    lstJoinSearchGroupThread.Add(Thread.CurrentThread);
                    lstJoinSearchGroupThread.Distinct().ToList();
                    Thread.CurrentThread.IsBackground = true;
                }
            }
            catch
            {
            }
            Array paramsArray = new object[1];
            int notLoged = 0;
            paramsArray = (Array)parameter;

            KeyValuePair<string, LinkedInMaster> item = (KeyValuePair<string, LinkedInMaster>)paramsArray.GetValue(0);
            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;

            Groups.JoinSearchGroup obj_JoinSearchGroup = new Groups.JoinSearchGroup(Login.accountUser, Login.accountPass, Login.proxyAddress, Login.proxyPort, Login.proxyUserName, Login.proxyPassword);

            Login.logger.addToLogger += new EventHandler(logger_SearchGroupaddToLogger);
            obj_JoinSearchGroup.logger.addToLogger += new EventHandler(logger_SearchGroupaddToLogger);

            GlobusHttpHelper HttpHelper = new GlobusHttpHelper();

            if (!Login.IsLoggedIn)
            {
                Login.LoginHttpHelper(ref HttpHelper);
            }

            AddLoggerSearchGroup("[ " + DateTime.Now + " ] => [ Searching Groups Process Running..Please wait for sometimes.. ]");

            if (Login.IsLoggedIn)
            {
                GroupStatus dataScrape = new GroupStatus();
                try
                {
                    Result = obj_JoinSearchGroup.PostAddOpenGroups(ref HttpHelper, txtSearchKeyword.Text.ToString().Trim(), item.Value._Username);

                    int count = 5;
                    if (!string.IsNullOrEmpty(txtBoxGroupCount.Text) && NumberHelper.ValidateNumber(txtBoxGroupCount.Text))
                    {
                        count = Convert.ToInt32(txtBoxGroupCount.Text);
                    }

                    LinkdInContacts.Add(Login.accountUser, Result);
                }
                catch (Exception ex)
                {
                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> StartDMMultiThreadedSearchOpenGroups() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> StartDMMultiThreadedSearchOpenGroups() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddSearchGroupErrorLogs);
                }

                try
                {
                    if (Result.Count == 0)
                    {
                        AddLoggerSearchGroup("[ " + DateTime.Now + " ] => [ Sorry, there are no group Search results matching your search criteria.. ]");
                    }
                    else
                    {
                        AddLoggerSearchGroup("[ " + DateTime.Now + " ] => [ Groups..Searched Successfully..For " + Login.accountUser + " ]");

                        if (cmbSearchGroup.InvokeRequired)
                        {
                            new Thread(() =>
                            {
                                cmbSearchGroup.Invoke(new MethodInvoker(delegate
                                {
                                    cmbSearchGroup.Items.Add(Login.accountUser);
                                }));
                            }).Start();
                        }
                    }
                }
                catch (Exception ex)
                {
                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> StartDMMultiThreadedSearchOpenGroups() ---2--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> StartDMMultiThreadedSearchOpenGroups() ---2--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddSearchGroupErrorLogs);
                }
                finally
                {
                    obj_JoinSearchGroup.logger.addToLogger -= new EventHandler(logger_SearchGroupaddToLogger);

                    counter_GroupMemberSearch--;
                    int aaa = counter_GroupMemberSearch - notLoged;
                    if (counter_GroupMemberSearch == aaa)
                    {
                        if (cmbSearchGroup.InvokeRequired)
                        {
                            cmbSearchGroup.Invoke(new MethodInvoker(delegate
                            {
                                AddLoggerSearchGroup("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                                AddLoggerSearchGroup("----------------------------------------------------------------------------------------------------------------------------------------");
                                cmbSearchGroup.Enabled = true;
                                btnAddSearchGroup.Cursor = Cursors.Default;

                            }));
                        }
                    }
                }
            }
            else
            {
                AddLoggerSearchGroup("[ " + DateTime.Now + " ] => [ Account : " + Login.accountUser + " Not Logged In ]");
                if (notLoged == 0)
                {
                    notLoged = 1;
                }
                else
                {
                    notLoged = +notLoged;
                }
            }
        }
Exemplo n.º 5
0
        public void PostAddSearchGroups(object parameter)
        {
            try
            {
                try
                {
                    if (IsStop)
                    {
                        return;
                    }

                    if (!IsStop)
                    {
                        lstJoinSearchGroupThread.Add(Thread.CurrentThread);
                        lstJoinSearchGroupThread.Distinct().ToList();
                        Thread.CurrentThread.IsBackground = true;
                    }
                }
                catch
                {
                }

                Array paramsArray = new object[1];
                paramsArray = (Array)parameter;

                KeyValuePair<string, LinkedInMaster> item = (KeyValuePair<string, LinkedInMaster>)paramsArray.GetValue(0);
                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;

                Groups.JoinSearchGroup obj_JoinSearchGroup = new Groups.JoinSearchGroup(Login.accountUser, Login.accountPass, Login.proxyAddress, Login.proxyPort, Login.proxyUserName, Login.proxyPassword);

                Login.logger.addToLogger += new EventHandler(logger_SearchGroupaddToLogger);
                obj_JoinSearchGroup.logger.addToLogger += new EventHandler(logger_SearchGroupaddToLogger);

                if (!Login.IsLoggedIn)
                {
                    Login.LoginHttpHelper(ref HttpHelper);
                    if (Login.IsLoggedIn)
                    {
                        // AddLoggerSearchGroup("Logged In With Account : " + Login.accountUser);
                    }
                }

                AddLoggerSearchGroup("[ " + DateTime.Now + " ] => [ Finding Selected Group Ids ]");
                List<string> SelectedItem = new List<string>();

                foreach (KeyValuePair<string, Dictionary<string, string>> UserValue in LinkdInContacts)
                {
                    string SelectedValue = UserSlecetedDetails;
                    if (UserValue.Key.Contains(SelectedValue))
                    {
                        foreach (KeyValuePair<string, string> GroupValue in UserValue.Value)
                        {
                            foreach (string Userid in chkListSearchGroup.CheckedItems)
                            {
                                if (GroupValue.Key.Contains(Userid))
                                {
                                    SelectedItem.Add(GroupValue.Key + ":" + GroupValue.Value);
                                    break;
                                }
                            }
                        }
                    }
                }

                AddLoggerSearchGroup("[ " + DateTime.Now + " ] => [ Now Group Joining Process Start  ]");

                int minDelay = 20;
                int maxDelay = 25;

                if (!string.IsNullOrEmpty(txtSearchGroupMinDelay.Text) && NumberHelper.ValidateNumber(txtSearchGroupMinDelay.Text))
                {
                    minDelay = Convert.ToInt32(txtSearchGroupMinDelay.Text);
                }
                if (!string.IsNullOrEmpty(txtSearchGroupMaxDelay.Text) && NumberHelper.ValidateNumber(txtSearchGroupMaxDelay.Text))
                {
                    maxDelay = Convert.ToInt32(txtSearchGroupMaxDelay.Text);
                }

                string MessagePosted = obj_JoinSearchGroup.PostSearchGroupAddFinal(ref HttpHelper, Login.accountUser, Login.accountPass, SelectedItem, minDelay, maxDelay);

                Login.logger.addToLogger -= new EventHandler(logger_SearchGroupaddToLogger);
                obj_JoinSearchGroup.logger.addToLogger -= new EventHandler(logger_SearchGroupaddToLogger);
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> PostAddSearchGroups() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> PostAddSearchGroups() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddSearchGroupErrorLogs);
            }
            finally
            {
                btnJoinSearchGroup.Invoke(new MethodInvoker(delegate
                {
                    btnJoinSearchGroup.Cursor = Cursors.Default;
                }));
            }
        }
Exemplo n.º 6
0
        public void PostAddGroupUrl(object parameter)
        {
            try
            {
                try
                {
                    if (IsStop)
                    {
                        return;
                    }

                    if (!IsStop)
                    {
                        lstLinkedinJoinGroupUrlThraed.Add(Thread.CurrentThread);
                        lstLinkedinJoinGroupUrlThraed.Distinct().ToList();
                        Thread.CurrentThread.IsBackground = true;
                    }
                }
                catch { }

                if (!string.IsNullOrEmpty(txtNumberOfGroupsPerAccount.Text) && NumberHelper.ValidateNumber(txtNumberOfGroupsPerAccount.Text))
                {
                    Groups.JoinSearchGroup.CountPerAccount = Convert.ToInt32(txtNumberOfGroupsPerAccount.Text);
                }

                Array paramsArray = new object[1];
                paramsArray = (Array)parameter;
                KeyValuePair <string, LinkedInMaster> item = (KeyValuePair <string, LinkedInMaster>)paramsArray.GetValue(0);
                List <string> lstJoinGroupUrl = (List <string>)paramsArray.GetValue(1);

                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;

                Groups.JoinSearchGroup obj_JoinSearchGroup = new Groups.JoinSearchGroup(Login.accountUser, Login.accountPass, Login.proxyAddress, Login.proxyPort, Login.proxyUserName, Login.proxyPassword);
                Login.logger.addToLogger += new EventHandler(logger_SearchGroupaddToLogger);


                int minDelay = 20;
                int maxDelay = 25;

                if (!string.IsNullOrEmpty(txtSearchGroupMinDelay.Text) && NumberHelper.ValidateNumber(txtSearchGroupMinDelay.Text))
                {
                    minDelay = Convert.ToInt32(txtSearchGroupMinDelay.Text);
                }
                if (!string.IsNullOrEmpty(txtSearchGroupMaxDelay.Text) && NumberHelper.ValidateNumber(txtSearchGroupMaxDelay.Text))
                {
                    maxDelay = Convert.ToInt32(txtSearchGroupMaxDelay.Text);
                }

                //if (lstJoinGroupUrl.Count > 0)
                //{
                //    JoinSearchGroup.JoinSearchGroup.lstLinkedinGroupURL = lstJoinGroupUrl;
                //}
                if (!Login.IsLoggedIn)
                {
                    Login.LoginHttpHelper(ref HttpHelper);
                }

                if (Login.IsLoggedIn)
                {
                    GroupStatus dataScrape             = new GroupStatus();
                    Dictionary <string, string> Result = obj_JoinSearchGroup.PostAddOpenGroupsUsingUrl(ref HttpHelper, Login.accountUser, minDelay, maxDelay, lstJoinGroupUrl, IsDevideData);
                    LinkdInContacts.Add(Login.accountUser, Result);
                }

                //AddLoggerJoinGroupUrl("[ " + DateTime.Now + " ] => [ Now Joining Groups Process Running ]");


                //string MessagePosted = obj_JoinSearchGroup.PostAddGroupUsingUrl(ref HttpHelper,LinkdInContacts, Login.accountUser, Login.accountPass, minDelay, maxDelay);
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> PostAddSearchGroups() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> PostAddSearchGroups() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddSearchGroupErrorLogs);
            }
            finally
            {
                counter_JoinGroupUrlID--;

                if (counter_JoinGroupUrlID == 0)
                {
                    btnJoinSearchGroup.Invoke(new MethodInvoker(delegate
                    {
                        AddLoggerJoinGroupUrl("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                        AddLoggerJoinGroupUrl("----------------------------------------------------------------------------------------------------------");
                        btnJoinSearchGroup.Cursor = Cursors.Default;
                    }));
                }
            }
        }