public void startFollowusingthreadPool_AfterStop(object parameters)
        {

            //Add List Of Working thread
            //we are using this list when we stop/abort running camp processes..
            try
            {
                Array paramsArray = new object[2];
                paramsArray = (Array)parameters;
                string CampaignName = (string)paramsArray.GetValue(0);
                string featurName = (string)paramsArray.GetValue(1);
                try
                {
                    MixedCampaignManager.classes.cls_variables.Lst_WokingThreads.Add(CampaignName, Thread.CurrentThread);
                }
                catch (Exception ex)
                {
                    ErrorLogger.AddToErrorLogText("28.startFollowusingthreadPool_AfterStop :" + ex.Message);
                }


                //Get Detals from Data Set table by Campaign Name
                DataRow[] drModelDetails;
                lock (this)
                {
                    drModelDetails = CompaignsDataSet.Tables[0].Select("CampaignName = '" + CampaignName + "'");

                }

                if (drModelDetails.Count() == 0)
                {
                    return;
                }

                //Get 1st row from arrey 
                DataRow DrCampaignDetails = drModelDetails[0];
                bool IsSchedulDaily = (Convert.ToInt32(DrCampaignDetails.ItemArray[12]) == 1) ? true : false;
                DateTime SchedulerStartTime = Convert.ToDateTime(DrCampaignDetails.ItemArray[13].ToString());
                DateTime SchedulerEndTime = Convert.ToDateTime(DrCampaignDetails.ItemArray[14].ToString());

                //Create Object of tweetProcess class 

                classes.Cls_FollowStart ObjFollowProcess = new Cls_FollowStart();

                ObjFollowProcess.CampaignFollowLogEvents.addToLogger += new EventHandler(logEvents_addToLogger);

                if (IsSchedulDaily)
                {
                    if (_tempcount == 0)
                    {
                        //MessageBox.Show(CampaignName + " task is scheduled. Task start timing  :- " + SchedulerStartTime);
                    }
                    _tempcount++;
                    AddToCampaignLoggerListBox("[ " + DateTime.Now + " ] => [ " + CampaignName + " task is scheduled. Task start timing :- " + SchedulerStartTime + " ]");

                    foreach (DataGridViewRow dRow in dgv_campaign.Rows)
                    {
                        string dgv_CampaignName = dRow.Cells["CampaignName"].Value.ToString();
                        //string dgv_Module = dRow.Cells["Module"].Value.ToString();

                        if (CampaignName == dgv_CampaignName)
                        {
                            //dRow.Cells["CampaignName"].Value = "HardCoded";
                            //if (classes.cls_variables._IsScheduledDaily == 1)
                            {
                                dgv_campaign.Invoke(new MethodInvoker(delegate
                                {
                                    dRow.Cells["BtnOnOff"].Value = (System.Drawing.Image)Properties.Resources.on;
                                }));
                            }


                            //dgv_campaign.Refresh();
                        }
                    }

                    while (true)
                    {
                        //Update dataset
                        lock (this)
                        {
                            //modified date [11-02-15]
                            try
                            {
                                string query = "Select indx, CampaignName, AcFilePath, FollowingFilePath, '0' as Image,DividEql, DivideByUser, NoOfUser, FastFollow, NoOfFollowPerAc, '0' as TweetPac, '0' as TweetWImg, ScheduledDaily, StartTime, EndTime, DelayFrom, DelayTo, Threads, Module,'0' as IsUniqueMessage,'0' as TweetUploadUserFilePath,'0' as IsUploadUserFilePath,'0' as IsDuplicate, '0' as IsMentionUserScrapedList,'0' as TweetMentionUserNameScrapedList,'0' as IsTweetFollowerScrapedList,'0' as IsTweetFollowingScrapedList,'0' as NoOfTweetMentionUserScrapedList,'0' as NoOfTweetScrapedUserScrapedLIst from Campaign_follow "
                         + " UNION ALL "
                         + "Select indx, CampaignName, AcFilePath, TweetMsgFilePath,TweetImageFolderPath as Image,DuplicateMsg, AllTweetParAc as DivideByUser, HashTag as NoOfUser, TweetParDay, NoOfTweetParDay, NoOfTweetPerAc as TweetPac,TweetWithImage as TweetWImg, ScheduledDaily, StartTime, EndTime, DelayFrom, DelayTo, Threads, Module,'' as IsUniqueMessage, TweetUploadUserFilePath, IsUploadUserFilePath, '0' as IsDuplicate,IsTweetMentionUserScrapedList,TweetMentionUserNameScrapedList,IsTweetFollowersScrapedList,IsTweetFollowingScrapedList,NoOfTweetMentionUserScrapedList,NoOfScrapedUserScrapedList from Campaign_tweet "
                         + " UNION ALL "
                         + " SELECT  indx, CampaignName, AcFilePath, Keyword, '0' as Image,IsUsername,'0' as DivideByUser,'0' as NoOfUser, RetweetParDay, NoofRetweetParDay, NoofRetweetParAc as TweetPac, '0' as TweetWImg, ScheduledDaily, StartTime, EndTime, DelayFrom, DelayTo, Threads, Module,UniqueMessage as IsUniqueMessage,'0' as TweetUploadUserFilePath,'0' as IsUploadUserFilePath, '0' as IsDuplicate ,'0' as IsMentionUserScrapedList,'0' as TweetMentionUserNameScrapedList,'0' as IsTweetFollowerScrapedList,'0' as IsTweetFollowingScrapedList,'0' as NoOfTweetMentionUserScrapedList,'0' as NoOfTweetScrapedUserScrapedLIst from Campaign_retweet "
                         + " UNION ALL "
                         + " SELECT  indx, CampaignName, AcFilePath, ReplyFilePath, Keyword as Image,  IsUsername,'0' as DivideByUser,'0' as NoOfUser, ReplyParDay, NoofReplyParDay, NoofReplyParAc as TweetPac, '0' as TweetWImg, ScheduledDaily, StartTime, EndTime, DelayFrom, DelayTo, Threads, Module,UniqueMessage as IsUniqueMessage,'0' as TweetUploadUserFilePath,'0' as IsUploadUserFilePath, IsDuplicateMessage, '0' as IsMentionUserScrapedList,'0' as TweetMentionUserNameScrapedList,'0' as IsTweetFollowerScrapedList,'0' as IsTweetFollowingScrapedList,'0' as NoOfTweetMentionUserScrapedList,'0' as NoOfTweetScrapedUserScrapedLIst from Campaign_reply ";

                                CompaignsDataSet = RepositoryClasses.cls_DbRepository.selectQuery(query, "Union");
                            }
                            catch (Exception ex)
                            {
                                ErrorLogger.AddToErrorLogText("28.startFollowusingthreadPool_AfterStop :" + ex.Message);
                            }

                            drModelDetails = CompaignsDataSet.Tables[0].Select("CampaignName = '" + CampaignName + "'");
                            if (drModelDetails.Count() == 0)
                            {
                                return;
                            }
                        }


                        try
                        {
                            DrCampaignDetails = drModelDetails[0];
                            IsSchedulDaily = (Convert.ToInt32(DrCampaignDetails.ItemArray[12]) == 1) ? true : false;
                            SchedulerStartTime = Convert.ToDateTime(DrCampaignDetails.ItemArray[13].ToString());
                            SchedulerEndTime = Convert.ToDateTime(DrCampaignDetails.ItemArray[14].ToString());


                            int startTime = SchedulerStartTime.Hour * 60 + SchedulerStartTime.Minute;
                            int sysTime = DateTime.Now.Hour * 60 + DateTime.Now.Minute;
                            int endTime = SchedulerEndTime.Hour * 60 + SchedulerEndTime.Minute;

                            if ((SchedulerStartTime.Hour) == (DateTime.Now.Hour) && SchedulerStartTime.Minute == (DateTime.Now.Minute))
                            //if (startTime <= sysTime && endTime >= sysTime && (Cls_FollowStart._IsFollowProcessStart == true))
                            {


                                foreach (DataGridViewRow dRow in dgv_campaign.Rows)
                                {
                                    string dgv_CampaignName = dRow.Cells["CampaignName"].Value.ToString();
                                    //string dgv_Module = dRow.Cells["Module"].Value.ToString();

                                    if (CampaignName == dgv_CampaignName)
                                    {
                                        //dRow.Cells["CampaignName"].Value = "HardCoded";
                                        //if (classes.cls_variables._IsScheduledDaily == 1)
                                        {
                                            dgv_campaign.Invoke(new MethodInvoker(delegate
                                            {
                                                dRow.Cells["BtnOnOff"].Value = (System.Drawing.Image)Properties.Resources.off;
                                            }));
                                        }


                                        //dgv_campaign.Refresh();
                                    }
                                }



                                //Cls_FollowStart._IsFollowProcessStart = false;  temprory commented.
                                Cls_FollowStart.campName = CampaignName;
                                ObjFollowProcess.StartProcess(CampaignName, featurName, DrCampaignDetails);
                                break;

                            }
                        }
                        catch (Exception ex)
                        {
                            ErrorLogger.AddToErrorLogText("128.startprocessfollow :" + ex.Message);
                        }
                        Thread.Sleep(15 * 1000);
                    }


                }
                else
                {

                    //Start Process
                    ObjFollowProcess.StartProcess(CampaignName, featurName, DrCampaignDetails);
                }
            }
            catch (Exception ex)
            {
                ErrorLogger.AddToErrorLogText("29.startFollowusingthreadPool_AfterStop :" + ex.Message);
            }
        }
        public void StartFollowCampaign(String CampaignName, String featurName)
        {
            //Add List Of Working thread
            //we are using this list when we stop/abort running camp processes..
            try
            {
                try
                {
                    MixedCampaignManager.classes.cls_variables.Lst_WokingThreads.Add(CampaignName, Thread.CurrentThread);
                }
                catch (Exception ex)
                {
                    ErrorLogger.AddToErrorLogText("18.StartFollowCampaign :" + ex.Message);
                }

                //Get Detals from Data Set table by Campaign Name
                DataRow[] drModelDetails = CompaignsDataSet.Tables[0].Select("CampaignName = '" + CampaignName + "'");

                if (drModelDetails.Count() == 0)
                {
                    return;
                }

                //Get 1st row from arrey 
                DataRow DrCampaignDetails = drModelDetails[0];
                bool IsSchedulDaily = (Convert.ToInt32(DrCampaignDetails.ItemArray[12]) == 1) ? true : false;
                DateTime SchedulerStartTime = Convert.ToDateTime(DrCampaignDetails.ItemArray[13].ToString());
                DateTime SchedulerEndTime = Convert.ToDateTime(DrCampaignDetails.ItemArray[14].ToString());

                int startTime = SchedulerStartTime.Hour * 60 + SchedulerStartTime.Minute;
                int sysTime = DateTime.Now.Hour * 60 + DateTime.Now.Minute;
                int endTime = SchedulerEndTime.Hour * 60 + SchedulerEndTime.Minute;
                //Create Object of tweetProcess class 

                classes.Cls_FollowStart ObjFollowProcess = new Cls_FollowStart();

                ObjFollowProcess.CampaignFollowLogEvents.addToLogger += new EventHandler(logEvents_addToLogger);

                if (IsSchedulDaily)
                {
                    if (_tempcount == 0)
                    {
                        //MessageBox.Show(CampaignName + " task is scheduled. Task start timing  :- " + SchedulerStartTime);
                    }
                    _tempcount++;
                    AddToCampaignLoggerListBox("[ " + DateTime.Now + " ] => [  " + CampaignName + " task is scheduled. Task start timing :- " + SchedulerStartTime + " ]");
                    while (true)
                    {
                        if (SchedulerStartTime.Hour == (DateTime.Now.Hour) && SchedulerStartTime.Minute == (DateTime.Now.Minute) && (Cls_FollowStart._IsFollowProcessStart == true))
                        //if (startTime <= sysTime && endTime >= sysTime && (Cls_FollowStart._IsFollowProcessStart == true))
                        {
                            //Cls_FollowStart._IsFollowProcessStart = false;   //temprory commented.
                            Cls_FollowStart.campName = CampaignName;
                            ObjFollowProcess.StartProcess(CampaignName, featurName, DrCampaignDetails);
                            break;
                        }
                        Thread.Sleep(15 * 1000);
                    }
                    
                }
                else
                {
                    ObjFollowProcess.StartProcess(CampaignName, featurName, DrCampaignDetails);
                }
            }
            catch (Exception ex)
            {
                ErrorLogger.AddToErrorLogText("19.StartFollowCampaign :" + ex.Message);
            }

        }