public GBGoldDeposit(Dictionary <string, string> args) : base(args) { try { DepositAmount = GetAttributeAsNullable <int>("DepositAmount", false, ConstrainAs.AuraId, null) ?? 0; KeepAmount = GetAttributeAsNullable <int>("KeepAmount", false, ConstrainAs.AuraId, null) ?? 0; LogMessage("debug", "Deposit " + DepositAmount.ToString()); LogMessage("debug", "Keep " + KeepAmount.ToString()); } catch (Exception except) { // Maintenance problems occur for a number of reasons. The primary two are... // * Changes were made to the behavior, and boundary conditions weren't properly tested. // * The Honorbuddy core was changed, and the behavior wasn't adjusted for the new changes. // In any case, we pinpoint the source of the problem area here, and hopefully it // can be quickly resolved. LogMessage("error", "BEHAVIOR MAINTENANCE PROBLEM: " + except.Message + "\nFROM HERE:\n" + except.StackTrace + "\n"); IsAttributeProblem = true; } }
public string UpdateDepositAmount(DepositAmount deposit) { int rowAffected = aDepositGateway.UpdateDepositAmount(deposit); if (rowAffected > 0) { return("Update Deposit Amount"); } return("Failed"); }
internal static AmountDeposited ToEvent(this DepositAmount command, BankAccount bankAccount) { return(new AmountDeposited { BankTransactionId = Guid.NewGuid().ToString(), Entity = bankAccount, Amount = command.Amount, BankAccountId = command.BankAccountId, Sender = command.Sender, Timestamp = DateTime.Now }); }
public async Task <HttpResponseMessage> PutDeposit([FromUri] string id, [FromUri] decimal amount, [FromUri] string sender) { var command = new DepositAmount { BankAccountId = id, Amount = amount, Sender = sender }; await mediator.Send(command); return(Request.CreateResponse(HttpStatusCode.OK)); }
public async Task Handle(DepositAmount message, CancellationToken cancellationToken) { Id = message.BankAccountId; depositAmountValidator.ValidateAndThrow(message); var @event = message.ToEvent(this); Apply(@event); await eventRepository.Save(@event); }
public IActionResult Deposit(DepositAmount depositAmount) { // set login user to true ViewBag.IsUserLoggedIn = true; // perform deposit and get updated balance var updateBalance = accountOperations.DepositByID(Convert.ToInt32(loggedinuserId), depositAmount.Amount); // pass updated balance to UI ViewBag.AccountBalance = updateBalance; ViewBag.SuccessfulTransfer = "Deposit Successful!"; // set account id ViewBag.AccountId = accountId; return(View()); }
public bool IsExistDeposit(DepositAmount deposit) { connection = new SqlConnection(connectionString); connection.Open(); query = "SELECT * FROM Deposit WHERE MemberId=@MemberId AND Date=@Date"; command = new SqlCommand(query, connection); command.Parameters.Clear(); command.Parameters.AddWithValue("MemberId", deposit.MemberId); command.Parameters.AddWithValue("Date", deposit.Date); reader = command.ExecuteReader(); bool rowAffected = reader.HasRows; reader.Close(); connection.Close(); return(rowAffected); }
public string SaveDeposit(DepositAmount deposit) { bool isExist = aDepositGateway.IsExistDeposit(deposit); if (isExist) { return("Alreasdy Added"); } int rowAffected = aDepositGateway.SaveDepositAmount(deposit); if (rowAffected > 0) { return("Save Deposit Amount"); } return("Failed to Save"); }
public int SaveDepositAmount(DepositAmount deposit) { try { connection = new SqlConnection(connectionString); connection.Open(); query = "insert into Deposit (MemberId,Date,Amount) values (@MemberId,@Date,@Amount)"; command = new SqlCommand(query, connection); command.Parameters.Clear(); command.Parameters.AddWithValue("MemberId", deposit.MemberId); command.Parameters.AddWithValue("Date", deposit.Date); command.Parameters.AddWithValue("Amount", deposit.Amount); return(command.ExecuteNonQuery()); } catch (Exception exception) { throw; } finally { connection.Close(); } }
public int UpdateDepositAmount(DepositAmount deposit) { try { connection = new SqlConnection(connectionString); connection.Open(); query = "UPDATE Deposit SET Amount=@Amount WHERE MemberId=@MemberId AND Date=@Date"; command = new SqlCommand(query, connection); command.Parameters.Clear(); command.Parameters.AddWithValue("MemberId", deposit.MemberId); command.Parameters.AddWithValue("Date", deposit.Date); command.Parameters.AddWithValue("Amount", deposit.Amount); return(command.ExecuteNonQuery()); } catch (Exception exception) { throw; } finally { connection.Close(); } }
private void saveDepositAmountButton_Click(object sender, EventArgs e) { DepositAmount deposit = new DepositAmount(); deposit.MemberId = (int)nameComboBox.SelectedValue; deposit.Date = Convert.ToDateTime(depositDateTimePicker.Text); deposit.Amount = Convert.ToInt32(amountTextBox.Text); if (saveDepositAmountButton.Text == "Save") { string message = aDepositManager.SaveDeposit(deposit); MessageBox.Show(message); } else { deposit.MemberId = Convert.ToInt32(HiddenIdLabel.Text); string message = aDepositManager.UpdateDepositAmount(deposit); MessageBox.Show(message); } GeMemberWithDepositList(); Reset(); }
private async void DepositCashImplementation(object o) { LoaderManager.Instance.ShowLoader(); var result = await Task.Run(() => { bool res = false; try { res = ClientManager.Instance.DepositToAccount(SelectedAccount.Id, Convert.ToDecimal(DepositAmount.Trim())); } catch (Exception e) { MessageBox.Show($"Operation failed.\nReason:{Environment.NewLine}{e.Message}"); return(false); } return(true); }); LoaderManager.Instance.HideLoader(); if (!result) { MessageBox.Show($"Transfer is unsuccessful.", "Denied", MessageBoxButton.OK, MessageBoxImage.Error ); } else { MessageBox.Show("Transaction has been done successfully!"); } DepositAmount = "0"; NavigationManager.Instance.Navigate(ViewType.Actions); }
public override string ToString() { return("Conta " + AccountNumber + ", Titular: " + AccountHolder + ", Saldo: R$ " + DepositAmount.ToString("F2", CultureInfo.InvariantCulture)); }