/// <summary> /// Selects the Single object of MovimientosVentanillaModel table. /// </summary> public MovimientosVentanillaModel GetMovimientosVentanillaModel(int aID_Movimiento) { MovimientosVentanillaModel MovimientosVentanillaModel = null; try { using (var connection = Util.ConnectionFactory.conexion()) { connection.Open(); SqlCommand command = connection.CreateCommand(); command.Parameters.AddWithValue("@ID_Movimiento", aID_Movimiento); command.CommandType = CommandType.StoredProcedure; command.CommandText = "MovimientosVentanillaModelSelect"; SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { int ID_Movimiento = (int)(reader["ID_Movimiento"]); int ID_Cuenta = (int)(reader["ID_Cuenta"]); decimal Monto = (decimal)(reader["Monto"]); string Moneda = (string)(reader["Moneda"]); int ID_TurnoUsuario = (int)(reader["ID_TurnoUsuario"]); int ID_TipoMovimiento = (int)(reader["ID_TipoMovimiento"]); DateTime Fecha_Creacion = (DateTime)(reader["Fecha_Creacion"]); string Usuario_Creador = (string)(reader["Usuario_Creador"]); DateTime?Fecha_Modificacion = reader["Fecha_Modificacion"] as DateTime?; string Usuario_Modificador = (string)(reader["Usuario_Modificador"]); MovimientosVentanillaModel = new MovimientosVentanillaModel { Id_movimiento = ID_Movimiento, Id_cuenta = ID_Cuenta, Monto = Monto, Moneda = Moneda, Id_turnousuario = ID_TurnoUsuario, Id_tipomovimiento = ID_TipoMovimiento, Fecha_creacion = Fecha_Creacion, Usuario_creador = Usuario_Creador, Fecha_modificacion = Fecha_Modificacion, Usuario_modificador = Usuario_Modificador, }; } } } return(MovimientosVentanillaModel); } catch (Exception) { return(null); } }
private async void BTProceder_Click(object sender, EventArgs e) { if (session.Turno == null) { alert1.Show(MessageType.WARNING, "Ud. no puede hacer operaciones porque no tiene turno o su turno esta inactivo"); return; } string[] response = null; if (!ValidarQueHayanValores()) { return; } if (!string.IsNullOrEmpty(txtTotalSoles.TBMonto.Text)) { if (cmbTipoMov.SelectedValue.Equals("Egreso") && Convert.ToDecimal(txtTotalSoles.TBMonto.Text) > Convert.ToDecimal(efectivoNetoBalancin.txtEfectivoSoles.Text)) { alert1.Show(MessageType.WARNING, "El monto que desea enviar es superior a lo que actualmente posee"); return; } //CajaChicaMethods balancinMethods = new CajaChicaMethods(); MovimientosVentanillaModel balancin = new MovimientosVentanillaModel(); balancin.TipoMoneda.Id = 0; balancin.Monto = Convert.ToDecimal(txtTotalSoles.TBMonto.Text); balancin.Id_tipomovimiento = chkBodega.Checked == true ? 8 : 9; balancin.Id_turnousuario = session.Turno.IdTurUsu; balancin.Id_movimiento = chkBodega.Checked == false ? (int)cmbVentanillas.SelectedValue : 0; balancin.Usuario_creador = session.UserName; balancin.Usuario_modificador = cmbTipoMov.SelectedValue.Equals("Ingreso") ? "E" : "S"; using (BalancinClient balancinService = new BalancinClient()) { response = await balancinService.RegistrarBalancinAsync(balancin); } } if (!string.IsNullOrEmpty(txtTotalDolares.TBMonto.Text)) { if (cmbTipoMov.SelectedValue.Equals("Egreso") && Convert.ToDecimal(txtTotalDolares.TBMonto.Text) > Convert.ToDecimal(efectivoNetoBalancin.txtEfectivoDolares.Text)) { alert1.Show(MessageType.WARNING, "El monto que desea enviar es superior a lo que actualmente posee"); return; } //CajaChicaMethods balancinMethods = new CajaChicaMethods(); MovimientosVentanillaModel balancin = new MovimientosVentanillaModel(); balancin.TipoMoneda.Id = 1; balancin.Monto = Convert.ToDecimal(txtTotalDolares.TBMonto.Text); balancin.Id_tipomovimiento = chkBodega.Checked == true ? 8 : 9; balancin.Id_turnousuario = session.Turno.IdTurUsu; balancin.Id_movimiento = chkBodega.Checked == false ? (int)cmbVentanillas.SelectedValue : 0; balancin.Usuario_creador = session.UserName; balancin.Usuario_modificador = cmbTipoMov.SelectedValue.Equals("Ingreso") ? "E" : "S"; using (BalancinClient balancinSrv = new BalancinClient()) { response = await balancinSrv.RegistrarBalancinAsync(balancin); } } ResultadoBalancin(response); }
/// <summary> /// Updates a record to the MovimientosVentanillaModel table. /// returns True if value saved successfully else false /// Throw exception with message value EXISTS if the data is duplicate /// </summary> public bool Update(MovimientosVentanillaModel aMovimientosVentanillaModel) { try { using (var connection = Util.ConnectionFactory.conexion()) { connection.Open(); SqlTransaction sqlTran = connection.BeginTransaction(); SqlCommand command = connection.CreateCommand(); command.Transaction = sqlTran; command.Parameters.AddWithValue("@ID_Movimiento", aMovimientosVentanillaModel.Id_movimiento); command.Parameters.AddWithValue("@ID_Cuenta", aMovimientosVentanillaModel.Id_cuenta); command.Parameters.AddWithValue("@Monto", aMovimientosVentanillaModel.Monto); command.Parameters.AddWithValue("@Moneda", aMovimientosVentanillaModel.Moneda); command.Parameters.AddWithValue("@ID_TurnoUsuario", aMovimientosVentanillaModel.Id_turnousuario); command.Parameters.AddWithValue("@ID_TipoMovimiento", aMovimientosVentanillaModel.Id_tipomovimiento); command.Parameters.AddWithValue("@Fecha_Creacion", aMovimientosVentanillaModel.Fecha_creacion); command.Parameters.AddWithValue("@Usuario_Creador", aMovimientosVentanillaModel.Usuario_creador); command.Parameters.AddWithValue("@Fecha_Modificacion", aMovimientosVentanillaModel.Fecha_modificacion == null ? (object)DBNull.Value : aMovimientosVentanillaModel.Fecha_modificacion); command.Parameters.AddWithValue("@Usuario_Modificador", aMovimientosVentanillaModel.Usuario_modificador == null ? (object)DBNull.Value : aMovimientosVentanillaModel.Usuario_modificador); command.CommandType = CommandType.StoredProcedure; command.CommandText = "MovimientosVentanillaModelUpdate"; int afectados = command.ExecuteNonQuery(); // Commit the transaction. sqlTran.Commit(); connection.Close(); connection.Dispose(); if (afectados > 0) { return(true); } else { return(false); } } } catch (Exception) { return(false); } }
/// <summary> /// Saves a record to the Caja_ChicaModel table. /// returns True if value saved successfully else false /// Throw exception with message value EXISTS if the data is duplicate /// </summary> public string[] Insert(MovimientosVentanillaModel balancin) { try { using (var connection = Util.ConnectionFactory.conexion()) { connection.Open(); SqlCommand command = connection.CreateCommand(); command.Parameters.AddWithValue("@Moneda", balancin.TipoMoneda.Id); command.Parameters.AddWithValue("@Monto", balancin.Monto); command.Parameters.AddWithValue("@IdTurnoUsuario1", balancin.Id_turnousuario); command.Parameters.AddWithValue("@IdTurnoUsuario2", balancin.Id_movimiento); command.Parameters.AddWithValue("@TipoTransaccion", balancin.Usuario_modificador);//E รณ S command.Parameters.AddWithValue("@TipoMovimiento", balancin.Id_tipomovimiento); command.Parameters.AddWithValue("@UsuarioCreador", balancin.Usuario_creador); SqlParameter IdMensaje = new SqlParameter("@IdMensaje", SqlDbType.Int); IdMensaje.Direction = ParameterDirection.Output; SqlParameter Mensaje = new SqlParameter("@Mensaje", SqlDbType.VarChar, 400); Mensaje.Direction = ParameterDirection.Output; command.Parameters.Add(IdMensaje); command.Parameters.Add(Mensaje); command.CommandType = CommandType.StoredProcedure; command.CommandText = "InsertBalancin"; int afectados = 0; afectados = (int)command.ExecuteNonQuery(); //devuelve el identity creado string idMensaje = command.Parameters["@IdMensaje"].Value.ToString(); string mensaje = command.Parameters["@Mensaje"].Value.ToString(); connection.Close(); connection.Dispose(); return(new string[] { idMensaje, mensaje }); } } catch (Exception ex) { return(new string[] { "-1", ex.Message }); } }
public bool Editar(MovimientosVentanillaModel aMovimientoVentanilla) { return(ADMovimientoVentanillaManager.Update(aMovimientoVentanilla)); }
public bool Crear(MovimientosVentanillaModel aMovimientoVentanilla) { return(ADMovimientoVentanillaManager.Insert(aMovimientoVentanilla)); }
bool ITipoMovimientoService.TipoMovimiento_Editar(MovimientosVentanillaModel aMovimientoVentanilla) { return(BLTipoMovimiento.Editar(aMovimientoVentanilla)); }
public string[] RegistrarBalancin(MovimientosVentanillaModel balancin) { return(BLCajaChica.Crear(balancin)); }
public string[] Crear(MovimientosVentanillaModel balancin) { return(BLBalancin.Crear(balancin)); }
/// <summary> /// Saves a record to the caja chica table. /// returns True if value saved successfully else false /// Throw exception with message value EXISTS if the data is duplicate /// </summary> public string[] Crear(MovimientosVentanillaModel balancin) { return(ADCajaChicaManager.Insert(balancin)); }