private void FrmMateriales_Load(object sender, EventArgs e) { verificacionIdioma(); try { DgvMateriales.DataSource = MaterialesController.Cargar_Materiales(); } catch (Exception) { MessageBox.Show("Error al capturar datos"); } }
private void FrmMaterial_Load(object sender, EventArgs e) { verificacionIdioma(); try { cmbEstadoMaterial.DataSource = MaterialesController.Cargar_Estado(); cmbEstadoMaterial.DisplayMember = "Estado"; cmbEstadoMaterial.ValueMember = "idEstado_material"; cmbCategoria.DataSource = MaterialesController.Cargar_Categoria(); cmbCategoria.DisplayMember = "Categoria"; cmbCategoria.ValueMember = "idCategoria"; cmbProveedor.DataSource = MaterialesController.Cargar_Proveedor(); cmbProveedor.DisplayMember = "NIF"; cmbProveedor.ValueMember = "idProveedor"; } catch (Exception) { throw; } }
void EnvioDatos() { MaterialesController agregar = new MaterialesController(); agregar.NombreMaterial = txtNombreMaterial.Text; agregar.CodigoMaterial = txtCodigoMaterial.Text; agregar.PrecioUnitario = Convert.ToDouble(txtPrecioUnitario.Text); agregar.Descripcion = txtDescripcion.Text; agregar.MarcaMaterial = txtMarcaMaterial.Text; agregar.FechaIngreso = dtpIngreso.Text; agregar.Proveedor = Convert.ToInt16(cmbProveedor.SelectedValue); agregar.Categoria = Convert.ToInt16(cmbCategoria.SelectedValue); agregar.Estado = Convert.ToInt16(cmbEstadoMaterial.SelectedValue); if (agregar.EnviarDatos_Controller() == false) { MessageBox.Show("El usuario no puedo ser ingresado", "Advertencia", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Warning); } else { LimpiarCampos(); } }