public static void PostNextTopic(Object sender, DoWorkEventArgs e)
        {
            #region CommentTemplate
            // ************* TEMPLATE FOR ALL OTHER POSTERS AS WELL *************

            // Load Variables:  LastTopic, LastEmail, Proxy, Template, LinkPattern, SenderEmail, iMacrosScripts: AccCreator, Poster, etc.
            // Get last GuteFrage topic 
            // Check if it has a keyword 
            // Get last used email account 
            // Each subsequent process is conditional on the previous one completing correctly         
            // Create a GuteFrage Account (iMacros)
            // Extract confirmation link (HotmailPOP)

            // Confirm Account (iMacros)

            // Some intermediary steps:
            // Get short URL (check if it exists, if not, create it from LongURL1)
            // Replace [URL] in a template
            // Post the answer to GuteFrage (iMacros)

            // *******************************************************************

            // Get last GuteFrage topic id, email id, proxy id, answer_tmpl id 
            #endregion

            #region Set ALL Main Variables

            // INITialize all DB objects
            BackgroundWorker worker = sender as BackgroundWorker; 
            Projects proj = new Projects();
            Emailaccounts tblaccts = new Emailaccounts(); 
            Proxies tblproxies = new Proxies(); 
            Responses tblresp = new Responses(); 
            Affiliateprograms tblaff = new Affiliateprograms();
            int nexttmpl = 0;
            int nextproxy = 0;

            // Project Specific Variables
            Topicspurseblog tbltopics = new Topicspurseblog(); 
            string ProjectName = "PurseBlog";
            int PauseBtwPosts = 30; // 30 minutes

            #endregion

            while (RunningStatus != 1) // while there are keywords
            {
                if ((worker.CancellationPending == true))  // if the STOP button has been clicked
                {
                    e.Cancel = true;
                    break;
                }
                else  // If not STOPed, then continue with the next keyword
                {
                    #region SLEEP IF CURRENT TIME OUT OF DAYTIME POSTING TIME

                    if ((DateTime.Now.TimeOfDay < StartTime.TimeOfDay) || (DateTime.Now.TimeOfDay > EndTime.TimeOfDay)) worker.ReportProgress((2 * 0 * 10), "Night time sleeping until: " + StartTime.ToShortTimeString());

                    while ((DateTime.Now.TimeOfDay < StartTime.TimeOfDay) || (DateTime.Now.TimeOfDay > EndTime.TimeOfDay))
                    {
                        //
                        System.Threading.Thread.Sleep((1000 * 60 * 10));
                    }

                    #endregion
                    worker.ReportProgress((2 * 1 * 10), "Initialized. Selecting the next topic. ");
                    #region SELECT THE PROJECT AND SELECT NEXT TOPIC

                    string kwd = "";
                    int nexttopic = 0;


                    proj.Where.ProjectName.Value = ProjectName;
                    proj.Where.ProjectName.Operator = WhereParameter.Operand.Equal;
                    proj.Query.Load();

                    nexttopic = proj.LastTopicUsed + 1;

                    tbltopics.Where.Id.Value = nexttopic;
                    tbltopics.Where.Id.Operator = WhereParameter.Operand.Equal;
                    tbltopics.Query.Load();
                    kwd = tbltopics.ProductKeyword;
                    

                    worker.ReportProgress((2 * 2 * 10));
                    #endregion
                    if (kwd == "")
                    {
                        #region WAIT FOR KEYWORDS OR SHUT THE PROCESS DOWN
                        worker.ReportProgress((2 * 2 * 10), "No keyword found for the next topic. Waiting for more keywords.");
                        System.Threading.Thread.Sleep((1000 * 60 * 5));

                        if ((worker.CancellationPending == true))
                        {
                            e.Cancel = true;
                            RunningStatus = 1;
                            break;
                        }
                        #endregion
                    }
                    else
                    {
                        worker.ReportProgress((2 * 2 * 10), "Keyword found. Creating a new account...");
                        #region SELECT NEXT EMAIL AND NEXT PROXY

                        int nextemail = proj.LastAccountUsed + 1; // Filter the Email Account
                        tblaccts.Where.Id.Value = nextemail;
                        tblaccts.Where.Id.Operator = WhereParameter.Operand.Equal;
                        tblaccts.Query.Load();
                        try
                        {
                            string CurrentEmail = tblaccts.Email;
                        }
                        catch
                        {
                            MessageBox.Show("There are no more emails");
                        }

                        // Filter the ProxyTable

                        nextproxy = proj.LastProxyUsed + 1;
                        tblproxies.LoadAll();
                        int proxycount = tblproxies.RowCount;
                        if (nextproxy > proxycount)
                        {
                            nextproxy = 1;
                        }

                        tblproxies.Where.Id.Value = nextproxy;
                        tblproxies.Where.Id.Operator = WhereParameter.Operand.Equal;
                        tblproxies.Query.Load();
                        #endregion
                        #region CHECK IF PROXY IS WORKING, SELECT NEXT IF NOT WORKING

                        Httpcalls httpcall = new Httpcalls();

                        while (!httpcall.IsAlive(tblproxies.Proxy))
                        {
                            tblproxies.Active = 0;
                            tblproxies.Save();

                            nextproxy = nextproxy + 1;
                            if (nextproxy > proxycount)
                            {
                                nextproxy = 1;
                            }

                            tblproxies.Where.Id.Value = nextproxy;
                            tblproxies.Where.Id.Operator = WhereParameter.Operand.Equal;
                            tblproxies.Query.Load();
                        }

                        tblproxies.Active = 1;
                        tblproxies.Save();

                        #endregion  CHECK IF PROXY IS WORKING, SELECT NEXT IF NOT WORKING
                        StdPosterFunctionsNonStatic stdfunc = new StdPosterFunctionsNonStatic();
                        if (stdfunc.CreateAccountPurseBlog(tblaccts.Username, tblaccts.Email, tblaccts.Password, tblaccts.FirstName, tblproxies.Proxy, proj.ImacrosCreateAccCode))
                        {
                            #region WAIT SOME TIME
                            worker.ReportProgress((2 * 3 * 10), "Account created. Pausing 1min. before confirming an account...");
                            System.Threading.Thread.Sleep((1000 * 60 * 2));
                            #endregion
                            worker.ReportProgress((2 * 3 * 10), "Now confirming an account...");
                            if ( true /* stdfunc.ConfirmAccount(tblaccts.Email, tblaccts.Password, proj.Linkstructure, proj.Senderemail, tblproxies.Proxy, proj.ShiftLinkstructureBy) */ )
                            {
                                worker.ReportProgress((2 * 4 * 10), "Account confirmed. Shortening URLs and Posting...");
                                #region Produce LongURLs

                                string KwdsNoSpace = kwd.Replace(" ", "%20");
                                try
                                {
                                    KwdsNoSpace = HttpUtility.UrlEncode(kwd);
                                }
                                catch
                                {
                                    worker.ReportProgress((2 * 4 * 10), "HttpUtility failed and threw and exception.");
                                    e.Cancel = true;
                                    break;
                                }
                                if (tbltopics.LongURL1 == "" || tbltopics.LongURL1 == null)
                                {
                                    // PRODUCE FIRST LongURL
                                    tblaff.Where.Id.Value = tbltopics.AffprogramId1;
                                    tblaff.Where.Id.Operator = WhereParameter.Operand.Equal;
                                    tblaff.Query.Load();
                                    if (KwdsNoSpace != "titulinis")
                                    {
                                        tbltopics.LongURL1 = tblaff.PreKeywordLinkPart + KwdsNoSpace + tblaff.PostKeywordLinkPart;
                                    }
                                    else
                                    {
                                        Random rnd1 = new Random();
                                        tbltopics.LongURL1 = tblaff.HomePageLink + "&param=" + rnd1.Next(1, 13000).ToString();
                                    }
                                    tbltopics.Save();
                                }
                                
                                if (tbltopics.LongURL2 == "" || tbltopics.LongURL2 == null)
                                {
                                    // PRODUCE 2nd LongURL
                                    tblaff.Where.WhereClauseReset();
                                    tblaff.Where.Id.Value = tbltopics.AffprogramId2;
                                    tblaff.Where.Id.Operator = WhereParameter.Operand.Equal;
                                    tblaff.Query.Load();

                                    if (KwdsNoSpace != "titulinis")
                                    {
                                        tbltopics.LongURL2 = tblaff.PreKeywordLinkPart + KwdsNoSpace + tblaff.PostKeywordLinkPart;
                                    }
                                    else
                                    {
                                        Random rnd2 = new Random();
                                        tbltopics.LongURL2 = tblaff.HomePageLink + "&param=" + rnd2.Next(1, 13000).ToString();
                                    }
                                    
                                    tbltopics.Save();
                                }

                                #endregion
                                #region Produce ShortURLs
                                TinyURL TinyClass = new TinyURL();
                                for (int i = 1; i <= 4; i++)
                                {
                                    if (tbltopics.ShortURL1 == "#EANF#" || tbltopics.ShortURL1 == "" || tbltopics.ShortURL1 == "NODATA" || tbltopics.ShortURL1 == null) // Let's not do conversion if the ShortURL1 is None.
                                    {
                                        tbltopics.ShortURL1 = TinyClass.ImacrosTinyurlConvert(tbltopics.LongURL1);
                                        tbltopics.Save();
                                    }
                                }
                                
                                #endregion
                                #region Filter out the next answer template AND replace [url]s

                                nexttmpl = proj.LastTemplateUsed + 1; // Filter out the next answer template

                                tblresp.Where.LanguageId.Value = proj.Language;
                                tblresp.Where.LanguageId.Operator = WhereParameter.Operand.Equal;

                                tblresp.Where.ResponseGroup.Value = "AmazonUK-one-link";
                                tblresp.Where.ResponseGroup.Operator = WhereParameter.Operand.Equal;
                                
                                tblresp.Query.Load();
                                
                                if (nexttmpl > tblresp.RowCount)
                                {
                                    nexttmpl = 1;
                                }
                                
                                tblresp.Where.RespGrSpecSequence.Value = nexttmpl;
                                tblresp.Where.RespGrSpecSequence.Operator = WhereParameter.Operand.Equal;
                                tblresp.Query.Load();

                                // Replace [URL] in a template

                                string GeneragedResponse = "";
                                GeneragedResponse = tblresp.Response;
                                GeneragedResponse = GeneragedResponse.Replace("[url]", tbltopics.ShortURL1);
                                // GeneragedResponse = GeneragedResponse.Replace("[url]", "[[" + tbltopics.ShortURL2 + " eBay" + "]]");

                                tbltopics.Response = GeneragedResponse;
                                tbltopics.Save();

                                #endregion
                                #region Post The Answer

                                if (tbltopics.ShortURL1 != "" && tbltopics.ShortURL1 != null && GeneragedResponse != "")
                                {

                                    if (stdfunc.LoginAndPost(tblaccts.Username, tblaccts.Email, tblaccts.Password, tblproxies.Proxy, tbltopics.Link, GeneragedResponse, proj.ImacrosLoginPost))
                                    {
                                        //
                                        worker.ReportProgress((2 * 5 * 10), "Posted successfully. Updating database, and switching to a new topic...");

                                        proj.LastAccountUsed++;
                                        proj.LastProxyUsed = nextproxy;
                                        proj.LastTemplateUsed = nexttmpl;
                                        proj.LastTopicUsed++;
                                        proj.Save();

                                        tbltopics.PostedStatus = 1;
                                        tbltopics.PostingTime = DateTime.Now;
                                        tbltopics.Save();

                                        // MessageBox.Show("Everything completed well. Switching to the next topic.");
                                    }
                                }
                                #endregion
                            }
                        }
                    }
                    #region Reset all Filters

                    tbltopics.Where.WhereClauseReset();
                    proj.Where.WhereClauseReset();
                    tblaccts.Where.WhereClauseReset();
                    tblproxies.Where.WhereClauseReset();
                    tblaff.Where.WhereClauseReset();
                    tblresp.Where.WhereClauseReset();

                    tbltopics.Filter = null;
                    proj.Filter = null;
                    tblaccts.Filter = null;
                    tblproxies.Filter = null;
                    tblaff.Filter = null;
                    tblresp.Filter = null;

                    #endregion
                    #region PAUSE BETWEEN THE posts

                    if ((worker.CancellationPending == true))  // if the STOP button has been clicked
                    {
                        e.Cancel = true;
                        break;
                    }
                    else
                    {
                        worker.ReportProgress((2 * 5 * 10), "Pausing for " + PauseBtwPosts.ToString() + " min.");

                        for (int j = 1; j <= PauseBtwPosts; j++)
                        {
                            int Remaining = (PauseBtwPosts - j + 1);
                            worker.ReportProgress((2 * 5 * 10), Remaining.ToString() + " min. remaining.");
                            System.Threading.Thread.Sleep((1000 * 60 * 1));  // WAIT BETWEEN POSTS
                            if ((worker.CancellationPending == true))  // if the STOP button has been clicked
                            {
                                e.Cancel = true;
                                break;
                            }
                        }
                    }

                    #endregion PAUSE BETWEEN THE posts
                } // end IF Keyword is ""

            } // end While (RunningStatus != 1) script

        } // end PostNextTopic();
