private void BTProceder_Click(object sender, EventArgs e) { if (SetItem()) { retirosMethods = new RetirosMethods(); StatusStrip o = this.TopLevelControl.Controls.Find("stStatus", true).FirstOrDefault() as StatusStrip; CuentasTarjetasModel cuentas = new CuentasTarjetasModel(); cuentas.Monto = this.m_monto; cuentas.NroCuenta = this.m_nrocuenta; cuentas.clave = this.m_clave; cuentas.doi = this.m_doi; cuentas.Usuario = o.Items[1].Text; cuentas.RowVersion = nroCuenta1.VersionCuenta; var a = retirosMethods.InsertaRetiro(cuentas); if (a.Equals("Transferido")) { MessageBox.Show("Retiro con exito"); Recibo recibo = new Recibo(); recibo.Show(); } else { MessageBox.Show("No se pudo generar el retiro: " + a); } } else { MessageBox.Show("Se encontró campos vacios"); } }
private void btnBuscar_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtNroCuenta.Text)) { return; } depositoMethods = new DepositoMethods(); datosCuenta = new BusquedaCuenta(); using (DepositosServiceClient retirosService = new DepositosServiceClient()) { datosCuenta = retirosService.ObtenerDatosCuenta(txtNroCuenta.Text); //datosCuenta = depositoMethods.ObtenerDatosCuenta(txtNroCuenta.Text); } if (datosCuenta != null) { epValidarCampos.SetError(txtNroCuenta, ""); cuentas = new CuentasTarjetasModel(); cuentas.NroCuenta = datosCuenta.NroCuenta; //cuentas.Monto = Convert.ToDecimal(monto1.TBMonto.Text); cuentas.moneda = datosCuenta.Moneda; idUsuario = Session.Turno.IdTurUsu; //cuentas.doi = txtDNI.Text; cuentas.Usuario = Session.UserName; if (cuentas.moneda == "Soles") { lblSimboloMoneda.Text = "S/"; } else if (cuentas.moneda == "Dolares") { lblSimboloMoneda.Text = "$"; } lblMoneda1.Text = datosCuenta.Moneda; lblTipoCuenta1.Text = datosCuenta.TipoCuenta; lblDOI1.Text = datosCuenta.Doi; lblPropietario1.Text = datosCuenta.Persona; lblEstado1.Text = datosCuenta.Estado; } else { lblMoneda1.Text = ""; lblTipoCuenta1.Text = ""; lblDOI1.Text = ""; lblPropietario1.Text = ""; lblEstado1.Text = ""; lblSimboloMoneda.Text = ""; MensajeAviso.Show(MessageType.ERROR, "El numero de cuenta ingresado no existe."); } }
public string TransferenciaBancaria(CuentasTarjetasModel cuentasTarjetasModel) { // List<RecaudosModel> EmpresaModellist = new List<RecaudosModel>(); string result = ""; try { /*@Monto Decimal(12,4), * @Clave int, * @NroCuenta int, * @NroCuentaDestino int, * @doi int*/ using (var connection = Util.ConnectionFactory.conexion()) { connection.Open(); SqlCommand command = connection.CreateCommand(); command.Parameters.AddWithValue("@Monto", cuentasTarjetasModel.Monto); command.Parameters.AddWithValue("@Clave", cuentasTarjetasModel.clave); command.Parameters.AddWithValue("@NroCuenta", cuentasTarjetasModel.NroCuenta); command.Parameters.AddWithValue("@NroCuentaDestino", cuentasTarjetasModel.NroCuentaDestino); command.Parameters.AddWithValue("@doi", cuentasTarjetasModel.doi); command.Parameters.AddWithValue("@Usuario", cuentasTarjetasModel.Usuario); command.Parameters.AddWithValue("@NroTarjeta", cuentasTarjetasModel.NroTarjeta); command.Parameters.AddWithValue("@ClaveTarjeta", cuentasTarjetasModel.ClaveTarjeta); command.Parameters.AddWithValue("@RowVersion", cuentasTarjetasModel.RowVersion); command.Parameters.AddWithValue("@RowVersionD", cuentasTarjetasModel.RowVersionD); command.CommandType = CommandType.StoredProcedure; command.CommandText = "TransferenciaInsert"; // result = command.ExecuteScalar().ToString(); object a = command.ExecuteScalar(); if (a != null) { result = (string)a; } else { result = "Transferido"; } } return(result); } catch (SqlException e) { result = e.Errors[0].Message.ToString(); return(result); } }
public string RetiroInsert(CuentasTarjetasModel cuentas) { string afectados; try { using (var connection = Util.ConnectionFactory.conexion()) { connection.Open(); SqlTransaction sqlTran = connection.BeginTransaction(); SqlCommand command = connection.CreateCommand(); command.Transaction = sqlTran; command.Parameters.AddWithValue("@Monto", cuentas.Monto); command.Parameters.AddWithValue("@NroCuenta", cuentas.NroCuenta); command.Parameters.AddWithValue("@Clave", cuentas.clave); command.Parameters.AddWithValue("@doi", cuentas.doi); command.Parameters.AddWithValue("@Usuario", cuentas.Usuario); command.Parameters.AddWithValue("@RowVer", cuentas.RowVersion); command.CommandType = CommandType.StoredProcedure; command.CommandText = "RetirosInsert"; object a = command.ExecuteScalar(); if (a != null) { afectados = (string)a; } else { afectados = "Transferido"; } // Commit the transaction. sqlTran.Commit(); connection.Close(); connection.Dispose(); return(afectados); } } catch (SqlException e) { afectados = e.Errors[0].Message.ToString(); return(afectados); } }
//RetiroInsert public Tuple <string, DateTime, int> InsertaRetiro(CuentasTarjetasModel cuenta, int idUsuario) { return(retirosManager.RetiroInsert(cuenta, idUsuario)); }
//RetiroInsert public string InsertaRetiro(CuentasTarjetasModel cuenta) { return(retirosManager.RetiroInsert(cuenta)); }
public Tuple <string, DateTime, int> RetiroInsert(CuentasTarjetasModel cuentas, int idUsuario) { string afectados; DateTime fechaRegistro; int nroTransaccion = 0; try { using (var connection = Util.ConnectionFactory.conexion()) { connection.Open(); SqlTransaction sqlTran = connection.BeginTransaction(); SqlCommand command = connection.CreateCommand(); command.Transaction = sqlTran; command.Parameters.AddWithValue("@Monto", cuentas.Monto); command.Parameters.AddWithValue("@Moneda", cuentas.moneda); command.Parameters.AddWithValue("@NroCuenta", cuentas.NroCuenta); command.Parameters.AddWithValue("@NroTarjeta", cuentas.NroTarjetaCorrecto); command.Parameters.AddWithValue("@IdTurnoUsuario", idUsuario); command.Parameters.AddWithValue("@Clave", cuentas.clave); command.Parameters.AddWithValue("@ValidarIntentos", cuentas.validarIntentos); command.Parameters.AddWithValue("@doi", cuentas.doi); command.Parameters.AddWithValue("@Usuario", cuentas.Usuario); command.Parameters.AddWithValue("@CambioMoneda", cuentas.CambioMoneda); //command.Parameters.AddWithValue("@RowVer", cuentas.RowVersion); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@FechaRetiro", SqlDbType.DateTime, 20).Direction = ParameterDirection.Output; command.Parameters.Add("@NroTransaccion", SqlDbType.Int, 20).Direction = ParameterDirection.Output; command.CommandText = "RetirosInsert"; object a = command.ExecuteScalar(); fechaRegistro = (DateTime)command.Parameters["@FechaRetiro"].Value; if (command.Parameters["@NroTransaccion"].Value != DBNull.Value) { nroTransaccion = Convert.ToInt32(command.Parameters["@NroTransaccion"].Value); } //nroTransaccion = Convert.ToInt32(command.Parameters["@NroTransaccion"].Value); if (a != null) { afectados = (string)a; } else { afectados = "Retirado"; } // Commit the transaction. sqlTran.Commit(); connection.Close(); connection.Dispose(); return(Tuple.Create(afectados, fechaRegistro, nroTransaccion)); } } catch (SqlException e) { afectados = e.Errors[0].Message.ToString(); fechaRegistro = DateTime.Now; nroTransaccion = 0; return(Tuple.Create(afectados, fechaRegistro, nroTransaccion)); } }
public Tuple <string, DateTime, int> InsertaDeposito(CuentasTarjetasModel cuenta, int idUsuario) { return(BLDepositos.InsertaDeposito(cuenta, idUsuario)); }
public string RealizarTransferencia(CuentasTarjetasModel cuentasTarjetasModel) { return(ADTransferenciasManager.TransferenciaBancaria(cuentasTarjetasModel)); }
private void BTProceder_Click(object sender, EventArgs e) { if (Session.Turno == null) { MensajeAviso.Show(MessageType.WARNING, "Ud. no puede hacer operaciones porque no tiene turno o su turno esta inactivo"); return; } if (SetItem()) { if (String.IsNullOrEmpty(txtNroCuenta.Text)) { MensajeAviso.Show(MessageType.WARNING, "Debe de buscar una cuenta indicando un Nro. de documento válido."); return; } retirosMethods = new RetirosMethods(); StatusStrip o = this.TopLevelControl.Controls.Find("stStatus", true).FirstOrDefault() as StatusStrip; cuentas = new CuentasTarjetasModel(); cuentas.Monto = Convert.ToDecimal(monto1.TBMonto.Text, CultureInfo.InvariantCulture) + 0.00M; montoLetras = ConvertirALetras(cuentas.Monto.ToString().ToLower()); cuentas.NroCuenta = txtNroCuenta.Text; //cuentas.NroCuenta = nroCuenta1.TBNroCuenta.Text; cuentas.validarIntentos = numeroIntentos; if (chbRetiroTarjeta.Checked == true) { cuentas.NroTarjetaCorrecto = txtNroTarjeta.Text; cuentas.clave = Convert.ToInt32(txtClave.Text); } else { cuentas.NroTarjetaCorrecto = ""; cuentas.clave = 0; } //tipoCuenta = nroCuenta1.TipoCuenta; cuentas.CambioMoneda = false; cuentas.doi = txtDOI.Text; //cuentas.doi = nroCuenta1.dni1.TBDni.Text; cuentas.Usuario = Session.UserName; cuentas.RowVersion = nroCuenta1.VersionCuenta; cuentas.moneda = lblMonedaCuenta.Text; //cuentas.moneda = nroCuenta1.Lbmoneda.Text; if (cuentas.moneda == "Soles") { simboloMoneda = "S/"; } else if (cuentas.moneda == "Dolares") { simboloMoneda = "$"; } if (Session.Turno != null) { idUsuario = Session.Turno.IdTurUsu; } else { idUsuario = 0; } if (panel1.Controls.Count == 1) { cuentas.moneda = cambioMoneda.tipoMoneda1.CboMoneda.Text; cuentas.CambioMoneda = true; } if (cuentas.moneda == "Soles") { if (cuentas.Monto <= Convert.ToDecimal(efectivoNetoRetiros.txtEfectivoSoles.Text)) { RealizarRetiro(); } else { MensajeAviso.Show(MessageType.WARNING, "No cuenta con suficiente dinero en caja para el retiro."); } } else if (cuentas.moneda == "Dolares") { if (cuentas.Monto <= Convert.ToDecimal(efectivoNetoRetiros.txtEfectivoDolares.Text)) { RealizarRetiro(); } else { MensajeAviso.Show(MessageType.WARNING, "No cuenta con suficiente dinero en caja para el retiro."); } } } else { return; } }
private bool SetItem() { CuentasTarjetasModel = new CuentasTarjetasModel(); bool flag = true; if (!string.IsNullOrEmpty(this.monto1.TBMonto.Text.Trim())) { CuentasTarjetasModel.Monto = Convert.ToDecimal(this.monto1.TBMonto.Text.Trim()); } else { flag = false; } if (!string.IsNullOrEmpty(this.nroCuenta1.TBNroCuenta.Text.Trim())) { CuentasTarjetasModel.NroCuenta = Convert.ToString(this.nroCuenta1.TBNroCuenta.Text.Trim()); } else { flag = false; } if (!string.IsNullOrEmpty(this.nroCuenta2.TBNroCuenta.Text.Trim())) { CuentasTarjetasModel.NroCuentaDestino = Convert.ToString(this.nroCuenta2.TBNroCuenta.Text.Trim()); } else { flag = false; } if (!string.IsNullOrEmpty(this.nroCuenta1.dni1.TBDni.Text.Trim())) { CuentasTarjetasModel.doi = Convert.ToInt32(this.nroCuenta1.dni1.TBDni.Text.Trim()); } else { flag = false; } if (!string.IsNullOrEmpty(clave1.TBClave.Text.Trim())) { CuentasTarjetasModel.clave = Convert.ToInt32(clave1.TBClave.Text.Trim()); } else { flag = false; } if (nroCuenta1.TBNroCuenta.Text.Equals(nroCuenta2.TBNroCuenta.Text)) { flag = false; } if (flag == false) { MessageBox.Show("Se encontro campos incorrectamente ingresados"); return(flag); } else { return(true); } }
public Tuple <string, DateTime, int> InsertaDeposito(CuentasTarjetasModel cuenta, int idUsuario) { return(depositoManager.DepositoInsert(cuenta, idUsuario)); }