protected override void Dispose(bool disposing) { if (disposing) { db = null; cuentaDB = null; subcatdb = null; catdb = null; } base.Dispose(disposing); }
public MovimientosController(PruebaContext context, MovimientosRepository repository, IServiceProvider svcProvider, IConfiguration config, ILogger <MovimientosController> logger, IWebHostEnvironment env ) { Context = context; Repository = repository; serviceProvider = svcProvider; Configuration = config; Logger = logger; HostingEnv = env; }
private void ConsultarDatos() { var qry = MovimientosRepository.ObtenerMovimientosPorCuenta(IdCuenta, dtDesde.Value.Date, dtHasta.Value.Date).OrderByDescending(m => m.Fecha); dgvDatos.SetDataSource(qry); //dgvDatos.DataSource = qry.ToList(); dgvDatos.Columns[0].Visible = false; dgvDatos.Columns[6].Visible = false; _sortDirections = new SortOrder[dgvDatos.Columns.Count]; for (int i = 0; i < dgvDatos.Columns.Count; i++) { _sortDirections[i] = SortOrder.None; } }
public App(string fileName) { UserRepository.Inicializador(fileName); MovimientosRepository.Inicializador(fileName); InitializeComponent(); var Usuarios = UserRepository.GetInstancia.GetAllUsers(); if (Usuarios.Count > 0) { MainVewModel.GetInstance.ConfiguracionInicial(); MainPage = new NavigationPage(new MasterPage()); } else { MainVewModel.GetInstance.Registro = new RegistroViewModel(); MainPage = new NavigationPage(new Registro()); } }
private void btnNuevo_Click(object sender, EventArgs e) { using (var f = new frmEdición(IdCuenta)) { if (f.ShowDialog() == DialogResult.OK) { try { var mov = MovimientosRepository.Insertar(f.IdCuenta, f.Fecha, f.IdTransaccion, f.Importe); cbCuentas.SelectedValue = mov.IdCuenta; ConsultarDatos(); dgvDatos.SetRow(r => Convert.ToDecimal(r.Cells[0].Value) == mov.Id); } catch (Exception ex) { CustomMessageBox.ShowError("Error al intentar grabar los datos: \n" + ex.Message); } } } }
private void NuevaCompra() { using (var f = new frmEdicion()) { if (f.ShowDialog() == DialogResult.OK) { try { var compra = EComprasRepository.Insertar(f.IdProveedor, f.Fecha, f.ImporteTotal, f.Retirado, f.Pagado, f.IdUsuario); for (int i = 0; i <= Convert.ToInt32(f.dgvDetalles.Rows.Count - 1); i++) { EComprasDetallesRepository.Insertar(compra.Id, Convert.ToInt32(f.dgvDetalles.Rows[i].Cells[0].Value), Convert.ToInt16(f.dgvDetalles.Rows[i].Cells[3].Value), Convert.ToDecimal(f.dgvDetalles.Rows[i].Cells[4].Value), Convert.ToDecimal(f.dgvDetalles.Rows[i].Cells[5].Value)); } //if (Configuration.ImprimeVentas) ImprimirVenta(f, venta.Id); if (Configuration.CompraIncrementaStock) { for (int i = 0; i <= Convert.ToInt32(f.dgvDetalles.Rows.Count - 1); i++) { EArticulosRepository.IncrementarStockArticulo(Convert.ToInt32(f.dgvDetalles.Rows[i].Cells[0].Value), Convert.ToInt16(f.dgvDetalles.Rows[i].Cells[3].Value)); } } if (f.Pagado == 1) { MovimientosRepository.InsertarCompra(compra); } ConsultarDatos(); dgvDatos.SetRow(r => Convert.ToDecimal(r.Cells[0].Value) == compra.Id); } catch (Exception ex) { ShowError("Error al intentar grabar los datos: \n" + ex.Message); } } } }
private void btnEliminar_Click(object sender, EventArgs e) { int rowindex = dgvDatos.CurrentCell.RowIndex; var id = (decimal)dgvDatos.Rows[rowindex].Cells[0].Value; var m = MovimientosRepository.ObtenerMovimientoPorId(id); if (MessageBox.Show("¿Está seguro de que desea contrasentar el movimiento seleccionado?", "Contrasentar Movimiento", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { try { MovimientosRepository.Contrasentar(m.Id); ConsultarDatos(); dgvDatos.SetRow(r => Convert.ToDecimal(r.Cells[0].Value) == m.Id); } catch (Exception ex) { CustomMessageBox.ShowError(ex.Message); } } }
private void btnEditar_Click(object sender, EventArgs e) { int rowindex = dgvDatos.CurrentCell.RowIndex; var id = (decimal)dgvDatos.Rows[rowindex].Cells[0].Value; var m = MovimientosRepository.ObtenerMovimientoPorId(id); using (var f = new frmEdición(m)) { if (f.ShowDialog() == DialogResult.OK) { try { MovimientosRepository.Actualizar(m.Id, f.IdCuenta, f.Fecha, f.IdTransaccion, f.Importe); ConsultarDatos(); dgvDatos.SetRow(r => Convert.ToDecimal(r.Cells[0].Value) == m.Id); } catch (Exception ex) { CustomMessageBox.ShowError(ex.Message); } } } }
public MovimientosService(string connectionString) { conexion = new ConnectionManager(connectionString); repositorio = new MovimientosRepository(conexion); }