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 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();
				accountData.Clear();
				//DataTable dt = QME.getAccount (module);
				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;
						try
						{
							PDGlobals.loadedAccountsDictionary.Add(objPinInterestUser.Username, objPinInterestUser);
							AddDataInGridView (accountUser, accountPass, niches, proxyAddress, proxyPort, proxyUserName, proxyPassword, ScreenName, Followers, Following, LoginStatus);
						}
						catch (Exception ex)
						{ 
							AddDataInGridView (accountUser, accountPass, niches, proxyAddress, proxyPort, proxyUserName, proxyPassword, ScreenName, Followers, Following, LoginStatus);
						};
					}

					Addtologger ("[ " + DateTime.Now + " ] => [ " + PDGlobals.listAccounts.Count + " Accounts Loaded ]");
				}
				else
				{
					AddDataInGridView (accountUser, accountPass, niches, proxyAddress, proxyPort, proxyUserName, proxyPassword, ScreenName, Followers, Following, LoginStatus);
					Addtologger ("[ " + DateTime.Now + " ] => [  No Accounts Loaded ]");
				}
			}
			catch(Exception ex)
			{
				Console.Write (ex.Message);
			}
		}
        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);
            }
        }
        public void AccounLoadaCCOUNTcHEKER()
        {
            try
            {
                this.Dispatcher.Invoke(new Action(delegate
                {
                    AccountViewModel._listOfAccount.Clear();
                }));
                NoOfAccountLoading++;
                string accountUser = string.Empty;
                string accountPass = string.Empty;
                string proxyAddress = string.Empty;
                string proxyPort = string.Empty;
                string proxyUserName = string.Empty;
                string proxyPassword = string.Empty;
                string LogInStatus = string.Empty;
                string FollowerCount = string.Empty;
                string FollwingCount = string.Empty;
                string Authorized = string.Empty;
                string Post = string.Empty;
                string path = string.Empty;                
                QueryExecuter QME = new QueryExecuter();
                DataSet ds = QME.getAccount();
                if (ds.Tables[0].Rows.Count != 0)
                {

                    this.Dispatcher.Invoke(new Action(delegate
                        {
                            IGGlobals.listAccounts.Clear();
                        }));

                    for (int noRow = 0; noRow < ds.Tables[0].Rows.Count; noRow++)
                    {
                        this.Dispatcher.Invoke(new Action(delegate
                        {

                            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();
                            IGGlobals.listAccounts.Add(account);                            
                            accountUser = ds.Tables[0].Rows[noRow].ItemArray[0].ToString();
                            accountPass = ds.Tables[0].Rows[noRow].ItemArray[1].ToString();
                            proxyAddress = ds.Tables[0].Rows[noRow].ItemArray[2].ToString();
                            proxyPort = ds.Tables[0].Rows[noRow].ItemArray[3].ToString();
                            proxyUserName = ds.Tables[0].Rows[noRow].ItemArray[4].ToString();
                            proxyPassword = ds.Tables[0].Rows[noRow].ItemArray[5].ToString();
                            LogInStatus = ds.Tables[0].Rows[noRow].ItemArray[7].ToString();
                            FollowerCount = ds.Tables[0].Rows[noRow].ItemArray[9].ToString();
                            FollwingCount = ds.Tables[0].Rows[noRow].ItemArray[10].ToString();
                            path = ds.Tables[0].Rows[noRow].ItemArray[6].ToString();
                            Authorized = ds.Tables[0].Rows[noRow].ItemArray[11].ToString();
                            Post = ds.Tables[0].Rows[noRow].ItemArray[8].ToString();

                            InstagramUser objInstagramUser = new InstagramUser("", "", "", "");
                            objInstagramUser.username = accountUser;
                            objInstagramUser.password = accountPass;
                            objInstagramUser.proxyip = proxyAddress;
                            objInstagramUser.proxyport = proxyPort;
                            objInstagramUser.proxyusername = proxyUserName;
                            objInstagramUser.proxypassword = proxyPassword;
                            objInstagramUser.LogInStatus = LogInStatus;
                            objInstagramUser.FollowerCount = FollowerCount;
                            objInstagramUser.FollwingCount = FollwingCount;
                            objInstagramUser.Path = path;
                            objInstagramUser.Authorized = Authorized;
                            objInstagramUser.Post = Post;

                            try
                            {
                                GramDominator.ViewModule.AccountNotifyPropertyChanged objAccountNotifyPropertyChanged = new GramDominator.ViewModule.AccountNotifyPropertyChanged();

                                objAccountNotifyPropertyChanged.Username = accountUser;
                                objAccountNotifyPropertyChanged.Password = accountPass;
                                objAccountNotifyPropertyChanged.LoginStatus = LogInStatus;
                                objAccountNotifyPropertyChanged.FollowerCount = FollowerCount;
                                objAccountNotifyPropertyChanged.FollowingCount = FollwingCount;
                                objAccountNotifyPropertyChanged.ProxyAddress = proxyAddress;
                                objAccountNotifyPropertyChanged.ProxyPassword = proxyPassword;
                                objAccountNotifyPropertyChanged.ProxyPort = proxyPort;
                                objAccountNotifyPropertyChanged.ProxyUserName = proxyUserName;                                
                                objAccountNotifyPropertyChanged.Authorized = Authorized;
                                objAccountNotifyPropertyChanged.Post = Post;
                                objAccountNotifyPropertyChanged.Path = path;
                               

                                if (LogInStatus.Contains("Success"))
                                {
                                    objAccountNotifyPropertyChanged.LoginStatus = "Success";
                                    objAccountNotifyPropertyChanged.BackgroundColor = "Green";
                                    this.Dispatcher.Invoke(new Action(delegate
                                    {
                                        if (!AccountViewModel._listOfAccount.Contains(objAccountNotifyPropertyChanged))
                                        {
                                            AccountViewModel._listOfAccount.Add(objAccountNotifyPropertyChanged);
                                        }
                                    }));
                                    
                                }
                                else if (LogInStatus.Contains("Fail"))
                                {
                                    objAccountNotifyPropertyChanged.LoginStatus = "Fail";
                                    objAccountNotifyPropertyChanged.BackgroundColor = "Red";
                                    this.Dispatcher.Invoke(new Action(delegate
                                    {

                                        if (!AccountViewModel._listOfAccount.Contains(objAccountNotifyPropertyChanged))
                                        {
                                            AccountViewModel._listOfAccount.Add(objAccountNotifyPropertyChanged);
                                        }
                                    }));
                                }
                                else if (LogInStatus.Contains("Not"))
                                {
                                    objAccountNotifyPropertyChanged.LoginStatus = "Not Checked";
                                    objAccountNotifyPropertyChanged.BackgroundColor = "";
                                    this.Dispatcher.Invoke(new Action(delegate
                                    {

                                        if (!AccountViewModel._listOfAccount.Contains(objAccountNotifyPropertyChanged))
                                        {

                                            AccountViewModel._listOfAccount.Add(objAccountNotifyPropertyChanged);
                                        }
                                    }));
                                }
                            }
                            catch (Exception ex)
                            {

                            }

                            try
                            {

                               
                                    IGGlobals.loadedAccountsDictionary.Add(objInstagramUser.username, objInstagramUser);
                                
                                try
                                {
                                    this.Dispatcher.Invoke(new Action(delegate
                                    {
                                        grvAccounts_AccountCreator_AccountDetails.ItemsSource = AccountViewModel._listOfAccount;

                                    }));
                                }
                                catch { };
                            }
                            catch { };
                        }));

                    }
                    try
                    {
                        this.Dispatcher.Invoke(new Action(delegate
                        {
                            grvAccounts_AccountCreator_AccountDetails.ItemsSource = AccountViewModel._listOfAccount;

                        }));
                    }
                    catch { };

                    if (NoOfAccountLoading >= NoOfAccountLoaded)
                    {
                        GlobusLogHelper.log.Info("[ " + IGGlobals.listAccounts.Count + " Accounts Loaded ]");
                    }
                }
                else
                {
                    this.Dispatcher.Invoke(new Action(delegate
                    {
                        grvAccounts_AccountCreator_AccountDetails.ItemsSource = ds.Tables[0].DefaultView;

                    }));
                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [  No Accounts Loaded ]");
                }


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

        }
        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);
            }
        }
        public void  AccounLoad()
        {
             string accountUser = string.Empty;
             string accountPass = string.Empty;
             string proxyAddress = string.Empty;
             string proxyPort = string.Empty;
             string proxyUserName = string.Empty;
             string proxyPassword = string.Empty;
             string status = string.Empty;
            QueryExecuter QME = new QueryExecuter();
            DataSet ds = QME.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 { }
                IGGlobals.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();
                    IGGlobals.listAccounts.Add(account);
                  //  dv.AllowNew = false;
                    accountUser =ds.Tables[0].Rows[noRow].ItemArray[0].ToString();
                    accountPass =ds.Tables[0].Rows[noRow].ItemArray[1].ToString();
                    proxyAddress =ds.Tables[0].Rows[noRow].ItemArray[2].ToString();
                    proxyPort = ds.Tables[0].Rows[noRow].ItemArray[3].ToString();
                    proxyUserName=ds.Tables[0].Rows[noRow].ItemArray[4].ToString();
                    proxyPassword=ds.Tables[0].Rows[noRow].ItemArray[5].ToString();

                    InstagramUser objInstagramUser = new InstagramUser("","","","");
                    objInstagramUser.username = accountUser;
                    objInstagramUser.password = accountPass;
                    objInstagramUser.proxyip = proxyAddress;
                    objInstagramUser.proxyport = proxyPort;
                    objInstagramUser.proxyusername = proxyUserName;
                    objInstagramUser.proxypassword = proxyPassword;
                    try
                    {
                        IGGlobals.loadedAccountsDictionary.Add(objInstagramUser.username, objInstagramUser);
                        try
                        {
                            this.Dispatcher.Invoke(new Action(delegate
                            {
                                grvAccounts_AccountCreator_AccountDetails.ItemsSource = ds.Tables[0].DefaultView;

                            }));
                        }
                        catch { };
                    }
                    catch { };                  
                 
                }
                try
                {
                    this.Dispatcher.Invoke(new Action(delegate
                    {
                        grvAccounts_AccountCreator_AccountDetails.ItemsSource = ds.Tables[0].DefaultView;

                    }));
                }
                catch { };



                GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ " + IGGlobals.listAccounts.Count + " Accounts Loaded ]");
            }
            else
            {
                this.Dispatcher.Invoke(new Action(delegate
                {
                    grvAccounts_AccountCreator_AccountDetails.ItemsSource = ds.Tables[0].DefaultView;

                }));
                GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [  No Accounts Loaded ]");
            }
<<<<<<< HEAD

          
=======
<<<<<<< HEAD

          
=======
>>>>>>> 040a8d35fce59f25e2f75d75646c50226d83374f
>>>>>>> origin/master
        }