コード例 #1
0
ファイル: frmMain.cs プロジェクト: prog-moh/twtboard
        public void AssignGroupsToAccounts()
        {
            try
            {
                int CountPerGroup = 0;
                int counter = 0;
                int listCounter = 0;
                if (!string.IsNullOrEmpty(txtAccountPerGroup.Text) && NumberHelper.ValidateNumber(txtAccountPerGroup.Text))
                {
                    CountPerGroup = Convert.ToInt32(txtAccountPerGroup.Text);
                }

                if (TweetAccountContainer.dictionary_TweetAccount.Count > 0)
                {
                    foreach (KeyValuePair<string, TweetAccountManager> item in TweetAccountContainer.dictionary_TweetAccount)
                    {
                        if (listCounter <= lstGroupNames.Count-1)
                        {
                            if (counter < CountPerGroup)
                            {

                            }
                            else
                            {
                                counter = 0;
                                listCounter++;
                                if (listCounter == lstGroupNames.Count)
                                {
                                    break;
                                }
                            }

                            string GroupName = string.Empty;
                            GroupName = lstGroupNames[listCounter];
                            clsDBQueryManager Db = new clsDBQueryManager();
                            Db.InsertAccountGroupName(item.Key, GroupName);
                            counter++;
                        }
                    }
                }
                else
                {
                    AddToLog_Checker("Please Upload Accounts To Assign Accounts");
                }

                AddToLog_Checker("Finished Adding Groups To Accounts.");
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> AssignGroupsToAccounts() --> " + ex.Message, Globals.Path_AccountCheckerErroLog);
                GlobusFileHelper.AppendStringToTextfileNewLine("Error --> AssignGroupsToAccounts() --> " + ex.Message, Globals.Path_TwtErrorLogs);
            }
        }
コード例 #2
0
ファイル: frmMain_NewUI.cs プロジェクト: ahmetDostr/twtboard
        public void AssignGroupsToAccounts()
        {
            try
            {
                Lst_AssignGroupThreads.Add(Thread.CurrentThread);
                AssignGroupThreadStart = true;
                Thread.CurrentThread.IsBackground = true;
            }
            catch { };

            try
            {
                int CountPerGroup = 0;
                int counter = 0;
                int listCounter = 0;
                bool IscounterPerGroup = true;
                txtAccountPerGroup.Invoke(new MethodInvoker(delegate
                {
                    if (!string.IsNullOrEmpty(txtAccountPerGroup.Text) && NumberHelper.ValidateNumber(txtAccountPerGroup.Text))
                    {
                        CountPerGroup = Convert.ToInt32(txtAccountPerGroup.Text);
                    }
                    else
                    {
                        IscounterPerGroup = false;
                    }
                }));

                if (IscounterPerGroup)
                {
                    if (TweetAccountContainer.dictionary_TweetAccount.Count > 0)
                    {
                        foreach (KeyValuePair<string, TweetAccountManager> item in TweetAccountContainer.dictionary_TweetAccount)
                        {
                            if (listCounter <= lstGroupNames.Count - 1)
                            {
                                if (counter < CountPerGroup)
                                {

                                }
                                else
                                {
                                    counter = 0;
                                    listCounter++;
                                    if (listCounter == lstGroupNames.Count)
                                    {
                                        break;
                                    }
                                }

                                string GroupName = string.Empty;
                                GroupName = lstGroupNames[listCounter];
                                clsDBQueryManager Db = new clsDBQueryManager();
                                Db.InsertAccountGroupName(item.Key, GroupName);
                                try
                                {
                                    GlobusFileHelper.AppendStringToTextfileNewLine(item.Key + " , " + GroupName, Globals.path_Group_Name);
                                }
                                catch { };
                                counter++;
                            }
                        }
                    }
                    else
                    {
                        AddToLog_Checker("[ " + DateTime.Now + " ] => [ Please Upload Accounts To Assign Accounts ]");
                    }
                }
                else
                {
                    MessageBox.Show("Please enter valid number in assign accounts per group.");
                    AddToLog_Checker("[ " + DateTime.Now + " ] => [ Please enter valid number in assign accounts per group. ]");
                    return;
                }

                AddToLog_Checker("[ " + DateTime.Now + " ] => [ Finished Adding Groups To Accounts ]");
                AddToLog_Checker("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                AddToLog_Checker("-----------------------------------------------------------------------------------------------------------------------");
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> AssignGroupsToAccounts() --> " + ex.Message, Globals.Path_AccountCheckerErroLog);
                GlobusFileHelper.AppendStringToTextfileNewLine("Error --> AssignGroupsToAccounts() --> " + ex.Message, Globals.Path_TwtErrorLogs);
            }
        }