Example #2
0
        public static void PostNextTopic(Object sender, DoWorkEventArgs e)
        {
            #region CommentTemplate
            // ************* TEMPLATE FOR ALL OTHER POSTERS AS WELL *************

            // Load Variables:  LastTopic, LastEmail, Proxy, Template, LinkPattern, SenderEmail, iMacrosScripts: AccCreator, Poster, etc.
            // Get last GuteFrage topic
            // Check if it has a keyword
            // Get last used email account
            // Each subsequent process is conditional on the previous one completing correctly
            // Create a GuteFrage Account (iMacros)
            // Extract confirmation link (HotmailPOP)

            // Confirm Account (iMacros)

            // Some intermediary steps:
            // Get short URL (check if it exists, if not, create it from LongURL1)
            // Replace [URL] in a template
            // Post the answer to GuteFrage (iMacros)

            // *******************************************************************

            // Get last GuteFrage topic id, email id, proxy id, answer_tmpl id
            #endregion

            #region Set ALL Main Variables

            // INITialize all DB objects
            BackgroundWorker  worker     = sender as BackgroundWorker;
            Projects          proj       = new Projects();
            Emailaccounts     tblaccts   = new Emailaccounts();
            Proxies           tblproxies = new Proxies();
            Responses         tblresp    = new Responses();
            Affiliateprograms tblaff     = new Affiliateprograms();
            int nexttmpl  = 0;
            int nextproxy = 0;

            // Project Specific Variables
            Topicspurseblog tbltopics     = new Topicspurseblog();
            string          ProjectName   = "PurseBlog";
            int             PauseBtwPosts = 30; // 30 minutes

            #endregion

            while (RunningStatus != 1)                    // while there are keywords
            {
                if ((worker.CancellationPending == true)) // if the STOP button has been clicked
                {
                    e.Cancel = true;
                    break;
                }
                else  // If not STOPed, then continue with the next keyword
                {
                    #region SLEEP IF CURRENT TIME OUT OF DAYTIME POSTING TIME

                    if ((DateTime.Now.TimeOfDay < StartTime.TimeOfDay) || (DateTime.Now.TimeOfDay > EndTime.TimeOfDay))
                    {
                        worker.ReportProgress((2 * 0 * 10), "Night time sleeping until: " + StartTime.ToShortTimeString());
                    }

                    while ((DateTime.Now.TimeOfDay < StartTime.TimeOfDay) || (DateTime.Now.TimeOfDay > EndTime.TimeOfDay))
                    {
                        //
                        System.Threading.Thread.Sleep((1000 * 60 * 10));
                    }

                    #endregion
                    worker.ReportProgress((2 * 1 * 10), "Initialized. Selecting the next topic. ");
                    #region SELECT THE PROJECT AND SELECT NEXT TOPIC

                    string kwd       = "";
                    int    nexttopic = 0;


                    proj.Where.ProjectName.Value    = ProjectName;
                    proj.Where.ProjectName.Operator = WhereParameter.Operand.Equal;
                    proj.Query.Load();

                    nexttopic = proj.LastTopicUsed + 1;

                    tbltopics.Where.Id.Value    = nexttopic;
                    tbltopics.Where.Id.Operator = WhereParameter.Operand.Equal;
                    tbltopics.Query.Load();
                    kwd = tbltopics.ProductKeyword;


                    worker.ReportProgress((2 * 2 * 10));
                    #endregion
                    if (kwd == "")
                    {
                        #region WAIT FOR KEYWORDS OR SHUT THE PROCESS DOWN
                        worker.ReportProgress((2 * 2 * 10), "No keyword found for the next topic. Waiting for more keywords.");
                        System.Threading.Thread.Sleep((1000 * 60 * 5));

                        if ((worker.CancellationPending == true))
                        {
                            e.Cancel      = true;
                            RunningStatus = 1;
                            break;
                        }
                        #endregion
                    }
                    else
                    {
                        worker.ReportProgress((2 * 2 * 10), "Keyword found. Creating a new account...");
                        #region SELECT NEXT EMAIL AND NEXT PROXY

                        int nextemail = proj.LastAccountUsed + 1; // Filter the Email Account
                        tblaccts.Where.Id.Value    = nextemail;
                        tblaccts.Where.Id.Operator = WhereParameter.Operand.Equal;
                        tblaccts.Query.Load();
                        try
                        {
                            string CurrentEmail = tblaccts.Email;
                        }
                        catch
                        {
                            MessageBox.Show("There are no more emails");
                        }

                        // Filter the ProxyTable

                        nextproxy = proj.LastProxyUsed + 1;
                        tblproxies.LoadAll();
                        int proxycount = tblproxies.RowCount;
                        if (nextproxy > proxycount)
                        {
                            nextproxy = 1;
                        }

                        tblproxies.Where.Id.Value    = nextproxy;
                        tblproxies.Where.Id.Operator = WhereParameter.Operand.Equal;
                        tblproxies.Query.Load();
                        #endregion
                        #region CHECK IF PROXY IS WORKING, SELECT NEXT IF NOT WORKING

                        Httpcalls httpcall = new Httpcalls();

                        while (!httpcall.IsAlive(tblproxies.Proxy))
                        {
                            tblproxies.Active = 0;
                            tblproxies.Save();

                            nextproxy = nextproxy + 1;
                            if (nextproxy > proxycount)
                            {
                                nextproxy = 1;
                            }

                            tblproxies.Where.Id.Value    = nextproxy;
                            tblproxies.Where.Id.Operator = WhereParameter.Operand.Equal;
                            tblproxies.Query.Load();
                        }

                        tblproxies.Active = 1;
                        tblproxies.Save();

                        #endregion  CHECK IF PROXY IS WORKING, SELECT NEXT IF NOT WORKING
                        StdPosterFunctionsNonStatic stdfunc = new StdPosterFunctionsNonStatic();
                        if (stdfunc.CreateAccountPurseBlog(tblaccts.Username, tblaccts.Email, tblaccts.Password, tblaccts.FirstName, tblproxies.Proxy, proj.ImacrosCreateAccCode))
                        {
                            #region WAIT SOME TIME
                            worker.ReportProgress((2 * 3 * 10), "Account created. Pausing 1min. before confirming an account...");
                            System.Threading.Thread.Sleep((1000 * 60 * 2));
                            #endregion
                            worker.ReportProgress((2 * 3 * 10), "Now confirming an account...");
                            if (true /* stdfunc.ConfirmAccount(tblaccts.Email, tblaccts.Password, proj.Linkstructure, proj.Senderemail, tblproxies.Proxy, proj.ShiftLinkstructureBy) */)
                            {
                                worker.ReportProgress((2 * 4 * 10), "Account confirmed. Shortening URLs and Posting...");
                                #region Produce LongURLs

                                string KwdsNoSpace = kwd.Replace(" ", "%20");
                                try
                                {
                                    KwdsNoSpace = HttpUtility.UrlEncode(kwd);
                                }
                                catch
                                {
                                    worker.ReportProgress((2 * 4 * 10), "HttpUtility failed and threw and exception.");
                                    e.Cancel = true;
                                    break;
                                }
                                if (tbltopics.LongURL1 == "" || tbltopics.LongURL1 == null)
                                {
                                    // PRODUCE FIRST LongURL
                                    tblaff.Where.Id.Value    = tbltopics.AffprogramId1;
                                    tblaff.Where.Id.Operator = WhereParameter.Operand.Equal;
                                    tblaff.Query.Load();
                                    if (KwdsNoSpace != "titulinis")
                                    {
                                        tbltopics.LongURL1 = tblaff.PreKeywordLinkPart + KwdsNoSpace + tblaff.PostKeywordLinkPart;
                                    }
                                    else
                                    {
                                        Random rnd1 = new Random();
                                        tbltopics.LongURL1 = tblaff.HomePageLink + "&param=" + rnd1.Next(1, 13000).ToString();
                                    }
                                    tbltopics.Save();
                                }

                                if (tbltopics.LongURL2 == "" || tbltopics.LongURL2 == null)
                                {
                                    // PRODUCE 2nd LongURL
                                    tblaff.Where.WhereClauseReset();
                                    tblaff.Where.Id.Value    = tbltopics.AffprogramId2;
                                    tblaff.Where.Id.Operator = WhereParameter.Operand.Equal;
                                    tblaff.Query.Load();

                                    if (KwdsNoSpace != "titulinis")
                                    {
                                        tbltopics.LongURL2 = tblaff.PreKeywordLinkPart + KwdsNoSpace + tblaff.PostKeywordLinkPart;
                                    }
                                    else
                                    {
                                        Random rnd2 = new Random();
                                        tbltopics.LongURL2 = tblaff.HomePageLink + "&param=" + rnd2.Next(1, 13000).ToString();
                                    }

                                    tbltopics.Save();
                                }

                                #endregion
                                #region Produce ShortURLs
                                TinyURL TinyClass = new TinyURL();
                                for (int i = 1; i <= 4; i++)
                                {
                                    if (tbltopics.ShortURL1 == "#EANF#" || tbltopics.ShortURL1 == "" || tbltopics.ShortURL1 == "NODATA" || tbltopics.ShortURL1 == null) // Let's not do conversion if the ShortURL1 is None.
                                    {
                                        tbltopics.ShortURL1 = TinyClass.ImacrosTinyurlConvert(tbltopics.LongURL1);
                                        tbltopics.Save();
                                    }
                                }

                                #endregion
                                #region Filter out the next answer template AND replace [url]s

                                nexttmpl = proj.LastTemplateUsed + 1; // Filter out the next answer template

                                tblresp.Where.LanguageId.Value    = proj.Language;
                                tblresp.Where.LanguageId.Operator = WhereParameter.Operand.Equal;

                                tblresp.Where.ResponseGroup.Value    = "AmazonUK-one-link";
                                tblresp.Where.ResponseGroup.Operator = WhereParameter.Operand.Equal;

                                tblresp.Query.Load();

                                if (nexttmpl > tblresp.RowCount)
                                {
                                    nexttmpl = 1;
                                }

                                tblresp.Where.RespGrSpecSequence.Value    = nexttmpl;
                                tblresp.Where.RespGrSpecSequence.Operator = WhereParameter.Operand.Equal;
                                tblresp.Query.Load();

                                // Replace [URL] in a template

                                string GeneragedResponse = "";
                                GeneragedResponse = tblresp.Response;
                                GeneragedResponse = GeneragedResponse.Replace("[url]", tbltopics.ShortURL1);
                                // GeneragedResponse = GeneragedResponse.Replace("[url]", "[[" + tbltopics.ShortURL2 + " eBay" + "]]");

                                tbltopics.Response = GeneragedResponse;
                                tbltopics.Save();

                                #endregion
                                #region Post The Answer

                                if (tbltopics.ShortURL1 != "" && tbltopics.ShortURL1 != null && GeneragedResponse != "")
                                {
                                    if (stdfunc.LoginAndPost(tblaccts.Username, tblaccts.Email, tblaccts.Password, tblproxies.Proxy, tbltopics.Link, GeneragedResponse, proj.ImacrosLoginPost))
                                    {
                                        //
                                        worker.ReportProgress((2 * 5 * 10), "Posted successfully. Updating database, and switching to a new topic...");

                                        proj.LastAccountUsed++;
                                        proj.LastProxyUsed    = nextproxy;
                                        proj.LastTemplateUsed = nexttmpl;
                                        proj.LastTopicUsed++;
                                        proj.Save();

                                        tbltopics.PostedStatus = 1;
                                        tbltopics.PostingTime  = DateTime.Now;
                                        tbltopics.Save();

                                        // MessageBox.Show("Everything completed well. Switching to the next topic.");
                                    }
                                }
                                #endregion
                            }
                        }
                    }
                    #region Reset all Filters

                    tbltopics.Where.WhereClauseReset();
                    proj.Where.WhereClauseReset();
                    tblaccts.Where.WhereClauseReset();
                    tblproxies.Where.WhereClauseReset();
                    tblaff.Where.WhereClauseReset();
                    tblresp.Where.WhereClauseReset();

                    tbltopics.Filter  = null;
                    proj.Filter       = null;
                    tblaccts.Filter   = null;
                    tblproxies.Filter = null;
                    tblaff.Filter     = null;
                    tblresp.Filter    = null;

                    #endregion
                    #region PAUSE BETWEEN THE posts

                    if ((worker.CancellationPending == true))  // if the STOP button has been clicked
                    {
                        e.Cancel = true;
                        break;
                    }
                    else
                    {
                        worker.ReportProgress((2 * 5 * 10), "Pausing for " + PauseBtwPosts.ToString() + " min.");

                        for (int j = 1; j <= PauseBtwPosts; j++)
                        {
                            int Remaining = (PauseBtwPosts - j + 1);
                            worker.ReportProgress((2 * 5 * 10), Remaining.ToString() + " min. remaining.");
                            System.Threading.Thread.Sleep((1000 * 60 * 1)); // WAIT BETWEEN POSTS
                            if ((worker.CancellationPending == true))       // if the STOP button has been clicked
                            {
                                e.Cancel = true;
                                break;
                            }
                        }
                    }

                    #endregion PAUSE BETWEEN THE posts
                } // end IF Keyword is ""
            }     // end While (RunningStatus != 1) script
        }         // end PostNextTopic();