Example #1
0
        private void checkingAccount_Click(object sender, EventArgs e)
        {
            TrelloAccountSettings accForTest = new TrelloAccountSettings();

            newToken           = new TrelloAccountToken();
            newToken.UserToken = tokenCheckingBox.Text.Trim();
            accForTest.Source  = Sources.Trello;
            accForTest.Tokens  = new List <TrelloAccountToken>();
            accForTest.Tokens.Add(newToken);

            IAccountSettings accOutput = new TrelloAccountSettings();

            if (SettingsManager.AccountSettingsTest(accForTest, out accOutput))
            {
                accForTest = (TrelloAccountSettings)accOutput;
                foreach (var token in accForTest.Tokens)
                {
                    trelloBoardsCB.Items.Add(token);
                    trelloBoardsCB.DisplayMember = "TokenName";
                }
            }
            else
            {
            }
        }
Example #2
0
        public TokenDTO ConvertToDAO(IAccountToken token)
        {
            TokenDTO           target       = new TokenDTO();
            TrelloAccountToken currentToken = (TrelloAccountToken)token;

            target.TokenName = currentToken.TokenName;
            target.TokenId   = currentToken.TokenId;
            List <TokenForSerialization> tokenList = new List <TokenForSerialization>();

            TokenForSerialization userName = new TokenForSerialization();

            userName.Key   = "UserToken";
            userName.Value = currentToken.UserToken;
            tokenList.Add(userName);

            TokenForSerialization dateTime = new TokenForSerialization();

            dateTime.Key   = "DateCreation";
            dateTime.Value = currentToken.DateCreation;
            tokenList.Add(dateTime);

            TokenForSerialization BoardID = new TokenForSerialization();

            BoardID.Key   = "BoardID";
            BoardID.Value = currentToken.BoardID;
            tokenList.Add(BoardID);

            target.Tokens = tokenList.ToArray();
            return(target);
        }
Example #3
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;
        }
Example #4
0
 private void trelloToken_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (trelloToken.SelectedItem != null)
     {
         TrelloAccountToken token = userTrelloFullAccount.Tokens.FirstOrDefault(x => x.TokenName == trelloToken.SelectedItem.ToString());
         if (token != null)
         {
             addingAccountGB.Hide();
             informationGroupBox.Location = new Point(9, 187);
             informationGroupBox.Visible  = true;
             infTokenName.Text            = token.TokenName;
             infTokenDateCreation.Text    = token.DateCreation;
             infTrelloUserToken.Text      = token.UserToken;
             infBoardIdTB.Text            = token.BoardID;
         }
     }
 }
Example #5
0
        public IAccountToken ConvertFromDAO(TokenDTO token)
        {
            TrelloAccountToken targetToken = new TrelloAccountToken();

            targetToken.TokenId   = token.TokenId;
            targetToken.TokenName = token.TokenName;
            if (token.Tokens.Length > 0)
            {
                targetToken.UserToken = (from tok in token.Tokens
                                         where tok.Key == "UserToken"
                                         select tok.Value).SingleOrDefault();

                targetToken.DateCreation = (from tok in token.Tokens
                                            where tok.Key == "DateCreation"
                                            select tok.Value).SingleOrDefault();
                targetToken.BoardID = (from tok in token.Tokens
                                       where tok.Key == "BoardID"
                                       select tok.Value).SingleOrDefault();
            }
            return(targetToken);
        }
        public IAccountSettings ConvertFromDAO(ServiceAccountDTO serviceAccount)
        {
            TrelloAccountSettings target = new TrelloAccountSettings();
            target.ID = serviceAccount.ServiceAccountId;
            target.Name = serviceAccount.ServiceAccountName;
            target.Source = serviceAccount.Source;
            target.MinUpdateTime = serviceAccount.MinUpdateTime;
            target.TestResult = serviceAccount.TestResult;
            target.AccountVersion = serviceAccount.AccountVersion;

            target.Tokens = new List<TrelloAccountToken>();

            if (serviceAccount.Tokens.Length > 0)
            {
                foreach (TokenDTO token in serviceAccount.Tokens)
                {
                    TrelloAccountToken targetToken = new TrelloAccountToken();
                    targetToken = (TrelloAccountToken)targetToken.ConvertFromDAO(token);
                    target.Tokens.Add(targetToken);
                }
            }
            return target;
        }
Example #7
0
        public IAccountSettings ConvertFromDAO(ServiceAccountDTO serviceAccount)
        {
            TrelloAccountSettings target = new TrelloAccountSettings();

            target.ID             = serviceAccount.ServiceAccountId;
            target.Name           = serviceAccount.ServiceAccountName;
            target.Source         = serviceAccount.Source;
            target.MinUpdateTime  = serviceAccount.MinUpdateTime;
            target.TestResult     = serviceAccount.TestResult;
            target.AccountVersion = serviceAccount.AccountVersion;

            target.Tokens = new List <TrelloAccountToken>();

            if (serviceAccount.Tokens.Length > 0)
            {
                foreach (TokenDTO token in serviceAccount.Tokens)
                {
                    TrelloAccountToken targetToken = new TrelloAccountToken();
                    targetToken = (TrelloAccountToken)targetToken.ConvertFromDAO(token);
                    target.Tokens.Add(targetToken);
                }
            }
            return(target);
        }
        public IAccountToken ConvertFromDAO(TokenDTO token)
        {
            TrelloAccountToken targetToken = new TrelloAccountToken();
            targetToken.TokenId = token.TokenId;
            targetToken.TokenName = token.TokenName;
            if (token.Tokens.Length > 0)
            {
                targetToken.UserToken = (from tok in token.Tokens
                                         where tok.Key == "UserToken"
                                         select tok.Value).SingleOrDefault();

                targetToken.DateCreation = (from tok in token.Tokens
                                         where tok.Key == "DateCreation"
                                         select tok.Value).SingleOrDefault();
                targetToken.BoardID = (from tok in token.Tokens
                                            where tok.Key == "BoardID"
                                            select tok.Value).SingleOrDefault();
            }
            return targetToken;
        }
        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 checkingAccount_Click(object sender, EventArgs e)
        {
            TrelloAccountSettings accForTest = new TrelloAccountSettings();
            newToken = new TrelloAccountToken();
            newToken.UserToken = tokenCheckingBox.Text.Trim();
            accForTest.Source = Sources.Trello;
            accForTest.Tokens =new List<TrelloAccountToken>();
            accForTest.Tokens.Add(newToken);

            IAccountSettings accOutput = new TrelloAccountSettings();
            if (SettingsManager.AccountSettingsTest(accForTest,out accOutput))
            {
                accForTest =(TrelloAccountSettings)accOutput;
                foreach (var token in accForTest.Tokens)
                {
                    trelloBoardsCB.Items.Add(token);
                    trelloBoardsCB.DisplayMember = "TokenName";
                }

            }
            else
            {

            }
        }