예제 #1
0
        private void tokenSave_Click(object sender, EventArgs e)
        {
            newToken = new TrelloAccountToken();
            userTrelloFullAccount                = new TrelloAccountSettings();
            userTrelloFullAccount.Source         = Sources.Trello;
            userTrelloFullAccount.Name           = accountNameBox.Text;
            userTrelloFullAccount.Owner          = true;
            userTrelloFullAccount.MinUpdateTime  = (Int32)minimalTimeForUpdate.Value;
            userTrelloFullAccount.AccountVersion = 1;
            if (loggedUser.CreateNewAccount(userTrelloFullAccount))
            {
                List <IAccountSettings> userAllAccounts = loggedUser.GetAllUserAccounts();
                userTrelloAccounts = SettingsManager.GetAllUserAccountsInSource(userAllAccounts, Sources.Trello);
                var acc = userTrelloAccounts.Select(a => a).Where(accaunt => accaunt.Name == accountNameBox.Text).SingleOrDefault();

                userTrelloFullAccount        = (TrelloAccountSettings)acc;
                userTrelloFullAccount.Tokens = new List <TrelloAccountToken>();

                newToken.UserToken    = tokenCheckingBox.Text;
                newToken.DateCreation = DateTime.Today.ToString("d");
                TrelloAccountToken selectedBoard = (TrelloAccountToken)trelloBoardsCB.SelectedItem;
                newToken.TokenName = selectedBoard.TokenName;
                newToken.BoardID   = selectedBoard.BoardID;
                userTrelloFullAccount.Tokens.Add(newToken);
                if (SettingsManager.SaveOrUpdateAccount(userTrelloFullAccount))
                {
                    GetSelectedAccountAndFillTokensToControl();
                }
            }



            addingAccountGB.Visible = false;
        }
        // создание аккаунта
        private void AddAccountGBButton_Click(object sender, EventArgs e)
        {
            String newAccountName = NameNewAccountTextBox.Text.Trim();

            if (newAccountName != String.Empty)
            {
                if (CheckNewAccauntNameAlreadyExist(newAccountName))
                {
                    label10.Text      = "Name already exist. Plese enter new name";
                    label10.ForeColor = Color.Red;
                }
                else
                {
                    newGoogleSheetsAccountSettings.Name     = newAccountName;
                    newGoogleSheetsAccountSettings.Tokens   = new List <GoogleSheetsAccountToken>();
                    newGoogleSheetsAccountSettings.Template = new List <GoogleSheetsAccountTemplate>();
                    if (loggedUser.CreateNewAccount(newGoogleSheetsAccountSettings))
                    {
                        NameNewAccountTextBox.Text = "";
                        RefreshSettings();
                        groupBox3.Visible = false;
                    }
                    else
                    {
                        label10.Text      = "Please try again";
                        label10.ForeColor = Color.Red;
                    }
                }
            }
            else
            {
                label10.Text      = "Name can not be empty string";
                label10.ForeColor = Color.Red;
            }
        }
예제 #3
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            String newNameAccount = textBox_NameNewAccountExcel.Text.Trim();

            label1.Text      = "Please enter new account name";
            label1.ForeColor = Color.Black;
            if (newNameAccount != String.Empty)
            {
                if (CheckNewAccountNameAlreadyExist(newNameAccount))
                {
                    label1.Text      = "Name already exist. Please enter new name";
                    label1.ForeColor = Color.Red;
                }
                else
                {
                    newAccountSetting.Name     = newNameAccount;
                    newAccountSetting.Template = new List <ExcelAccountTemplate>();
                    newAccountSetting.Tokens   = new List <ExcelAccountToken>();
                    if (loggedUser.CreateNewAccount(newAccountSetting))
                    {
                        RefreshSettingsAccountList();
                        panelNewAccount.Hide();
                    }
                    else
                    {
                        label1.Text      = "Please try again";
                        label1.ForeColor = Color.Red;
                    }
                }
            }
            else
            {
                label1.Text      = "Name can not be empty string";
                label1.ForeColor = Color.Red;
            }
        }
예제 #4
0
        private void btnSaveNewAccount_Click(object sender, EventArgs e)
        {
            String newAccountName = txtNewNameForAccount.Text.Trim();

            label6.Text      = "Please enter new account name";
            label6.ForeColor = Color.Black;
            if (newAccountName != String.Empty)
            {
                if (CheckNewAccauntNameAlreadyExist(newAccountName))
                {
                    label6.Text      = "Name already exist. Plese enter new name";
                    label6.ForeColor = Color.Red;
                }
                else
                {
                    newAccountSetting.Name           = newAccountName;
                    newAccountSetting.AccountVersion = 1;
                    if (loggedUser.CreateNewAccount(newAccountSetting))
                    {
                        RefreshSettingsAccountList();
                        panelNewAccount.Hide();
                        ClearAllForm();
                    }
                    else
                    {
                        label6.Text      = "Please try again";
                        label6.ForeColor = Color.Red;
                    }
                }
            }
            else
            {
                label6.Text      = "Name can not be empty string";
                label6.ForeColor = Color.Red;
            }
        }