private void BtnRetirar_Click(object sender, EventArgs e) { // TODO: Validar identificacion dominicana. if (string.IsNullOrEmpty(txtIdentification.Text)) { MessageBox.Show("Identificacion no valida", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrEmpty(txtNoCuenta.Text)) { MessageBox.Show("Numero de cuenta de origen no valida.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrEmpty(txtMontoaRetirar.Text) || txtMontoaRetirar.Text.Trim() == "0") { MessageBox.Show("Monto no valido", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } decimal amount = Convert.ToDecimal(txtMontoaRetirar.Text); var transaction = new Transaction() { CasherId = Settings.LoggedUser.Id, OriginAccount = txtNoCuenta.Text, Identification = txtIdentification.Text, IdentificationType = radioIdentification.Checked ? IdentificationTypeEnum.Cedula : IdentificationTypeEnum.Passport, Amount = amount, TransactionType = TransactionTypeEnum.Retirement }; List <MCoin> coinsAdded = new List <MCoin>(); if (RemoveCoins(amount, ref coinsAdded)) { _cashService.Retirement(transaction, coinsAdded); var coins = string.Join(",", coinsAdded.Select(d => d.Value)); MessageBox.Show($"Monedas devueltas:\n{coins}"); FrmHome home = new FrmHome(); home.Show(); this.Hide(); } else { MessageBox.Show($"No se puede retirar esta cantidad."); } }
private void btnRetirar_Click(object sender, EventArgs e) { if (SelectedTransaction != null) { if (SelectedTransaction.TransactionType == TransactionTypeEnum.Deposit) { _cashService.Deposit(SelectedTransaction, null); } else { _cashService.Retirement(SelectedTransaction, null); } Init(); } }