private void Emails() { try { counter_GroupMemberSearch = 0; this.Invoke(new MethodInvoker(delegate { using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.Filter = "Text Files (*.txt)|*.txt"; ofd.InitialDirectory = Application.StartupPath; if (ofd.ShowDialog() == DialogResult.OK) { this.Invoke(new MethodInvoker(delegate { //txtEmails.Text = ofd.FileName; })); //CampainGroupCreate.Campain_Emails = txtEmails.Text; Email.Clear(); List<string> templist = GlobusFileHelper.ReadFile(ofd.FileName); templist = templist.Distinct().ToList(); templist.Remove(""); Email.AddRange(templist); Email = Email.Distinct().ToList(); CampainGroupCreate.Campaign_Email = Email.Distinct().ToList(); int countEmail = Email.Count(); if (Globals.IsFreeVersion) { try { Email.RemoveRange(5, Email.Count - 5); } catch { } if (countEmail > 5) { try { this.Invoke(new MethodInvoker(delegate { FrmFreeTrial frm_freetrail = new FrmFreeTrial(); frm_freetrail.TopMost = true; frm_freetrail.BringToFront(); frm_freetrail.Show(); })); } catch (Exception) { } } } //Thread FillEmailsInQueue_Thread = new Thread(FillEmailsInQueue); //FillEmailsInQueue_Thread.Start(); //foreach (string item in templist) //{ // string newItem = item.Replace(" ", "").Replace("\t", ""); // if (!Email.Contains(item) && !string.IsNullOrEmpty(newItem)) // { // Email.Add(item); // } //} counter_GroupMemberSearch = Email.Count; } } })); } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Account Creator --> btnEmails_Click() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs); GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Account Creator --> btnEmails_Click() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAccountCraetionErrorLogs); } }
public void LoadGridView() { try { DataTable dt = objclsLinkedINAccount.SelectAccoutsForGridView(); try { dgvAccount.Invoke(new MethodInvoker(delegate { dgvAccount.DataSource = dt; })); } catch { } //*** Add to Dictonary *************************** LinkedInManager.linkedInDictionary.Clear(); try { foreach (DataRow DTRow in dt.Rows) { try { LinkedInMaster objLinkedInMaster = new LinkedInMaster(); objLinkedInMaster._Username = DTRow[0].ToString(); objLinkedInMaster._Password = DTRow[1].ToString(); objLinkedInMaster._ProxyAddress = DTRow[2].ToString(); objLinkedInMaster._ProxyPort = DTRow[3].ToString(); objLinkedInMaster._ProxyUsername = DTRow[4].ToString(); objLinkedInMaster._ProxyPassword = DTRow[5].ToString(); LinkedInManager.linkedInDictionary.Add(objLinkedInMaster._Username, objLinkedInMaster); //Ld_lstAccountCheckerEmail.Add(objLinkedInMaster._Username, objLinkedInMaster); if (Globals.IsFreeVersion) { if (dt.Rows.Count >= 5) { if (_accountcounter > 4) { FrmFreeTrial frmFreeTrial = new FrmFreeTrial(); frmFreeTrial.TopMost = true; frmFreeTrial.ShowDialog(); break; } else { _accountcounter++; } } } } catch (Exception ex) { Console.WriteLine(ex.Message); } } //AddLoggerAccountLoad(LinkedInManager.linkedInDictionary.Count + " Accounts loaded"); ////AddLoggerAccounts(LinkedInManager.linkedInDictionary.Count + " Accounts loaded"); //Log(LinkedInManager.linkedInDictionary.Count + " Accounts loaded"); } catch (Exception ex) { Console.WriteLine(ex.Message); AddLoggerAccountLoad("[ " + DateTime.Now + " ] => [ Account Loading has some problem in GridView ]"); } try { this.Invoke(new MethodInvoker(delegate { lblAccountStatus.Text = "PROCESS COMPLETED"; })); } catch { } try { if (dt.Rows.Count > 0) { label6.Invoke(new MethodInvoker(delegate { label6.Text = dt.Rows.Count.ToString(); })); } else { label6.Invoke(new MethodInvoker(delegate { label6.Text = (0).ToString(); })); } } catch { } } catch { } }
public void LoadAccounts() { try { int countAccount = 0; if (Globals.IsFreeVersion) { //try //{ // string DeleteQuery = "Delete from tb_LinkedInAccount"; // DataBaseHandler.DeleteQuery(DeleteQuery, "tb_LinkedInAccount"); // LoadDataGrid(); //} //catch (Exception) //{ //} try { btnClearAccounts.Enabled = false; DataTable dt1 = objclsLinkedINAccount.SelectAccoutsForGridView(); countAccount = dt1.Rows.Count; if (countAccount >= 5) { return; } else { countAccount = 5 - countAccount; } } catch (Exception) { } } DataTable dt = new DataTable(); using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.Filter = "Text Files (*.txt)|*.txt"; ofd.InitialDirectory = Application.StartupPath; if (ofd.ShowDialog() == DialogResult.OK) { this.Invoke(new MethodInvoker(delegate { txtAccountFile.Text = ofd.FileName; clsSettingDB ObjclsSettingDB = new clsSettingDB(); ObjclsSettingDB.InsertOrUpdateSetting("LoadAccounts", "LoadAccounts", StringEncoderDecoder.Encode(txtAccountFile.Text)); })); List <string> templist = GlobusFileHelper.ReadFiletoStringList(ofd.FileName); Ld_lstAccountCheckerEmail.AddRange(templist); int countlist = templist.Count(); if (Globals.IsFreeVersion) { try { //templist.RemoveRange(5, templist.Count - 5); templist.RemoveRange(countAccount, templist.Count - countAccount); } catch { } foreach (string item in templist) { LoadDBAccount(item); } LoadGridView(); if (countlist > 5) { try { this.Invoke(new MethodInvoker(delegate { FrmFreeTrial frmFreeTrial = new FrmFreeTrial(); frmFreeTrial.TopMost = true; frmFreeTrial.BringToFront(); frmFreeTrial.ShowDialog(); })); } catch (Exception) { } } this.Invoke(new MethodInvoker(delegate { this.Close(); })); } else { foreach (string item in templist) { LoadDBAccount(item); } LoadGridView(); } } AddLoggerAccountLoad("[ " + DateTime.Now + " ] => [ " + LinkedInManager.linkedInDictionary.Count + " Accounts loaded ]"); //AddLoggerAccounts(LinkedInManager.linkedInDictionary.Count + " Accounts loaded"); Log("[ " + DateTime.Now + " ] => [ " + LinkedInManager.linkedInDictionary.Count + " Accounts loaded ]"); } } catch { } }
public void LoadAccounts() { try { int countAccount = 0; if (Globals.IsFreeVersion) { //try //{ // string DeleteQuery = "Delete from tb_LinkedInAccount"; // DataBaseHandler.DeleteQuery(DeleteQuery, "tb_LinkedInAccount"); // LoadDataGrid(); //} //catch (Exception) //{ //} try { btnClearAccounts.Enabled = false; DataTable dt1 = objclsLinkedINAccount.SelectAccoutsForGridView(); countAccount = dt1.Rows.Count; if (countAccount >= 5) { return; } else { countAccount = 5 - countAccount; } } catch (Exception) { } } DataTable dt = new DataTable(); using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.Filter = "Text Files (*.txt)|*.txt"; ofd.InitialDirectory = Application.StartupPath; if (ofd.ShowDialog() == DialogResult.OK) { this.Invoke(new MethodInvoker(delegate { txtAccountFile.Text = ofd.FileName; clsSettingDB ObjclsSettingDB = new clsSettingDB(); ObjclsSettingDB.InsertOrUpdateSetting("LoadAccounts", "LoadAccounts", StringEncoderDecoder.Encode(txtAccountFile.Text)); })); List<string> templist = GlobusFileHelper.ReadFiletoStringList(ofd.FileName); Ld_lstAccountCheckerEmail.AddRange(templist); int countlist = templist.Count(); if (Globals.IsFreeVersion) { try { //templist.RemoveRange(5, templist.Count - 5); templist.RemoveRange(countAccount, templist.Count - countAccount); } catch { } foreach (string item in templist) { LoadDBAccount(item); } LoadGridView(); if (countlist > 5) { try { this.Invoke(new MethodInvoker(delegate { FrmFreeTrial frmFreeTrial = new FrmFreeTrial(); frmFreeTrial.TopMost = true; frmFreeTrial.BringToFront(); frmFreeTrial.ShowDialog(); })); } catch (Exception) { } } this.Invoke(new MethodInvoker(delegate { this.Close(); })); } else { foreach (string item in templist) { LoadDBAccount(item); } LoadGridView(); } } AddLoggerAccountLoad("[ " + DateTime.Now + " ] => [ " + LinkedInManager.linkedInDictionary.Count + " Accounts loaded ]"); //AddLoggerAccounts(LinkedInManager.linkedInDictionary.Count + " Accounts loaded"); Log("[ " + DateTime.Now + " ] => [ " + LinkedInManager.linkedInDictionary.Count + " Accounts loaded ]"); } } catch { } }