void BtnGuardar_Click(object sender, EventArgs e) { try { bool existeReceta = recetasBL.Existe(txtNombre.Text); Receta receta; if (existeReceta) { receta = recetasBL.Obtener(txtNombre.Text); SetearReceta(receta); recetasBL.Actualizar(receta); contexto.RegistrarEvento(Resources.RecetasForm_RecetaActualizada, receta.Nombre); } else { receta = new Receta(); SetearReceta(receta); recetasBL.Crear(receta); contexto.RegistrarEvento(Resources.RecetasForm_RecetaCreada, receta.Nombre); } CargarRecetas(); LimpiarFormulario(); } catch (Exception ex) { contexto.RegistrarError(ex); } }
void BtnGuardar_Click(object sender, EventArgs e) { try { bool existeProveedor = proveedoresBL.Existe(txtCUIT.Text); Proveedor proveedor; if (existeProveedor) { proveedor = proveedoresBL.ObtenerPorCUIT(txtCUIT.Text); SetearProveedor(proveedor); proveedoresBL.Actualizar(proveedor); contexto.RegistrarEvento(Resources.ProveedoresForm_ProveedorActualizado, proveedor.Nombre); } else { proveedor = new Proveedor(); SetearProveedor(proveedor); proveedoresBL.Crear(proveedor); contexto.RegistrarEvento(Resources.ProveedoresForm_ProveedorCreado, proveedor.Nombre); } CargarProveedores(); LimpiarFormulario(); } catch (Exception ex) { contexto.RegistrarError(ex); } }
void BtnGuardar_Click(object sender, EventArgs e) { try { bool existeUsuario = usuariosBL.Existe(txtUsuario.Text); Usuario usuario; if (existeUsuario) { usuario = usuariosBL.Obtener(txtUsuario.Text); SetearUsuario(usuario, esActualizacion: true); usuariosBL.Actualizar(usuario); contexto.RegistrarEvento(Resources.UsuariosForm_UsuarioActualizado, usuario.Nombre); } else { usuario = new Usuario(); SetearUsuario(usuario, esActualizacion: false); usuariosBL.Crear(usuario); contexto.RegistrarEvento(Resources.UsuariosForm_UsuarioCreado, usuario.Nombre); } CargarUsuarios(); LimpiarFormulario(); } catch (Exception ex) { contexto.RegistrarError(ex); } }
void BtnGuardar_Click(object sender, EventArgs e) { try { bool existeCliente = clientesBL.Existe(txtCUIT.Text); Cliente cliente; if (existeCliente) { cliente = clientesBL.ObtenerPorCUIT(txtCUIT.Text); SetearCliente(cliente); clientesBL.Actualizar(cliente); contexto.RegistrarEvento(Resources.ClientesForm_ClienteActualizado, cliente.Nombre); } else { cliente = new Cliente(); SetearCliente(cliente); clientesBL.Crear(cliente); contexto.RegistrarEvento(Resources.ClientesForm_ClienteCreado, cliente.Nombre); } CargarClientes(); LimpiarFormulario(); } catch (Exception ex) { contexto.RegistrarError(ex); } }
void BtnGuardar_Click(object sender, EventArgs e) { try { bool existeEmpleado = empleadosBL.Existe(txtCUIT.Text); Empleado empleado; if (existeEmpleado) { empleado = empleadosBL.Obtener(txtCUIT.Text); SetearEmpleado(empleado); empleadosBL.Actualizar(empleado); contexto.RegistrarEvento(Resources.EmpleadosForm_EmpleadoActualizado, empleado.Nombre); } else { empleado = new Empleado(); SetearEmpleado(empleado); empleadosBL.Crear(empleado); contexto.RegistrarEvento(Resources.EmpleadosForm_EmpleadoCreado, empleado.Nombre); } CargarEmpleados(); LimpiarFormulario(); } catch (Exception ex) { contexto.RegistrarError(ex); } }
void BtnIngresar_Click(object sender, EventArgs e) { try { string nombreUsuario = txtUsuario.Text; Usuario usuario = usuariosBL.Obtener(nombreUsuario); if (!modoReset && usuario.CambiarPassword) { lblNuevoPassword.Visible = true; txtNuevoPassword.Visible = true; txtNuevoPassword.Focus(); lblMensaje.Text = Resources.LoginForm_CambiarPassword; modoReset = true; return; } string password; if (modoReset) { string nuevoPassword = usuariosBL.CrearPasswordHash(txtNuevoPassword.Text); usuario.Password = nuevoPassword; usuario.CambiarPassword = false; usuariosBL.Actualizar(usuario); password = nuevoPassword; modoReset = false; contexto.RegistrarEvento(Resources.LoginForm_PasswordReseteado); } else { password = usuariosBL.CrearPasswordHash(txtPassword.Text); } bool autenticado = usuariosBL.Autenticar(nombreUsuario, password); if (autenticado) { contexto.RegistrarEvento(Resources.LoginForm_UsuarioAutenticado); DialogResult = DialogResult.OK; } else { contexto.RegistrarError(Resources.LoginForm_ErrorAutenticacion); } } catch (Exception ex) { contexto.RegistrarError(ex, Resources.LoginForm_ErrorAutenticacion); } }
void BtnGuardar_Click(object sender, EventArgs e) { try { OrdenCompra ordenCompra = ordenesCompraBL.Obtener(ordenCompraSeleccionada.ObtenerId()); EstadoOrdenCompra nuevoEstado = EstadoOrdenCompra.Generada; if (ordenCompra.Estado == EstadoOrdenCompra.Generada) { nuevoEstado = EstadoOrdenCompra.Aprobada; } else if (ordenCompra.Estado == EstadoOrdenCompra.Aprobada) { nuevoEstado = EstadoOrdenCompra.Realizada; } ordenCompra.Estado = nuevoEstado; ordenesCompraBL.Actualizar(ordenCompra); contexto.RegistrarEvento(Resources.OrdenesCompraForm_OrdenCompraActualizada, ordenCompra.OrdenVenta.Cliente.Nombre); if (nuevoEstado == EstadoOrdenCompra.Realizada) { CrearOrdenPago(); } CargarOrdenesCompra(); LimpiarFormulario(); } catch (Exception ex) { contexto.RegistrarError(ex); } }
void OrdenesVentaForm_Load(object sender, EventArgs e) { AcceptButton = btnGuardar; contexto = ContextoPresentacion.Instancia; localidadesBL = new LocalidadesBL(contexto.Negocio); clientesBL = new ClientesBL(contexto.Negocio, localidadesBL); ingredientesBL = new IngredientesBL(contexto.Negocio); precioIngredientesBL = new PreciosIngredientesBL(contexto.Negocio); recetasBL = new RecetasBL(contexto.Negocio, precioIngredientesBL); ordenesVentaBL = new OrdenesVentaBL(contexto.Negocio, recetasBL, clientesBL); facturasBL = new FacturasBL(contexto.Negocio, ordenesVentaBL); ordenesCompraBL = new OrdenesCompraBL(contexto.Negocio, ordenesVentaBL, ingredientesBL); btnGuardar.Click += BtnGuardar_Click; btnCalcularPrecio.Click += BtnCalcularPrecio_Click; grvPedidos.SelectionChanged += GrvPedidos_SelectionChanged; grvPedidos.CellEnter += GrvPedidos_CellEnter; CargarClientes(); CargarRecetas(); CargarOrdenesVenta(); LimpiarFormulario(); contexto.RegistrarEvento(Resources.OrdenesVentaForm_Ingreso); }
void BtnGuardar_Click(object sender, EventArgs e) { try { bool existeOrdenVenta = false; OrdenVenta ordenVenta; if (ordenVentaSeleccionada != null) { existeOrdenVenta = ordenesVentaBL.Existe(ordenVentaSeleccionada.ObtenerId()); } if (existeOrdenVenta) { ordenVenta = ordenesVentaBL.Obtener(ordenVentaSeleccionada.ObtenerId()); SetearOrdenVenta(ordenVenta); ordenesVentaBL.Actualizar(ordenVenta); contexto.RegistrarEvento(Resources.OrdenesVentaForm_OrdenVentaActualizada, ordenVenta.Cliente.Nombre); } else { ordenVenta = Crear(); ordenesVentaBL.Crear(ordenVenta); contexto.RegistrarEvento(Resources.OrdenesVentaForm_OrdenVentaCreada, ordenVenta.Cliente.Nombre); } if ((!existeOrdenVenta || !ordenVentaSeleccionada.Aprobada) && ordenVenta.Aprobada) { CrearFactura(); CrearOrdenCompra(); } CargarOrdenesVenta(); LimpiarFormulario(); } catch (Exception ex) { contexto.RegistrarError(ex); } }
void LoginForm_Load(object sender, EventArgs e) { AcceptButton = btnIngresar; contexto = ContextoPresentacion.Instancia; usuariosBL = new UsuariosBL(contexto.Negocio); lblNuevoPassword.Visible = false; txtNuevoPassword.Visible = false; btnIngresar.Click += BtnIngresar_Click; btnCancelar.Click += BtnCancelar_Click; LimpiarFormulario(); contexto.RegistrarEvento(Resources.LoginForm_Ingreso); }
void BitacoraForm_Load(object sender, EventArgs e) { AcceptButton = btnFiltrar; contexto = ContextoPresentacion.Instancia; usuariosBL = new UsuariosBL(ContextoNegocio.Instancia); bitacoraBL = new BitacoraBL(ContextoNegocio.Instancia, usuariosBL); btnFiltrar.Click += BtnFiltrar_Click; CargarTipos(); CargarUsuarios(); CargarBitacora(); LimpiarFormulario(); contexto.RegistrarEvento(Resources.BitacoraForm_Ingreso); }
void UsuariosForm_Load(object sender, EventArgs e) { AcceptButton = btnGuardar; contexto = ContextoPresentacion.Instancia; usuariosBL = new UsuariosBL(contexto.Negocio); btnGuardar.Click += BtnGuardar_Click; grvUsuarios.SelectionChanged += GrvUsuarios_SelectionChanged; grvUsuarios.CellEnter += GrvUsuarios_CellEnter; CargarPerfiles(); CargarUsuarios(); LimpiarFormulario(); contexto.RegistrarEvento(Resources.UsuariosForm_Ingreso); }
void RecetasForm_Load(object sender, EventArgs e) { AcceptButton = btnVer; contexto = ContextoPresentacion.Instancia; preciosIngredientesBL = new PreciosIngredientesBL(contexto.Negocio); recetasBL = new RecetasBL(contexto.Negocio, preciosIngredientesBL); btnGuardar.Click += BtnGuardar_Click; btnVer.Click += BtnVer_Click;; grvRecetas.SelectionChanged += GrvRecetas_SelectionChanged;; grvRecetas.CellEnter += GrvRecetas_CellEnter; CargarRecetas(); LimpiarFormulario(); contexto.RegistrarEvento(Resources.RecetasForm_Ingreso); }
void EmpleadosForm_Load(object sender, EventArgs e) { AcceptButton = btnGuardar; contexto = ContextoPresentacion.Instancia; localidadesBL = new LocalidadesBL(contexto.Negocio); empleadosBL = new EmpleadosBL(contexto.Negocio, localidadesBL); btnGuardar.Click += BtnGuardar_Click; grvEmpleados.SelectionChanged += GrvClientes_SelectionChanged; grvEmpleados.CellEnter += GrvClientes_CellEnter; cboProvincias.SelectedValueChanged += CboProvincias_SelectedValueChanged; CargarProvincias(); CargarEmpleados(); LimpiarFormulario(); contexto.RegistrarEvento(Resources.EmpleadosForm_Ingreso); }
void BtnCobrada_Click(object sender, EventArgs e) { try { Factura factura = facturasBL.Obtener(facturaSeleccionada.ObtenerId()); factura.Cobrada = true; facturasBL.Actualizar(factura); CargarFacturas(); LimpiarFormulario(); contexto.RegistrarEvento(Resources.FacturasForm_FacturaCobrada, factura.OrdenVenta.Cliente.Nombre); } catch (Exception ex) { contexto.RegistrarError(ex); } }
void PedidosForm_Load(object sender, EventArgs e) { AcceptButton = btnFiltrar; contexto = ContextoPresentacion.Instancia; localidadesBL = new LocalidadesBL(contexto.Negocio); clientesBL = new ClientesBL(contexto.Negocio, localidadesBL); precioIngredientesBL = new PreciosIngredientesBL(contexto.Negocio); recetasBL = new RecetasBL(contexto.Negocio, precioIngredientesBL); ordenesVentaBL = new OrdenesVentaBL(contexto.Negocio, recetasBL, clientesBL); btnFiltrar.Click += BtnFiltrar_Click; btnRecetas.Click += BtnRecetas_Click; CargarClientes(); CargarPedidos(); LimpiarFormulario(); contexto.RegistrarEvento(Resources.PedidosForm_Ingreso); }
void FacturasForm_Load(object sender, EventArgs e) { AcceptButton = btnCobrada; contexto = ContextoPresentacion.Instancia; localidadesBL = new LocalidadesBL(contexto.Negocio); clientesBL = new ClientesBL(contexto.Negocio, localidadesBL); precioIngredientesBL = new PreciosIngredientesBL(contexto.Negocio); recetasBL = new RecetasBL(contexto.Negocio, precioIngredientesBL); ordenesVentaBL = new OrdenesVentaBL(contexto.Negocio, recetasBL, clientesBL); facturasBL = new FacturasBL(contexto.Negocio, ordenesVentaBL); btnCobrada.Click += BtnCobrada_Click; grvFacturas.SelectionChanged += GrvFacturas_SelectionChanged; grvFacturas.CellEnter += GrvFacturas_CellEnter; CargarFacturas(); LimpiarFormulario(); contexto.RegistrarEvento(Resources.FacturasForm_Ingreso); }
void BtnGuardar_Click(object sender, EventArgs e) { try { Receta receta = recetasBL.Obtener(Receta.Nombre); IngredienteReceta ingredienteReceta = null; foreach (IngredienteReceta ingrediente in receta.Ingredientes) { if (ingrediente.Ingrediente.Nombre == txtIngrediente.Text) { ingredienteReceta = ingrediente; break; } } if (ingredienteReceta == null) { ingredienteReceta = new IngredienteReceta(); SetearIngrediente(ingredienteReceta); receta.Ingredientes.Add(ingredienteReceta); } else { SetearIngrediente(ingredienteReceta); } recetasBL.Actualizar(receta); CargarIngredientes(); LimpiarFormulario(); contexto.RegistrarEvento(Resources.IngredientesForm_RecetaActualizada, receta.Nombre); } catch (Exception ex) { contexto.RegistrarError(ex); } }
void BtnGuardar_Click(object sender, EventArgs e) { try { IEnumerable <ItemOrdenPagoPresentacion> itemsOrdenesPagoPresentacion = (IEnumerable <ItemOrdenPagoPresentacion>)grvItems.DataSource; OrdenPago ordenPago = ordenesPagoBL.Obtener(ordenPagoSeleccionada.ObtenerId()); foreach (ItemOrdenPago item in ordenPago.Items) { ItemOrdenPagoPresentacion itemOrdenPagoPresentacion = null; foreach (ItemOrdenPagoPresentacion itemPresentacion in itemsOrdenesPagoPresentacion) { if (itemPresentacion.Ingrediente == item.ItemOrdenCompra.Ingrediente.Nombre) { itemOrdenPagoPresentacion = itemPresentacion; break; } } if (itemOrdenPagoPresentacion != null) { item.Precio = decimal.Parse(itemOrdenPagoPresentacion.Precio); } } ordenPago.Pagada = chkPagada.Checked; ordenesPagoBL.Actualizar(ordenPago); CargarOrdenesPago(); LimpiarFormulario(); contexto.RegistrarEvento(Resources.OrdenesPagoForm_OrdenPagoActualizada, ordenPago.Proveedor.Nombre); } catch (Exception ex) { contexto.RegistrarError(ex); } }
void BtnGuardar_Click(object sender, EventArgs e) { try { Ingrediente ingrediente = ingredientesBL.Obtener(lblIngrediente.Text); PrecioIngrediente precioIngrediente = preciosIngredientesBL.Obtener(ingrediente); precioIngrediente.Precio = decimal.Parse(txtPrecio.Text); precioIngrediente.Cantidad = decimal.Parse(txtCantidad.Text); precioIngrediente.Unidad = (UnidadMedida)Enum.Parse(typeof(UnidadMedida), cboUnidad.SelectedItem.ToString()); preciosIngredientesBL.Actualizar(precioIngrediente); recetasBL.ActualizarRecetasSinPrecio(); CargarPrecios(); LimpiarFormulario(); contexto.RegistrarEvento(Resources.PreciosForm_ListaActualizada, ingrediente.Nombre); } catch (Exception ex) { contexto.RegistrarError(ex); } }