Example #1
0
        private void BtnCancelar_Click(object sender, EventArgs e)
        {
            FrmHome abrir = new FrmHome();

            abrir.Show();
            this.Hide();
        }
Example #2
0
        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 BtnDepositar_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(txtNoCuentaDestino.Text))
            {
                MessageBox.Show("Numero de cuenta de destino no valida.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (string.IsNullOrEmpty(txtMontoaDepositar.Text) || txtMontoaDepositar.Text.Trim() == "0")
            {
                MessageBox.Show("Monto no valido", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            decimal amount = Convert.ToDecimal(txtMontoaDepositar.Text);

            var identificationType = radioIdentification.Checked ? IdentificationTypeEnum.Cedula : IdentificationTypeEnum.Passport;

            var transaction = new Transaction()
            {
                CasherId           = Settings.LoggedUser.Id,
                OriginAccount      = txtNoCuenta.Text,
                DestinyAccount     = txtNoCuentaDestino.Text,
                Identification     = txtIdentification.Text,
                IdentificationType = identificationType,
                Amount             = amount,
                TransactionType    = TransactionTypeEnum.Deposit
            };

            _cashService.Deposit(transaction, frmDepositDto);

            FrmHome home = new FrmHome();

            home.Show();
            this.Hide();
        }
Example #4
0
        private void Button1_Click(object sender, EventArgs e)
        {
            var loggedUser = _userRepository.GetAll().FirstOrDefault(u => u.UserName == txtUsername.Text &&
                                                                     u.Password == txtPassword.Text && u.IsEnabled);

            if (loggedUser == null)
            {
                MessageBox.Show(@"Usuario y/o contraseƱa invalidos.");
                return;
            }

            Settings.LoggedUser = loggedUser;

            FrmHome abrir = new FrmHome();

            abrir.Show();
            this.Hide();
        }
Example #5
0
        private void BtnValidar_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;
            }
            var identificationType = radioIdentification.Checked ? IdentificationTypeEnum.Cedula : IdentificationTypeEnum.Passport;

            if (_integrationLayer.Validate(txtIdentification.Text, identificationType))
            {
                if (_integrationLayer.Validate(txtNoCuenta.Text))
                {
                    string clientFullName = _integrationLayer.GetClient(txtNoCuenta.Text);

                    MessageBox.Show($"Cliente {clientFullName}, Portador de la cedula { txtIdentification.Text } y de numero de cuenta { txtNoCuenta.Text } es valido!", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    FrmHome abrir = new FrmHome();
                    abrir.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("El numero de cuenta es incorrecto", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                MessageBox.Show("El numero de cedula es incorrecto", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }