public List<FanPageData> GetFanPageDataUsingCount(FanPageData acc, int count)
 {
     List<FanPageData> iCol = null;
     try
     {
         using (NHibernate.ISession session = SessionFactory.GetNewSession())
         {
             iCol = session.CreateCriteria(typeof(FanPageData)).List<FanPageData>().Take<FanPageData>(count).ToList();
         }
     }
     catch (Exception ex)
     {
         GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
     }
     return iCol;
 }
 public ICollection<FanPageData> GetAllFanPageData(FanPageData acc)
 {
     ICollection<FanPageData> iCol = null;
     try
     {
         using (NHibernate.ISession session = SessionFactory.GetNewSession())
         {
             iCol = session.CreateCriteria(typeof(FanPageData)).List<FanPageData>();
         }
     }
     catch (Exception ex)
     {
         GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
     }
     return iCol;
 }
 public void Update(FanPageData acc)
 {
     try
     {
         using (NHibernate.ISession session = SessionFactory.GetNewSession())
         {
             using (NHibernate.ITransaction transaction = session.BeginTransaction())
             {
                 //session.Update(acc.Password, acc);
                 transaction.Commit();
             }
         }
     }
     catch (Exception ex)
     {
         GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
     }
 }
        public void Insert(FanPageData 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);
            }
        }
