private void Btn_Crear_Click(object sender, EventArgs e) { var operaciones = new OperacionesProductos(); int EstadoRefri = 0; if (selectRefri.Text == "No") { EstadoRefri = 1; } else if (selectRefri.Text == "Si") { EstadoRefri = 2; } var miProducto = new Productos { Nombre = txtNombre.Text, Precio = double.Parse(txtPrecio.Text), Id_marca = Convert.ToInt32(selectMarca.SelectedValue), Id_categoria = Convert.ToInt32(selectCategoria.SelectedValue), Refrigerado = EstadoRefri, TipoEmpaque = Convert.ToInt32(selectEmpaque.SelectedValue), Cantidad = double.Parse(txtCantidad.Text), Estado = 1, Fecha_vence = dateFechaVence.Value, Fecha_creo = DateTime.Now, }; operaciones.CrearProducto(miProducto); int idUser = FrmHome.IdUsuario; int idProdC = operaciones.IdProd; var operacinesLogs = new OperacionesLog(); var miLog = new Log { Id_usuario = idUser, Id_producto = idProdC, TipoOperacion = "Creación", Fecha = DateTime.Now }; operacinesLogs.RegistroLog(miLog); MessageBox.Show("El Producto " + txtNombre.Text + " fue creado exitosamente", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); txtNombre.Clear(); txtPrecio.Clear(); txtCantidad.Clear(); this.Close(); }
public void CargarLogs() { var getLog = new OperacionesLog(); var dsLogs = new DataSet(); dsLogs = getLog.ObtenerLogs(); if (dsLogs.Tables[0].Rows.Count != 0) { GvLogs.DataSource = dsLogs.Tables[0]; GvLogs.Refresh(); } else { MessageBox.Show("No existen Registros: ", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } }