public ServiceAccountDTO ConvertToDAO(IAccountSettings serviceAccount)
        {
            ServiceAccountDTO       target         = new ServiceAccountDTO();
            DatabaseAccountSettings currentAccount = (DatabaseAccountSettings)serviceAccount;

            target.ServiceAccountId   = currentAccount.ID;
            target.ServiceAccountName = currentAccount.Name;
            target.Source             = Sources.DataBase;
            target.MinUpdateTime      = target.MinUpdateTime;
            target.AccountVersion     = serviceAccount.AccountVersion;


            List <TokenDTO> tok = new List <TokenDTO>();

            if (currentAccount.Tokens != null)
            {
                foreach (DatabaseAccountToken token in currentAccount.Tokens)
                {
                    TokenDTO localtok = token.ConvertToDAO(token);
                    tok.Add(localtok);
                }
                target.Tokens = tok.ToArray();
            }
            return(target);
        }
예제 #2
0
 private void GetSelectedAccountAndFillTokensToControl()
 {
     if (cmbAcconts.SelectedItem != null)
     {
         IAccountSettings selectedAccount = userDBAccounts.FirstOrDefault(x => x.Name == cmbAcconts.SelectedItem.ToString());
         userDBFullAccount = (DatabaseAccountSettings)loggedUser.GetDetailsForAccount(selectedAccount.ID, selectedAccount.Owner);
         cmbTokens.Items.Clear();
         cmbTokens.Text      = String.Empty;
         numUpdateTime.Value = userDBFullAccount.MinUpdateTime;
         foreach (var item in userDBFullAccount.Tokens)
         {
             cmbTokens.Items.Add(item.TokenName);
         }
         btnChangeToken.Enabled = false;
         btnDeleteToken.Enabled = false;
     }
 }
예제 #3
0
        private void btnTestConStrChanged_Click(object sender, EventArgs e)
        {
            DatabaseAccountSettings accForTest = new DatabaseAccountSettings();

            accForTest.Tokens.Add(selectedToken);
            if (SettingsManager.AccountSettingsTest(accForTest))
            {
                label12.Text      = "Connected!";
                label12.ForeColor = Color.Green;
                label12.Show();
                btnGoToMappingTab.Show();
            }
            else
            {
                label12.Text      = "Error! Check settings.";
                label12.ForeColor = Color.Red;
                label12.Show();
            }
        }
예제 #4
0
        private void btnChekMappingChanged_Click(object sender, EventArgs e)
        {
            DatabaseAccountSettings accForTest = new DatabaseAccountSettings();

            selectedToken.Mapping = rtxtMapping.Text;
            accForTest.Tokens.Add(selectedToken);
            if (SettingsManager.AccountSettingsTest(accForTest))
            {
                label5.Text      = "Connected!";
                label5.ForeColor = Color.Green;
                label5.Show();
                btnSaveSettings.Show();
            }
            else
            {
                label5.Text      = "Error! Check settings.";
                label5.ForeColor = Color.Red;
                label5.Show();
            }
        }
        public IAccountSettings ConvertFromDAO(ServiceAccountDTO serviceAccount)
        {
            DatabaseAccountSettings target = new DatabaseAccountSettings();

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


            if (serviceAccount.Tokens.Length > 0)
            {
                foreach (TokenDTO token in serviceAccount.Tokens)
                {
                    DatabaseAccountToken targetToken = new DatabaseAccountToken();
                    targetToken = (DatabaseAccountToken)targetToken.ConvertFromDAO(token);
                    target.Tokens.Add(targetToken);
                }
            }
            return(target);
        }
예제 #6
0
 private void cmbSharedAccounts_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cmbSharedAccounts.SelectedItem != null)
     {
         cmbAcconts.SelectedItem = null;
         IAccountSettings selectedAccount = sharedUserDBAccounts.FirstOrDefault(x => x.Name == cmbSharedAccounts.SelectedItem.ToString());
         userDBFullAccount      = (DatabaseAccountSettings)loggedUser.GetDetailsForAccount(selectedAccount.ID, selectedAccount.Owner);
         cmbTokens.Text         = String.Empty;
         btnAddToken.Enabled    = false;
         btnDeleteToken.Enabled = false;
         btnChangeToken.Enabled = false;
         if (userDBFullAccount != null)
         {
             cmbTokens.Items.Clear();
             foreach (var item in userDBFullAccount.Tokens)
             {
                 cmbTokens.Items.Add(item.TokenName);
             }
             btnDeleteAccount.Enabled = true;
         }
         btnShareAccount.Enabled = false;
         ClearAllForm();
     }
 }
예제 #7
0
 private void btnEddNewConfigAccountForDB_Click(object sender, EventArgs e)
 {
     panelNewAccount.Show();
     groupBoxTokens.Enabled = false;
     newAccountSetting      = new DatabaseAccountSettings();
 }