public void DeleteSingleAccount()
        {
            try
            {
                QueryExecuter QME = new QueryExecuter();
                DataSet       ds  = QME.getAccount();
                int           i   = dgvAccounts.SelectedIndex;
                if (i < 0)
                {
                    GlobusLogHelper.log.Info("Please Select Account For Deletion !");
                    var ResultMessageBox = ModernDialog.ShowMessage("Please Select Account For Deletion !", " Delete Account ", MessageBoxButton.OKCancel);
                    return;
                }

                if (ModernDialog.ShowMessage("Are You Want To Delete This Accounts Permanently?", " Delete Account ", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    foreach (AccountNotifyPropertyChanged objAccountNotifyPropertyChanged in dgvAccounts.SelectedItems)
                    {
                        try
                        {
                            // AccountViewModel._listOfAccount
                            //DataRowView row = (DataRowView)selection;

                            string Username = objAccountNotifyPropertyChanged.Username.ToString();
                            string Password = objAccountNotifyPropertyChanged.Password.ToString();
                            QueryManager.DeleteAccounts(Username);
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error :" + ex.Message);
                        }
                    }
                    AccounLoad();
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
            }
        }
Esempio n. 2
0
        public void loaddatafmdb()
        {
            try
            {
                DataTable NewDt2 = CreateUrltable();
                QueryExecuter Qm = new QueryExecuter();
                DataSet ds = Qm.getAccount();

                DataTable dt = ds.Tables[0];
                List<string> BunchList = new List<string>();
                int itemCounter = 0;

                foreach (DataRow item in dt.Rows)
                {
                    try
                    {
                        DataRow newdr = NewDt2.NewRow();
                        string Username = item["Username"].ToString();
                        string Password = item["Password"].ToString();
                        string proxyAddress = item["IPAddress"].ToString();
                        string proxyPort = item["IPPort"].ToString();
                        string proxyUsername = item["IPUsername"].ToString();
                        string proxyPassword = item["IPPassword"].ToString();
                        string Path = item["Path"].ToString();

                        newdr["Username"] = Username;
                        newdr["Password"] = Password;
                        newdr["IPAddress"] = proxyAddress;
                        newdr["IPPort"] = proxyPort;
                        newdr["IPUsername"] = proxyUsername;
                        newdr["IPPassword"] = proxyPassword;
                        newdr["Path"] = Path;

                        ClGlobul.lstUrls.Add(Username);
                        ClGlobul.lstUrls.Add(Password);
                        ClGlobul.lstUrls.Add(proxyAddress);
                        ClGlobul.lstUrls.Add(proxyPort);
                        ClGlobul.lstUrls.Add(proxyUsername);
                        ClGlobul.lstUrls.Add(proxyPassword);
                        ClGlobul.lstUrls.Add(Path);

                        NewDt2.Rows.Add(newdr);
                    }
                    catch { };
                }

                if (this.InvokeRequired)
                {
                    this.Invoke(new MethodInvoker(delegate
                    {
                        dgvAccount.DataSource = NewDt2;
                    }));
                }
                else
                {
                    dgvAccount.DataSource = NewDt2;
                }

            }
            catch { };
        }
Esempio n. 3
0
        public void loadAccount()
        {
            string path = string.Empty;
            try
            {
                QueryExecuter qm1 = new QueryExecuter();
                DataSet ds = qm1.getAccount();
                if (ds.Tables[0].Rows.Count != 0)
                {
                    try
                    {
                        path = ds.Tables[0].Rows[0].ItemArray[6].ToString();
                        if (!string.IsNullOrEmpty(path))
                        {
                            try
                            {
                                txtAddAccounts1.Text = path;
                            }
                            catch { };
                        }
                    }
                    catch { }

                    for (int noRow = 0; noRow < ds.Tables[0].Rows.Count; noRow++)
                    {
                        string account = ds.Tables[0].Rows[noRow].ItemArray[0].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[1].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[2].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[3].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[4].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[5].ToString();
                        ClGlobul.accountList.Add(account);
                    }
                    AddToLogger("[ " + DateTime.Now + " ] => [ " + ClGlobul.accountList.Count + " Accounts Loaded ]");
                }
                else
                {
                    AddToLogger("[ " + DateTime.Now + " ] => [  No Accounts Loaded ]");
                }
            }

            catch (Exception ex)
            {
                AddToLogger("[ " + DateTime.Now + " ] => [  No Accounts Loaded ]");
            }

            DataTable dt = new DataTable();
            dt.Columns.Add("Username");
            dt.Columns.Add("Password");
            dt.Columns.Add("proxyAddress");
            dt.Columns.Add("proxyPort");
            dt.Columns.Add("proxyUsername");
            dt.Columns.Add("proxyPassword");
            dt.Columns.Add("Path");
        }
        public void  AccounLoad()
        {
            try
            {
                string accountUser   = string.Empty;
                string accountPass   = string.Empty;
                string niches        = string.Empty;
                string proxyAddress  = string.Empty;
                string proxyPort     = string.Empty;
                string proxyUserName = string.Empty;
                string proxyPassword = string.Empty;
                //string Useragent = string.Empty;
                string        BoardsName  = string.Empty;
                string        ScreenName  = string.Empty;
                string        LoginStatus = string.Empty;
                string        Followers   = string.Empty;
                string        Following   = string.Empty;
                QueryExecuter QME         = new QueryExecuter();
                DataSet       ds          = QME.getAccount();
                this.Dispatcher.Invoke(new Action(delegate
                {
                    AccountViewModel._listOfAccount.Clear();
                }));
                if (ds.Tables[0].Rows.Count != 0)
                {
                    PDGlobals.listAccounts.Clear();
                    for (int noRow = 0; noRow < ds.Tables[0].Rows.Count; noRow++)
                    {
                        string account = ds.Tables[0].Rows[noRow].ItemArray[0].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[1].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[2].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[3].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[4].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[5].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[6].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[7].ToString();
                        PDGlobals.listAccounts.Add(account);
                        //  dv.AllowNew = false;
                        accountUser   = ds.Tables[0].Rows[noRow].ItemArray[0].ToString();
                        accountPass   = ds.Tables[0].Rows[noRow].ItemArray[1].ToString();
                        niches        = ds.Tables[0].Rows[noRow].ItemArray[2].ToString();
                        proxyAddress  = ds.Tables[0].Rows[noRow].ItemArray[3].ToString();
                        proxyPort     = ds.Tables[0].Rows[noRow].ItemArray[4].ToString();
                        proxyUserName = ds.Tables[0].Rows[noRow].ItemArray[5].ToString();
                        proxyPassword = ds.Tables[0].Rows[noRow].ItemArray[6].ToString();
                        ScreenName    = ds.Tables[0].Rows[noRow].ItemArray[9].ToString();
                        Followers     = ds.Tables[0].Rows[noRow].ItemArray[7].ToString();
                        Following     = ds.Tables[0].Rows[noRow].ItemArray[8].ToString();
                        LoginStatus   = ds.Tables[0].Rows[noRow].ItemArray[10].ToString();

                        // Accounts objPinInterestUser = new Accounts();
                        PinInterestUser objPinInterestUser = new PinInterestUser("", "", "", "");
                        objPinInterestUser.Username      = accountUser;
                        objPinInterestUser.Password      = accountPass;
                        objPinInterestUser.Niches        = niches;
                        objPinInterestUser.ProxyAddress  = proxyAddress;
                        objPinInterestUser.ProxyPort     = proxyPort;
                        objPinInterestUser.ProxyUsername = proxyUserName;
                        objPinInterestUser.ProxyPassword = proxyPassword;
                        // objPinInterestUser.LoginStatus = LoginStatus;
                        try
                        {
                            AccountNotifyPropertyChanged objAccountNotifyPropertyChanged = new AccountNotifyPropertyChanged();

                            objAccountNotifyPropertyChanged.Username       = accountUser;
                            objAccountNotifyPropertyChanged.Password       = accountPass;
                            objAccountNotifyPropertyChanged.Niche          = niches;
                            objAccountNotifyPropertyChanged.ScreenName     = ScreenName;
                            objAccountNotifyPropertyChanged.FollowerCount  = Followers;
                            objAccountNotifyPropertyChanged.FollowingCount = Following;
                            objAccountNotifyPropertyChanged.ProxyAddress   = proxyAddress;
                            objAccountNotifyPropertyChanged.ProxyPassword  = proxyPassword;
                            objAccountNotifyPropertyChanged.ProxyPort      = proxyPort;
                            objAccountNotifyPropertyChanged.ProxyUserName  = proxyUserName;
                            if (LoginStatus.Contains("Success"))
                            {
                                objAccountNotifyPropertyChanged.LoginStatus     = "Success";
                                objAccountNotifyPropertyChanged.BackgroundColor = "Green";
                                this.Dispatcher.Invoke(new Action(delegate
                                {
                                    AccountViewModel._listOfAccount.Add(objAccountNotifyPropertyChanged);
                                }));
                            }
                            else if (LoginStatus.Contains("Fail"))
                            {
                                objAccountNotifyPropertyChanged.LoginStatus     = "Fail";
                                objAccountNotifyPropertyChanged.BackgroundColor = "Red";
                                this.Dispatcher.Invoke(new Action(delegate
                                {
                                    AccountViewModel._listOfAccount.Add(objAccountNotifyPropertyChanged);
                                }));
                            }
                            else if (LoginStatus.Contains("Not"))
                            {
                                objAccountNotifyPropertyChanged.LoginStatus     = "Not Checked";
                                objAccountNotifyPropertyChanged.BackgroundColor = "";
                                this.Dispatcher.Invoke(new Action(delegate
                                {
                                    AccountViewModel._listOfAccount.Add(objAccountNotifyPropertyChanged);
                                }));
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
                        }


                        try
                        {
                            PDGlobals.loadedAccountsDictionary.Add(objPinInterestUser.Username, objPinInterestUser);
                            try
                            {
                                this.Dispatcher.Invoke(new Action(delegate
                                {
                                    // dgvAccounts.ItemsSource = ds.Tables[0].DefaultView;
                                    dgvAccounts.ItemsSource = AccountViewModel._listOfAccount;
                                    // AccountViewModel._listOfAccount.Clear();
                                }));
                            }
                            catch (Exception ex)
                            { };
                        }
                        catch (Exception ex)
                        { };
                    }
                    try
                    {
                        this.Dispatcher.Invoke(new Action(delegate
                        {
                            // dgvAccounts.ItemsSource = ds.Tables[0].DefaultView;
                            dgvAccounts.ItemsSource = AccountViewModel._listOfAccount;
                            //AccountViewModel._listOfAccount.Clear();
                        }));
                    }
                    catch { };
                    GlobusLogHelper.log.Info(" => [ " + PDGlobals.listAccounts.Count + " Accounts Loaded ]");
                }
                else
                {
                    this.Dispatcher.Invoke(new Action(delegate
                    {
                        //dgvAccounts.ItemsSource = ds.Tables[0].DefaultView;
                        dgvAccounts.ItemsSource = AccountViewModel._listOfAccount;
                        // AccountViewModel._listOfAccount.Clear();
                    }));
                    GlobusLogHelper.log.Info(" [  No Accounts Loaded ]");
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
        }