private void dgvCIUDADES_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (dgvCIUDADES.CurrentRow == null) { MessageBox.Show("Debe seleccionar una ciudad"); return; } oCLASE = (MODELO.Clase)dgvCIUDADES.CurrentRow.DataBoundItem; this.DialogResult = DialogResult.OK; }
private void btnLUPAclase_Click(object sender, EventArgs e) { MATERIALES.Clase frm = new MATERIALES.Clase("Buscar"); DialogResult dr = frm.ShowDialog(); if (dr == DialogResult.OK) { oCLASE = frm.ClaseSelect; txtCLASE.Text = oCLASE.NOMBRE; //cmbPROVEEDOR.SelectedItem = oPROVEEDOR; } }
private void btnCONSULTAR_Click(object sender, EventArgs e) { if (dgvCIUDADES.CurrentRow == null) { MessageBox.Show("Debe seleccionar una clase"); return; } MODELO.Clase oClase = (MODELO.Clase)dgvCIUDADES.CurrentRow.DataBoundItem; MATERIALES.CLASE1 frm = new MATERIALES.CLASE1(oClase, "C"); DialogResult dr = frm.ShowDialog(); if (dr == DialogResult.OK) { ARMO_GRILLA(); } }
private void btnELIMINAR_Click(object sender, EventArgs e) { if (dgvCIUDADES.CurrentRow == null) { MessageBox.Show("Debe seleccionar una clase"); return; } MODELO.Clase oClase = (MODELO.Clase)dgvCIUDADES.CurrentRow.DataBoundItem; DialogResult dr = MessageBox.Show("¿Confirma que desea eliminar " + oClase.NOMBRE + "?", "CONFIRMA", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { cClase.eliminarClase(oClase); ARMO_GRILLA(); } }
public CLASE1(MODELO.Clase unaClase, string unaaccion) { InitializeComponent(); cClase = CONTROLADORA.cClase.obtener_instancia(); oClase = unaClase; accion = unaaccion; if (accion != "A") { txtNOMBRE.Text = oClase.NOMBRE; if (accion == "C") { txtNOMBRE.Enabled = false; } } }
private void btnGuardarClase_Click(object sender, EventArgs e) { MODELO.Clase oClase = (MODELO.Clase)bdsClases.Current; //validaciones if (validacionesClases(oClase)) { if (accionClase == "EDITA") { oClase.Codigo = txtCodigoClase.Text; oClase.Descripcion = txtDescripcionClase.Text; oClase.PrecioHora = Convert.ToDecimal(txtPrecioHoraClase.Text); oClase.PrecioMediaEstadia = Convert.ToDecimal(txtPrecio12hsClase.Text); oClase.PrecioEstadia = Convert.ToDecimal(txtPrecio24hsClase.Text); oClase.TiempoCambioEstadia = Convert.ToInt32(txtCambioEstadiaClase.Text); oClase.MinutosTolerancia = Convert.ToInt32(txtToleranciaClase.Text); CONTROLADORA.ControladoraClases.ModificarClase(oClase); btnCancelarClase_Click(null, null); bdsClases.Clear(); bdsClases.DataSource = CONTROLADORA.ControladoraClases.ListarClases(); cboxClase.SelectedItem = oClase; } if (accionClase == "NUEVA") { MODELO.Clase newClase = new MODELO.Clase(); newClase.Activo = true; newClase.Codigo = txtCodigoClase.Text; newClase.Descripcion = txtDescripcionClase.Text; newClase.PrecioHora = Convert.ToDecimal(txtPrecioHoraClase.Text); newClase.PrecioMediaEstadia = Convert.ToDecimal(txtPrecio12hsClase.Text); newClase.PrecioEstadia = Convert.ToDecimal(txtPrecio24hsClase.Text); newClase.TiempoCambioEstadia = Convert.ToInt32(txtCambioEstadiaClase.Text); newClase.MinutosTolerancia = Convert.ToInt32(txtToleranciaClase.Text); CONTROLADORA.ControladoraClases.AgregarClase(newClase); btnCancelarClase_Click(null, null); bdsClases.Clear(); bdsClases.DataSource = CONTROLADORA.ControladoraClases.ListarClases(); cboxClase.SelectedItem = newClase; } } }
public void modificarClase(MODELO.Clase oClase) { oMODELO_SEGURIDAD.Entry(oClase).State = System.Data.Entity.EntityState.Modified; oMODELO_SEGURIDAD.SaveChanges(); }
public void eliminarClase(MODELO.Clase oClase) { oMODELO_SEGURIDAD.CLASES.Remove(oClase); oMODELO_SEGURIDAD.SaveChanges(); }
public void agregarClase(MODELO.Clase oClase) { oMODELO_SEGURIDAD.CLASES.Add(oClase); oMODELO_SEGURIDAD.SaveChanges(); }