private void btnTerminado_Click(object sender, EventArgs e) { controller.CorteCon con = new controller.CorteCon(); try { string message = "Desea marcar el proceso como terminado?"; const string caption = "Form Closing"; var result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); // If the no button was pressed ... if (result == DialogResult.Yes) { _corte.Estado = true; corteBL bl = new corteBL(); if (bl.AgregarActualizarCorte(_corte)) { MessageBox.Show("Laoperacion fue exitosa"); limpiar(); CargarDatosCorte(); btnTerminado.Visible = false; btneliminar.Visible = false; _corte = null; } } } catch (Exception) { throw; } }
private bool AgregarCorteCompleto(Prenda prenda) { bool resul = false; try { string message = "Desea agregar el corte?"; const string caption = "Form Closing"; var result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); // If the no button was pressed ... if (result == DialogResult.Yes) { int total = 0; foreach (Detalle item in _detallesPrenda) { total += item.Cantidad; } //agregar prenda PrendaBL blp = new PrendaBL(); short IdPrenda = blp.AgregarActualizarPreda(prenda); for (int i = 0; i < _detallesPrenda.Count; i++) { _detallesPrenda[i].IdPrenda = IdPrenda; detallesPrendaBL bld = new detallesPrendaBL(); if (bld.AgregarActualizarDetallePrenda(_detallesPrenda[i])) { } } corteBL blc = new corteBL(); _corte.IdPrenda = IdPrenda; return(blc.AgregarActualizarCorte(_corte)); } else { _corte = null; _detallesPrenda = null; _prenda = null; return(false); } } catch (Exception ex) { resul = false; } return(resul); }