Exemple #5
0
        private void btnFriends_RequestFriends_SendRequest_Click(object sender, EventArgs e)
        {
            try
            {
                if (FBGlobals.listAccounts.Count > 0)
                {
                    objFriendManager.isRequestFriendsStop = false;
                    objFriendManager.lstRequestFriendsThreads.Clear();

                    Regex checkNo = new Regex("^[0-9]*$");

                    int processorCount = objUtils.GetProcessor();  //Environment.ProcessorCount;

                    int threads = 25;

                    int maxThread = 25 * processorCount;

                 //   int ThreadCount = Convert.ToInt32(txtAccounts_AccountCreator_Threads.Text);
                   // if (ThreadCount == 0)
                    {
                        GlobusLogHelper.log.Info("Please Enter More than 0 thread ..");
                        GlobusLogHelper.log.Debug("Please Enter More than 0 thread ..");
                        return;
                    }

                    //if (!string.IsNullOrEmpty(txtAccounts_AccountCreator_Threads.Text) && checkNo.IsMatch(txtAccounts_AccountCreator_Threads.Text))
                    //{
                    //    threads = Convert.ToInt32(txtAccounts_AccountCreator_Threads.Text);
                    //}

                    if (threads > maxThread)
                    {
                        threads = 25;
                    }

                    try
                    {
                        FriendManager.minDelayFriendManager = Convert.ToInt32(txtFriends_RequestFriends_DelayMin.Text);
                        FriendManager.maxDelayFriendManager = Convert.ToInt32(txtFriends_RequestFriends_DelayMax.Text);
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                    }
                    int noOfFriendsRequest = 10;

                    if (!string.IsNullOrEmpty(txtFriends_RequestFriends_NoOfFriendsRequest.Text) && checkNo.IsMatch(txtFriends_RequestFriends_NoOfFriendsRequest.Text))
                    {
                        noOfFriendsRequest = Convert.ToInt32(txtFriends_RequestFriends_NoOfFriendsRequest.Text);
                    }

                    FriendManager.NoOfFriendsRequest = noOfFriendsRequest;
                    FriendManager.NoOfFriendsRequestParKeyWord=Convert.ToInt32(txtFriends_RequestFriends_NoOfFriendsRequestParKeyword.Text);


                    FriendManager.NoOfThreads = threads;

                    if (rdbFriends_RequestFriends_SearchViaLocation.Checked)
                    {
                        FriendManager.IsSearchViaLocation = true;
                        if (!string.IsNullOrEmpty(txtFriends_RequestFriends_Location.Text))
                        {
                            FriendManager.Location = txtFriends_RequestFriends_Location.Text;
                        }
                        else if (objFriendManager.lstRequestFriendsLocation.Count > 0)
                        {
                        }
                        else
                        {
                            MessageBox.Show("Please Enter Location Or Load Location File !");

                            GlobusLogHelper.log.Info("Please Enter Location Or Load Location File !");
                            GlobusLogHelper.log.Debug("Please Enter Location Or Load Location File !");
                            return;
                        }
                    }

                    if (rdbFriends_RequestFriends_SearchViaKeywords.Checked)
                    {
                        FriendManager.IsSearchViaKeywords = true;
                        if (!string.IsNullOrEmpty(txtFriends_RequestFriends_Keywords.Text))
                        {
                            FriendManager.Keywords = txtFriends_RequestFriends_Keywords.Text;
                        }
                        else if (objFriendManager.lstRequestFriendsKeywords.Count > 0)
                        {
                        }
                        else
                        {
                            MessageBox.Show("Please Enter Keywords Or Load Keywords File !");

                            GlobusLogHelper.log.Info("Please Enter Keywords Or Load Keywords File !");
                            GlobusLogHelper.log.Debug("Please Enter Keywords Or Load Keywords File !");
                            return;
                        }
                    }



                    if (rdbFriends_RequestFriends_SearchViaProfileURLs.Checked)
                    {
                        FriendManager.IsSearchViaFanPageURLs = true;
                        //objFriendManager.lstRequestFriendsProfileURLs.count>0
                        FriendManager.IsSearchViaFanPageURLs = false;
                        FriendManager.IsSearchViaLocation = false;
                        //if (!string.IsNullOrEmpty(txtFriends_RequestFriends_Keywords.Text))
                        //{
                        //    FriendManager.Keywords = txtFriends_RequestFriends_Keywords.Text;
                        //}
                        if (objFriendManager.lstRequestFriendsProfileURLs.Count > 0)
                        {
                            FriendManager.IsSearchViaProfileUrls = true;
                        }
                        else
                        {
                            MessageBox.Show("Please Load Profile URLs File !");

                            GlobusLogHelper.log.Info("Please Load Profile URLs File !");
                            GlobusLogHelper.log.Debug("Please Load Profile URLs File !");
                            return;
                        }
                    }

                    if (rdbFriends_RequestFriends_SearchViaFanPageURLs.Checked)
                    {
                        FriendManager.IsSearchViaFanPageURLs = true;
                        FanPageData objFanPageData = new FanPageData();

                        if (rdbFriends_RequestFriends_SearchViaDatabase.Checked)
                        {
                            List<FanPageData> lstFanPageData = objFanPageDataRepository.GetFanPageDataUsingCount(objFanPageData, noOfFriendsRequest);

                            List<string> lstFriendIds = new List<string>();

                            foreach (var item in lstFanPageData)
                            {
                                try
                                {
                                    string friendId = item.Id;
                                    lstFriendIds.Add(friendId);
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                            }

                            objFriendManager.lstFriendIds = lstFriendIds.Distinct().ToList();
                        }
                        else
                        {
                            tabMain.SelectedTab = tabPageScrapers;
                            return;
                        }


                        if (!string.IsNullOrEmpty(txtFriends_RequestFriends_FanPageURLs.Text))
                        {
                            FriendManager.FanPageURLs = txtFriends_RequestFriends_FanPageURLs.Text;
                        }
                    }

                    try
                    {
                        FriendManager.SendRequestUsing = cmbFriends_RequestFriends_SendRequestUsing.SelectedItem.ToString();
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                    }
                    try
                    {
                        FriendManager.NoOfFriendsRequestPerUser = int.Parse(txtNoOFRequestPerUser.Text);
                    }
                    catch (Exception ex)
                    {
                        FriendManager.NoOfFriendsRequestPerUser = 0;
                    }
                    Thread sendFriendRequestThread = new Thread(objFriendManager.StartSendFriendRequest);
                    sendFriendRequestThread.Start();
                }
                else
                {
                    GlobusLogHelper.log.Info("Please Load Accounts !");
                    GlobusLogHelper.log.Debug("Please Load Accounts !");

                    tabMain.SelectedTab = tabMain.TabPages["tabPageAccounts"];
                    tabAccounts.SelectedTab = tabAccounts.TabPages["tabPageManageAccounts"];
                }

            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
        }
Exemple #6
0
        private void PageManagerQuery(DataSet ds, params string[] paramValue)
        {
            try
            {
                if (paramValue.Length > 1)
                {
                    if (paramValue[0] == "Model : FanPageStatusRepository")
                    {
                        try
                        {
                            FanPageStatus objFanPageStatus = new FanPageStatus();

                            if (paramValue[1] == "Function : DeleteUsingMainPageUrl")
                            {
                                objFanPageStatus.MainPageUrl = paramValue[2];

                                objFanPageStatusRepository.DeleteUsingMainPageUrl(objFanPageStatus);
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                        }
                    }
                    if (paramValue[0] == "Model : FanPagePostRepository")
                    {
                        try
                        {
                            FanPagePost objFanPagePost = new FanPagePost();

                            if (paramValue[1] == "Function : Insert")
                            {
                                try
                                {
                                    objFanPagePost.FriendId = paramValue[2];
                                    objFanPagePost.Status = "0";
                                    objFanPagePost.Level = "0";
                                    objFanPagePost.Date = System.DateTime.Now.ToString();
                                    objFanPagePost.MainPageUrl = paramValue[6];

                                    objFanPagePostRepository.Insert(objFanPagePost);
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                            }
                            if (paramValue[1] == "Function : InsertChasngeLevel")
                            {
                                try
                                {
                                    objFanPagePost.FriendId = paramValue[2];
                                    objFanPagePost.Status = "0";
                                    objFanPagePost.Level = "1";
                                    objFanPagePost.Date = System.DateTime.Now.ToString();
                                    objFanPagePost.MainPageUrl = paramValue[6];

                                    objFanPagePostRepository.InsertChasngeLevel(objFanPagePost);
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                            }

                            if (paramValue[1] == "Function : UpdateStatusUsingFriendId")
                            {
                                try
                                {
                                    objFanPagePost.FriendId = paramValue[2];
                                    objFanPagePost.Status = "1";


                                    objFanPagePostRepository.UpdateStatusUsingFriendId(objFanPagePost);
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                            }

                            if (paramValue[1] == "Function : GetFanPagePostUsingLevelStatusMainPageUrl")
                            {

                                try
                                {
                                    objFanPagePost.MainPageUrl = paramValue[2];
                                    objFanPagePost.Status = "0";
                                    objFanPagePost.Level = "0";

                                    List<FanPagePost> lstFPPost = objFanPagePostRepository.GetFanPagePostUsingLevelStatusMainPageUrl(objFanPagePost);

                                    if (lstFPPost.Count > 0)
                                    {
                                        DataTable dt = new DataTable();
                                        dt.Columns.Add("FriendId", typeof(string));

                                        foreach (FanPagePost item in lstFPPost)
                                        {
                                            try
                                            {
                                                dt.Rows.Add(item.FriendId.ToString());
                                            }
                                            catch (Exception ex)
                                            {
                                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                            }
                                        }

                                        ds.Tables.Add(dt);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }

                            }

                            if (paramValue[1] == "Function : GetFanPagePostFriendIdMainPageUrlUsingLevelStatusMainPageUrl")
                            {

                                try
                                {
                                    objFanPagePost.MainPageUrl = paramValue[2];
                                    objFanPagePost.Status = "0";
                                    objFanPagePost.Level = "1";

                                    List<FanPagePost> lstFPPost = objFanPagePostRepository.GetFanPagePostUsingLevelStatusMainPageUrl(objFanPagePost);

                                    if (lstFPPost.Count > 0)
                                    {
                                        DataTable dt = new DataTable();
                                        dt.Columns.Add("FriendId", typeof(string));
                                        dt.Columns.Add("MainPageUrl", typeof(string));

                                        foreach (FanPagePost item in lstFPPost)
                                        {
                                            try
                                            {
                                                dt.Rows.Add(item.FriendId.ToString(), item.MainPageUrl);
                                            }
                                            catch (Exception ex)
                                            {
                                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                            }
                                        }

                                        ds.Tables.Add(dt);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                        }
                    }

                    if (paramValue[0] == "Model : EmailRepository")
                    {
                        Email objemail = new Email();
                        try
                        {
                            if (paramValue[1] == "Function : InsertCreatedEmailinEmailDatatbase")
                            {
                                objemail.UserName = paramValue[2];
                                objemail.Password = paramValue[3];
                                objemail.IsUsed = "0";
                                objEmailRepository.Insert(objemail);
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                        }
                    }

                    if (paramValue[0] == "Model : CaptchaSetting")
                    {
                        faceboardpro.Domain.Captcha objcaptcha = new faceboardpro.Domain.Captcha();
                        try
                        {
                            if (paramValue[1] == "Function : InsertCaptchaSettinginCaptchaDatatbase")
                            {
                                objcaptcha.Username = paramValue[2];
                                objcaptcha.Password = paramValue[3];
                                objcaptcha.CaptchaService = paramValue[4];
                                objcaptcha.Status = "True";
                                objCaptchaRepositry.Insert(objcaptcha);

                                objCaptchaRepositry.UpdateCaptchaStatusForOtherService(objcaptcha);
                            }
                            if (paramValue[1] == "Function : UpdateCaptchaSettinginCaptchaDatatbase")
                            {
                                objcaptcha.Username = paramValue[2];
                                objcaptcha.Password = paramValue[3];
                                objcaptcha.CaptchaService = paramValue[4];
                                objcaptcha.Status = "True";

                                objCaptchaRepositry.UpdateCaptchaStatusForOtherService(objcaptcha);
                                objCaptchaRepositry.UpdateCaptchaSetting(objcaptcha);
                            }

                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                        }
                    }


                    if (paramValue[0] == "Model : FanPageDataRepository")
                    {
                        try
                        {
                            FanPageData objFanPageData = new FanPageData();

                            if (paramValue[1] == "Function : Insert")
                            {
                                try
                                {
                                    objFanPageData.Id = (paramValue[2]);
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                                try
                                {
                                    objFanPageData.Name = paramValue[3];
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                                try
                                {
                                    objFanPageData.FirstName = paramValue[4];
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                                try
                                {
                                    objFanPageData.MiddleName = paramValue[5];
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                                try
                                {
                                    objFanPageData.LastName = paramValue[6];
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                                try
                                {
                                    objFanPageData.Link = paramValue[7];
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                                try
                                {
                                    objFanPageData.Gender = paramValue[8];
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                                try
                                {
                                    objFanPageData.Locale = paramValue[9];
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                                try
                                {
                                    objFanPageData.ProfileStatus = paramValue[10];
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                                try
                                {
                                    objFanPageData.Url = paramValue[11];
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                                try
                                {
                                    objFanPageData.ShowUser = paramValue[12];
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }

                                objFanPageDataRepository.Insert(objFanPageData);
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
        }