Пример #1
0
 public static SchedulerManager GetInstance()
 {
     return(_schedulerManager = _schedulerManager ?? new SchedulerManager());
 }
Пример #2
0
        private void grvScheduler_SchedulerProcess_SchedulerProcessDetails_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (grvScheduler_SchedulerProcess_SchedulerProcessDetails.Rows[e.RowIndex].Cells[e.ColumnIndex].Value == "ON")
                {
                    string schName = string.Empty;
                    string schProcess = string.Empty;
                    string schAccount = string.Empty;
                    string schStartDate = string.Empty;
                    string schEndDate = string.Empty;
                    string schStartTime = string.Empty;
                    string schEndTime = string.Empty;
                    string schMinDelay = string.Empty;
                    string schMaxDelay = string.Empty;


                    schName = grvScheduler_SchedulerProcess_SchedulerProcessDetails.Rows[e.RowIndex].Cells["Scheduler Name"].Value.ToString();
                    schAccount = grvScheduler_SchedulerProcess_SchedulerProcessDetails.Rows[e.RowIndex].Cells["Account"].Value.ToString();
                    schProcess = grvScheduler_SchedulerProcess_SchedulerProcessDetails.Rows[e.RowIndex].Cells["Select Scheduler Process"].Value.ToString();
                    schStartDate = grvScheduler_SchedulerProcess_SchedulerProcessDetails.Rows[e.RowIndex].Cells["Start Date"].Value.ToString();
                    schEndDate = grvScheduler_SchedulerProcess_SchedulerProcessDetails.Rows[e.RowIndex].Cells["End Date"].Value.ToString();
                    schStartTime = grvScheduler_SchedulerProcess_SchedulerProcessDetails.Rows[e.RowIndex].Cells["Start Time"].Value.ToString();
                    schEndTime = grvScheduler_SchedulerProcess_SchedulerProcessDetails.Rows[e.RowIndex].Cells["End Time"].Value.ToString();
                    schMinDelay = grvScheduler_SchedulerProcess_SchedulerProcessDetails.Rows[e.RowIndex].Cells["Min Delay"].Value.ToString();
                    schMaxDelay = grvScheduler_SchedulerProcess_SchedulerProcessDetails.Rows[e.RowIndex].Cells["Max Delay"].Value.ToString();


                    if (schProcess == "Like Page" || schProcess == "Share Page" || schProcess == "Like Post" || schProcess == "Comment On Post")
                    {
                        List<string> lstFanPageURLs = new List<string>();
                        List<string> lstFanPageMessages = new List<string>();
                        List<string> lstFanPageComments = new List<string>();

                        SchFanPageLiker objSchFanPageLiker = new SchFanPageLiker();
                        SchFanPageLikerRepository objSchFanPageLikerRepository = new SchFanPageLikerRepository();

                        objSchFanPageLiker.SchedulerName = schName;

                        List<SchFanPageLiker> lstSchFanPageLiker = objSchFanPageLikerRepository.GetSchFanPageLikerDataUsingSchName(objSchFanPageLiker);

                        foreach (SchFanPageLiker item in lstSchFanPageLiker)
                        {
                            try
                            {
                                if (File.Exists(item.FanPageURLsFile))
                                {
                                    lstFanPageURLs = GlobusFileHelper.ReadFile(item.FanPageURLsFile);
                                }
                                else
                                {
                                    GlobusLogHelper.log.Info("File Not Exists : " + item.FanPageURLsFile + " With Scheduler Name : " + schName);
                                    GlobusLogHelper.log.Debug("File Not Exists : " + item.FanPageURLsFile + " With Scheduler Name : " + schName);
                                }

                                if (File.Exists(item.FanPageMessageFile))
                                {
                                    lstFanPageMessages = GlobusFileHelper.ReadFile(item.FanPageMessageFile);
                                }
                                else
                                {
                                    GlobusLogHelper.log.Info("File Not Exists : " + item.FanPageMessageFile + " With Scheduler Name : " + schName);
                                    GlobusLogHelper.log.Debug("File Not Exists : " + item.FanPageMessageFile + " With Scheduler Name : " + schName);
                                }
                                if (File.Exists(item.FanPageCommentsFile))
                                {
                                    lstFanPageComments = GlobusFileHelper.ReadFile(item.FanPageCommentsFile);
                                }
                                else
                                {
                                    GlobusLogHelper.log.Info("File Not Exists : " + item.FanPageCommentsFile + " With Scheduler Name : " + schName);
                                    GlobusLogHelper.log.Debug("File Not Exists : " + item.FanPageCommentsFile + " With Scheduler Name : " + schName);
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                            }
                        }

                        if (string.IsNullOrEmpty(schName) && string.IsNullOrEmpty(schProcess) && string.IsNullOrEmpty(schAccount) && string.IsNullOrEmpty(schStartDate) && string.IsNullOrEmpty(schEndDate) && string.IsNullOrEmpty(schStartTime) && string.IsNullOrEmpty(schEndTime) && lstFanPageURLs.Count < 1 && lstFanPageMessages.Count < 1 && lstFanPageComments.Count < 1)
                        {
                            GlobusLogHelper.log.Info("There is No Record in Scheduler Name Or Scheduler Process Or Scheduler Account Or Start Date Or End Date Or Start Time Or End Time Or Fan Page URLs Or Fan Page Messages Or Fan Page Comments !");
                            GlobusLogHelper.log.Debug("There is No Record in Scheduler Name Or Scheduler Process Or Scheduler Account Or Start Date Or End Date Or Start Time Or End Time Or Fan Page URLs Or Fan Page Messages Or Fan Page Comments !");

                            MessageBox.Show("There is No Record in Scheduler Name Or Scheduler Process Or Scheduler Account Or Start Date Or End Date Or Start Time Or End Time Or Fan Page URLs Or Fan Page Messages Or Fan Page Comments !");
                            return;

                        }

                        if (string.IsNullOrEmpty(schMinDelay))
                        {
                            schMinDelay = Convert.ToString(5);
                        }

                        if (string.IsNullOrEmpty(schMaxDelay))
                        {
                            schMaxDelay = Convert.ToString(5);
                        }

                        SchedulerManager objSchedulerManager = new SchedulerManager();



                        Thread startSchFanpageLikerThread = new Thread(objSchedulerManager.StartSchFanpageLiker);

                        //Add Current Thread In  dicCmpRowIndexThread For Stop Particular Thraed
                        Thread.CurrentThread.IsBackground = true;

                        dicSchRowIndexThread.Add(e.RowIndex, startSchFanpageLikerThread);

                        startSchFanpageLikerThread.Start(new object[] { schName, schProcess, schAccount, schStartDate, schEndDate, schStartTime, schEndTime, schMinDelay, schMaxDelay, lstFanPageURLs, lstFanPageMessages, lstFanPageComments });

                    }

                }
                if (grvScheduler_SchedulerProcess_SchedulerProcessDetails.Rows[e.RowIndex].Cells[e.ColumnIndex].Value == "OFF")
                {
                    Thread stopThread = new Thread(SchStopRowIndexThread);
                    stopThread.Start(e.RowIndex);
                    //CmpStopRowIndexThread(e.RowIndex);
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
        }
Пример #3
0
 static void Main(string[] args)
 {
     _schedulerManager = SchedulerManager.GetInstance();
     _eventHandler     = new EventHandler();
 }