public List<SchFanPageLiker> GetSchFanPageLikerDataUsingSchName(SchFanPageLiker schFanPageLiker)
        {
            List<SchFanPageLiker> lstSchFanPageLiker = new List<SchFanPageLiker>();
            try
            {
                using (NHibernate.ISession session = SessionFactory.GetNewSession())
                {

                    NHibernate.IQuery nIquery = session.CreateQuery("from SchFanPageLiker s where s.SchedulerName = :SchedulerName");
                    nIquery.SetParameter("SchedulerName", schFanPageLiker.SchedulerName);


                    foreach (SchFanPageLiker item in nIquery.Enumerable<SchFanPageLiker>())
                    {
                        try
                        {
                            lstSchFanPageLiker.Add(item);
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                        }
                    }

                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
            return lstSchFanPageLiker;
        }
        public void Insert(SchFanPageLiker acc)
        {
            try
            {
                lock (lockerInsert)
                {
                    using (NHibernate.ISession session = SessionFactory.GetNewSession())
                    {
                        using (NHibernate.ITransaction transaction = session.BeginTransaction())
                        {
                            session.Save(acc);

                            transaction.Commit();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
        }
Esempio n. 3
0
        private void btnScheduler_SchFanPageLiker_Update_Click(object sender, EventArgs e)
        {
            try
            {
                SchFanPageLikerRepository objSchFanPageLikerRepository = new SchFanPageLikerRepository();
                SchFanPageLiker objSchFanPageLiker = new SchFanPageLiker();

                if (string.IsNullOrEmpty(cmbScheduler_SchFanPageLiker_SelectSchedulerForUpdate.SelectedItem.ToString()))
                {
                    GlobusLogHelper.log.Info("Please Select Campaign For Update !");
                    GlobusLogHelper.log.Debug("Please Select Campaign For Update !");

                    MessageBox.Show("Please Select Campaign For Update !");
                    return;
                }

                objSchFanPageLiker.SchedulerName = cmbScheduler_SchFanPageLiker_SelectSchedulerForUpdate.SelectedItem.ToString();

                try
                {
                    objSchFanPageLiker.SchedulerProcess = cmbScheduler_SchFanPageLiker_SchedulerProcess.SelectedItem.ToString();
                }
                catch (Exception ex)
                {
                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                }


                if (string.IsNullOrEmpty(lblScheduler_SchFanPageLiker_AccountsPath.Text) && lblScheduler_SchFanPageLiker_AccountsCount.Text == "0" && string.IsNullOrEmpty(lblScheduler_SchFanPageLiker_FanPageURLsPath.Text) && lblScheduler_SchFanPageLiker_FanPageURLsCount.Text == "0" && string.IsNullOrEmpty(lblScheduler_SchFanPageLiker_FanPageMessagesPath.Text) && lblScheduler_SchFanPageLiker_FanPageMessagesCount.Text == "0" && string.IsNullOrEmpty(lblScheduler_SchFanPageLiker_FanPageCommentsPath.Text) && lblScheduler_SchFanPageLiker_FanPageCommentsCount.Text == "0")
                {
                    GlobusLogHelper.log.Info("Please Load Accounts, Fan Page URLs, Fan Page Comments And Fan Page Messages !");
                    GlobusLogHelper.log.Debug("Please Load Accounts, Fan Page URLs, Fan Page Comments And Fan Page Messages !");

                    MessageBox.Show("Please Load Accounts, Fan Page URLs, Fan Page Comments And Fan Page Messages !");
                    return;
                }

                objSchFanPageLiker.AccountsFile = lblScheduler_SchFanPageLiker_AccountsPath.Text;
                objSchFanPageLiker.FanPageURLsFile = lblScheduler_SchFanPageLiker_FanPageURLsPath.Text;
                objSchFanPageLiker.FanPageMessageFile = lblScheduler_SchFanPageLiker_FanPageMessagesPath.Text;
                objSchFanPageLiker.FanPageCommentsFile = lblScheduler_SchFanPageLiker_FanPageCommentsPath.Text;
                objSchFanPageLiker.StartDate = Convert.ToDateTime(dtpScheduler_SchFanPageLiker_StartDate.Text);
                objSchFanPageLiker.EndDate = Convert.ToDateTime(dtpScheduler_SchFanPageLiker_EndDate.Text);
                objSchFanPageLiker.StartTime = txtScheduler_SchFanPageLiker_StartTime.Text;
                objSchFanPageLiker.EndTime = txtScheduler_SchFanPageLiker_EndTime.Text;

                int respose = objSchFanPageLikerRepository.UpdateUsingSchName(objSchFanPageLiker);

                GlobusLogHelper.log.Info("Affected Rows : " + respose);
                GlobusLogHelper.log.Debug("Affected Rows : " + respose);
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
        }
Esempio n. 4
0
        private void btnScheduler_SchFanPageLiker_Save_Click(object sender, EventArgs e)
        {
            try
            {
                if ((lblScheduler_SchFanPageLiker_AccountsCount.Text == "0" || string.IsNullOrEmpty(lblScheduler_SchFanPageLiker_AccountsCount.Text)) && string.IsNullOrEmpty(lblScheduler_SchFanPageLiker_AccountsPath.Text))
                {
                    GlobusLogHelper.log.Info("Please Load Scheduler Accounts !");
                    GlobusLogHelper.log.Debug("Please Load Scheduler Accounts !");

                    MessageBox.Show("Please Load Scheduler Accounts !");
                    return;
                }
                if ((lblScheduler_SchFanPageLiker_FanPageURLsCount.Text == "0" || string.IsNullOrEmpty(lblScheduler_SchFanPageLiker_FanPageURLsCount.Text)) && string.IsNullOrEmpty(lblScheduler_SchFanPageLiker_FanPageURLsPath.Text))
                {
                    GlobusLogHelper.log.Info("Please Load Scheduler Fan Page URLs !");
                    GlobusLogHelper.log.Debug("Please Load Scheduler Fan Page URLs !");

                    MessageBox.Show("Please Load Scheduler Accounts !");
                    return;
                }

                if ((lblScheduler_SchFanPageLiker_FanPageCommentsCount.Text == "0" || string.IsNullOrEmpty(lblScheduler_SchFanPageLiker_FanPageCommentsCount.Text)) && string.IsNullOrEmpty(lblScheduler_SchFanPageLiker_FanPageCommentsPath.Text))
                {
                    GlobusLogHelper.log.Info("Please Load Scheduler Fan Page Comments !");
                    GlobusLogHelper.log.Debug("Please Load Scheduler Fan Page Comments !");

                    MessageBox.Show("Please Load Scheduler Fan Page Comments !");
                    return;
                }

                if ((lblScheduler_SchFanPageLiker_FanPageMessagesCount.Text == "0" || string.IsNullOrEmpty(lblScheduler_SchFanPageLiker_FanPageMessagesCount.Text)) && string.IsNullOrEmpty(lblScheduler_SchFanPageLiker_FanPageMessagesPath.Text))
                {
                    GlobusLogHelper.log.Info("Please Load Scheduler Fan Page Messages !");
                    GlobusLogHelper.log.Debug("Please Load Scheduler Fan Page Messages !");

                    MessageBox.Show("Please Load Scheduler Fan Page Messages !");
                    return;
                }
                if (string.IsNullOrEmpty(txtScheduler_SchFanPageLiker_SchedulerName.Text))
                {
                    GlobusLogHelper.log.Info("Please Enter Unique Scheduler Name !");
                    GlobusLogHelper.log.Debug("Please Enter Unique Scheduler Name !");

                    MessageBox.Show("Please Enter Unique Scheduler Name !");
                    return;
                }
                if (string.IsNullOrEmpty(cmbScheduler_SchFanPageLiker_SchedulerProcess.SelectedItem.ToString()))
                {
                    GlobusLogHelper.log.Info("Please Select Scheduler Process !");
                    GlobusLogHelper.log.Debug("Please Select Scheduler Process !");

                    MessageBox.Show("Please Select Scheduler Process !");
                    return;
                }

                if (string.IsNullOrEmpty(dtpScheduler_SchFanPageLiker_StartDate.Text))
                {
                    GlobusLogHelper.log.Info("Please Select Scheduler Start Date !");
                    GlobusLogHelper.log.Debug("Please Select Scheduler Start Date !");

                    MessageBox.Show("Please Select Scheduler Start Date !");
                    return;
                }

                if (string.IsNullOrEmpty(dtpScheduler_SchFanPageLiker_EndDate.Text))
                {
                    GlobusLogHelper.log.Info("Please Select Scheduler End Date !");
                    GlobusLogHelper.log.Debug("Please Select Scheduler End Date !");

                    MessageBox.Show("Please Select Scheduler End Date !");
                    return;
                }

                if (string.IsNullOrEmpty(txtScheduler_SchFanPageLiker_StartTime.Text))
                {
                    GlobusLogHelper.log.Info("Please Select Scheduler Start Time !");
                    GlobusLogHelper.log.Debug("Please Select Scheduler Start Time !");

                    MessageBox.Show("Please Select Scheduler Start Time !");
                    return;
                }

                if (string.IsNullOrEmpty(txtScheduler_SchFanPageLiker_EndTime.Text))
                {
                    GlobusLogHelper.log.Info("Please Select Scheduler End Time !");
                    GlobusLogHelper.log.Debug("Please Select Scheduler End Time !");

                    MessageBox.Show("Please Select Scheduler End Time !");
                    return;
                }

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

                objSchFanPageLiker.AccountsFile = lblScheduler_SchFanPageLiker_AccountsPath.Text;
                objSchFanPageLiker.FanPageURLsFile = lblScheduler_SchFanPageLiker_FanPageURLsPath.Text;
                objSchFanPageLiker.FanPageMessageFile = lblScheduler_SchFanPageLiker_FanPageMessagesPath.Text;
                objSchFanPageLiker.FanPageCommentsFile = lblScheduler_SchFanPageLiker_FanPageCommentsPath.Text;

                objSchFanPageLiker.SchedulerName = txtScheduler_SchFanPageLiker_SchedulerName.Text;
                objSchFanPageLiker.SchedulerProcess = cmbScheduler_SchFanPageLiker_SchedulerProcess.SelectedItem.ToString();
                objSchFanPageLiker.StartDate = Convert.ToDateTime(dtpScheduler_SchFanPageLiker_StartDate.Text);
                objSchFanPageLiker.EndDate = Convert.ToDateTime(dtpScheduler_SchFanPageLiker_EndDate.Text);
                objSchFanPageLiker.StartTime = txtScheduler_SchFanPageLiker_StartTime.Text;
                objSchFanPageLiker.EndTime = txtScheduler_SchFanPageLiker_EndTime.Text;
                objSchFanPageLiker.Status = "0";

                objSchFanPageLikerRepository.Insert(objSchFanPageLiker);

            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
        }
Esempio n. 5
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);
            }
        }
        public int UpdateUsingSchName(SchFanPageLiker schFanPageLiker)
        {
            lock (lockerUpdateUsingCmpName)
            {
                int res = 0;
                try
                {
                    using (NHibernate.ISession session = SessionFactory.GetNewSession())
                    {
                        using (NHibernate.ITransaction transaction = session.BeginTransaction())
                        {
                            var query = session.CreateQuery("Update SchFanPageLiker set SchedulerProcess = :SchedulerProcess, AccountsFile= :AccountsFile, FanPageURLsFile= :FanPageURLsFile, FanPageMessageFile= :FanPageMessageFile, FanPageCommentsFile = :FanPageCommentsFile, StartDate = :StartDate, EndDate = :EndDate, StartTime = :StartTime, EndTime = :EndTime  where SchedulerName= :SchedulerName");
                            query.SetParameter("SchedulerProcess", schFanPageLiker.SchedulerProcess);
                            query.SetParameter("AccountsFile", schFanPageLiker.AccountsFile);
                            query.SetParameter("FanPageURLsFile", schFanPageLiker.FanPageURLsFile);
                            query.SetParameter("FanPageMessageFile", schFanPageLiker.FanPageMessageFile);
                            query.SetParameter("FanPageCommentsFile", schFanPageLiker.FanPageCommentsFile);
                            query.SetParameter("StartDate", schFanPageLiker.StartDate);
                            query.SetParameter("EndDate", schFanPageLiker.EndDate);
                            query.SetParameter("StartTime", schFanPageLiker.StartTime);
                            query.SetParameter("EndTime", schFanPageLiker.EndTime);
                            query.SetParameter("SchedulerName", schFanPageLiker.SchedulerName);

                            res = query.ExecuteUpdate();
                            transaction.Commit();
                        }
                    }
                }
                catch (Exception ex)
                {
                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                }

                return res;
            }
        }
 public void Delete(SchFanPageLiker acc)
 {
     try
     {
         using (NHibernate.ISession session = SessionFactory.GetNewSession())
         {
             using (NHibernate.ITransaction transaction = session.BeginTransaction())
             {
                 //session.Delete(acc.UserName);
                 transaction.Commit();
             }
         }
     }
     catch (Exception ex)
     {
         GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
     }
 }