public void Constructor() { // Empty constructor with ValueType. { var o = new EventArgs <int>(); Assert.AreEqual(default(int), o.Value); } // Empty constructor with ReferenceType. { var o = new EventArgs <AccountRow>(); Assert.AreEqual(default(AccountRow), o.Value); } // With assignment ValueType. { var expected = 6; var o = new EventArgs <int>(expected); Assert.AreEqual(expected, o.Value); } // With assignment ReferenceType. { var expected = new AccountRow(); var o = new EventArgs <AccountRow>(expected); Assert.AreEqual(expected, o.Value); } }
public async Task <ProcessVerificationResult> VerifyExternalCode(ClaimsIdentity identity, string email, string code) { if (string.IsNullOrWhiteSpace(code)) { throw new ArgumentNullException(nameof(code)); } var nameIdClaim = identity.Claims.First(x => x.Type == Constants.ClaimTypes.ExternalProviderUserId); var provider = nameIdClaim.Issuer; var providerUserId = nameIdClaim.Value; using (var db = _dbFactory()) { var verification = await db.Verifications.FirstOrDefaultAsync(f => f.Provider == provider && f.ProviderId == providerUserId && f.Email == email); if (verification == null || verification.Code != code) { _log.Information(LogStrings.VerificationCodeNotCorrect, code, email); return(ProcessVerificationResult.InvalidVerifyCode); } AccountRow account = null; var processResult = await ProcessVerification(email, provider, providerUserId, db, m => { account = db.Accounts.Where(f => f.MemberId == m.Id).FirstOrDefault(); if (account == null) { account = new AccountRow { Email = email, MemberId = m.Id, Created = DateTime.Now }; db.Accounts.Add(account); } account.FirstName = m.FirstName; account.LastName = m.LastName; }, a => { account = a; }); if (processResult != ProcessVerificationResult.Success) { return(processResult); } var login = new ExternalLoginRow { Account = account, Provider = provider, ProviderId = providerUserId, Created = DateTime.Now }; db.ExternalLogins.Add(login); db.Verifications.Remove(verification); _log.Information(LogStrings.AssociatingExternalLogin, provider, providerUserId, account.FirstName + " " + account.LastName); await db.SaveChangesAsync(); return(ProcessVerificationResult.Success); } }
///////////////////////// // Internal Events private void AccountDataTable_TableNewRow(object sender, System.Data.DataTableNewRowEventArgs e) { AccountRow accountRow = e.Row as AccountRow; accountRow.id = this.newID++; accountRow.name = "New Account"; accountRow.typeID = SpclAccountType.NULL; accountRow.catagory = SpclAccountCat.ACCOUNT; accountRow.closed = false; accountRow.creditDebit = LineCD.DEBIT; accountRow.envelopes = false; }
private void ValidateAccountRow(AccountRow account) { if (account is AccountRowEx && (account as AccountRowEx)._FxAccountRow != null) { return; } if (account is AccountTableRowEx && (account as AccountTableRowEx)._FxAccountRow != null) { return; } throw new ArgumentException("Only AccountRow obtained from the FxConnectProxy.ForexConnect.FxServiceProxy can be used.", "Account"); }
private void LogAccount(StringBuilder sb, AccountRow row) { if (row == null) { sb.Append("NULL"); } sb.AppendFormat("| Account: {0} ({1}) | Balance: {2:0.00} | Limit: {3} | Used margin: {4:0.00}", row.AccountName, row.AccountID, row.Balance, row.AmountLimit, row.UsedMargin); if (row is AccountTableRow) { var r = row as AccountTableRow; sb.AppendFormat(" Usable margin: {0:0.00} | Day PL: {1:0.00}", r.UsableMargin, r.DayPL); } }
public static async Task Run( [HttpTrigger(AuthorizationLevel.Function, "post", Route = "account"), ] HttpRequestMessage req, [Table("Account")] CloudTable cloudTable, ILogger log) { dynamic body = await req.Content.ReadAsStringAsync(); var account = JsonConvert.DeserializeObject <AccountEntity>(body as string); var accountRow = new AccountRow(account); log.LogInformation(message: $"SetAccount function processed a request with parameter '{account.Email}'."); var updateOperation = TableOperation.InsertOrReplace(accountRow); var result = await cloudTable.ExecuteAsync(updateOperation); }
public void ManualAssignment() { // Manual assignment ValueType. { var expected = 7; var o = new EventArgs <int>(); o.Value = expected; Assert.AreEqual(expected, o.Value); } // Manual assignment RefType. { var expected = new AccountRow(); var o = new EventArgs <AccountRow>(); o.Value = expected; Assert.AreEqual(expected, o.Value); } }
public AccountRow AddAccountRow(string AccountName, string SmtpServer, string SmtpSenderName, string SmtpSenderMail, int SmtpPort, bool UsePopBeforeSmtp, string PopServer, string PopUserId, string PopPassword, int PopPort, bool UseSmtpAuth) { AccountRow rowAccountRow = ((AccountRow)(this.NewRow())); object[] columnValuesArray = new object[] { AccountName, SmtpServer, SmtpSenderName, SmtpSenderMail, SmtpPort, UsePopBeforeSmtp, PopServer, PopUserId, PopPassword, PopPort, UseSmtpAuth }; rowAccountRow.ItemArray = columnValuesArray; this.Rows.Add(rowAccountRow); return(rowAccountRow); }
public int myImportAccount(string name, string type, byte catagory) { // Check to see if the account is already in the map and table. int id; if (name.StartsWith("[")) { name = name.Substring(1, name.Length - 2); } if (this.accountMap.TryGetValue(name, out id)) { return(id); } // else create a new account row. AccountRow newAccount = this.Account.NewAccountRow(); newAccount.name = name; newAccount.typeID = this.myImportAccountType(type); newAccount.catagory = catagory; newAccount.closed = false; newAccount.envelopes = false; // Assume false, decide later. if (type == "CCard" || type == "Oth L" || catagory == SpclAccountCat.INCOME) { newAccount.creditDebit = LineCD.CREDIT; } else { newAccount.creditDebit = LineCD.DEBIT; } this.Account.AddAccountRow(newAccount); this.accountMap.Add(name, newAccount.id); return(newAccount.id); }
private void buttonNextProgress_Click(object sender, EventArgs e) //next button action { if (listboxindex < 6) //if not to finalize { if (MessageBox.Show("Are you sure that you need to advance the progress?", "Please confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (listboxindex == 1) //to enter estimate { string value = ""; if (InputBox("Estimate Summary", "Please enter the summary of estimate:", ref value) == DialogResult.OK) { appToProgress.estimateSummary = value; if (value == "") { MessageBox.Show("Please enter the summary of estimate. Otherwise considered as not progressed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { string summary = value; dbprog.updateMany(new string[] { "estimateSummary", "progress" }, listViewInProgress.SelectedItems[0].Text, new string[] { summary, "Estimated" }); listboxindex++; draw(); } } } else { listboxindex++; draw(); } } } //create an account and add to 'account' database, create bill database for each user else if (listboxindex == 6) { if (MessageBox.Show("Are you sure that you need to advance the progress? This will create an account", "Please confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { int accountno; if (dbmap.hasEntry("account")) { accountno = int.Parse(dbmap.get("no", "account")); dbmap.update("no", "account", (accountno + 1).ToString()); } else { accountno = 1000000; dbmap.insert(new MapnoRow("account", 1000001)); } String[] row = dbprog.getRow(listViewInProgress.SelectedItems[0].Text); dbprog.delete(listViewInProgress.SelectedItems[0].Text); AccountRow accrow = new AccountRow(accountno, row[0], textBoxInProgressName.Text, row[2], row[3], row[4], row[5], row[6], row[7], textBoxInProgressAddress.Text, row[9], int.Parse(textBoxInProgressContact.Text), row[11], row[16], row[17], int.Parse(listViewInProgress.SelectedItems[0].Text)); dbacc.insert(accrow); dbbill.createBillingTable(accountno); string password = createRandomPassword(10); LoginRow logrow = new LoginRow(accountno.ToString(), password, 1); dblogin.insert(logrow); MailRow mrow = new MailRow(accountno, textBoxInProgressName.Text, textBoxInProgressAddress.Text, "Your username for the user account: " + accountno + ", password: "******"Assigned Account No (Username) is: " + accountno + "\nLogin Password is: " + password, "Account Number and Login Password", MessageBoxButtons.OK); clrprog(); } else { dbprog.update("progress", listViewInProgress.SelectedItems[0].Text, "Connection Established"); } } }
public AccountRowChangeEvent(AccountRow row, global::System.Data.DataRowAction action) { this.eventRow = row; this.eventAction = action; }
public static O2GAccountRow GetAccountRow(AccountRow account) { return(account == null ? null : (account is AccountRowEx ? (account as AccountRowEx)._FxAccountRow : (account is AccountTableRowEx ? (account as AccountTableRowEx)._FxAccountRow : null))); }
public void AddAccountRow(AccountRow row) { this.Rows.Add(row); }
public void RemoveAccountRow(AccountRow row) { this.Rows.Remove(row); }
private async Task <AuthenticateResult> UpdateAccountOnLogin(IAuthDbContext db, AccountRow account, ExternalIdentity externalIdentity) { if (account.Locked.HasValue) { _log.Warning(LogStrings.LockedAccountAttempt, account); return(new AuthenticateResult(Strings.AccountLocked)); } if (account.MemberId.HasValue) { var member = await _memberService.GetMember(account.MemberId.Value); if (member == null) { _log.Error(LogStrings.LinkedMemberNotFound, account); return(new AuthenticateResult(Strings.AccountLocked)); } if (member != null && (account.FirstName != member.FirstName || account.LastName != member.LastName || account.Email != member.Email)) { account.FirstName = member.FirstName; account.LastName = member.LastName; if (!string.IsNullOrWhiteSpace(member.Email)) { account.Email = member.Email; } } } account.LastLogin = DateTime.Now; account.Logins.Add(new LoginLogRow { AccountId = account.Id, Time = account.LastLogin.Value, ProviderId = externalIdentity?.ProviderId }); await db.SaveChangesAsync(); if (string.IsNullOrWhiteSpace(account.FirstName) || string.IsNullOrWhiteSpace(account.LastName)) { _log.Error(LogStrings.AccountHasNoName, account.Username); } return(externalIdentity == null ? new AuthenticateResult(account.Id.ToString(), account.FirstName + " " + account.LastName) : new AuthenticateResult(account.Id.ToString(), account.FirstName + " " + account.LastName, null, externalIdentity.Provider)); }
public TransactionRow AddTransactionRow(AccountRow parentAccountRowByAccountTransaction, System.DateTime TransactionDate, decimal TransactionAmount, int AccountType, int TransactionType, short AccountType1, short TransactionType1) { TransactionRow rowTransactionRow = ((TransactionRow)(this.NewRow())); rowTransactionRow.ItemArray = new object[] { null, parentAccountRowByAccountTransaction[0], TransactionDate, TransactionAmount, AccountType, TransactionType, AccountType1, TransactionType1}; this.Rows.Add(rowTransactionRow); return rowTransactionRow; }