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); }
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; } }
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(); } }
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); }
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(); } }
private void btnEddNewConfigAccountForDB_Click(object sender, EventArgs e) { panelNewAccount.Show(); groupBoxTokens.Enabled = false; newAccountSetting = new DatabaseAccountSettings(); }