protected void BAgregarLabor_Click(object sender, EventArgs e) { if (reparacionVálida) { LaboresRequeridas labores = new LaboresRequeridas(); labores.Reparación = IDReparación; labores.Mecánico = int.Parse(TBCódigoMecánicoLabor.Text); labores.Labor = int.Parse(DDLLabores.SelectedValue); labores.Aprobada = CBConfirmarAutomático.Checked; consultaBll.RegistrarLaborRequerida(labores); Page.Response.Redirect(Page.Request.Url.ToString(), true); } }
public void ModificarLaborRequerida(LaboresRequeridas labor) { Database db = DatabaseFactory.CreateDatabase("Desarrollo"); string sqlCommand = "dbo.[modificar_labor_requerida]"; DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand); try { db.AddInParameter(dbCommand, "@INTlabor_requerida", DbType.Int32, Utilerías.ObtenerValor(labor.IdLaborRequerida)); db.AddInParameter(dbCommand, "@CHARaprobada", DbType.Boolean, Utilerías.ObtenerValor(labor.Aprobada)); db.AddOutParameter(dbCommand, "@nStatus", DbType.Int16, 2); db.AddOutParameter(dbCommand, "@strMessage", DbType.String, 250); DataTable dtResultado = db.ExecuteDataSet(dbCommand).Tables[0]; if (int.Parse(db.GetParameterValue(dbCommand, "@nStatus").ToString()) > 0) throw new Exception(db.GetParameterValue(dbCommand, "@strMessage").ToString()); } catch (Exception ex) { throw new Exception(ex.Message); } }
protected void BModificarLabor_Click(object sender, EventArgs e) { if (reparacionVálida) { int idLabor; if (int.TryParse(TBIDLabor.Text, out idLabor)) { LaboresRequeridas labor = new LaboresRequeridas(); labor.IdLaborRequerida = idLabor; labor.Aprobada = CBAprobarLabor.Checked; modBll.ModificarLaborRequerida(labor); Page.Response.Redirect(Page.Request.Url.ToString(), true); } } }
public void RegistrarLaborRequerida(LaboresRequeridas labor) { try { this.Registros.RegistrarLaborRequerida(labor); } catch (Exception ex) { throw new Exception(ex.Message); } }
// Funcion para registrar un repuesto en una reparacion public void RegistrarLaborRequerida(LaboresRequeridas labor) { Database db = DatabaseFactory.CreateDatabase("Desarrollo"); string sqlCommand = "dbo.[insertar_labores_requeridas]"; DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand); try { db.AddInParameter(dbCommand, "@INTreparacion", DbType.Int32, Utilerías.ObtenerValor(labor.Reparación)); db.AddInParameter(dbCommand, "@INTlabor", DbType.Int32, Utilerías.ObtenerValor(labor.Labor)); db.AddInParameter(dbCommand, "@INTmecanico", DbType.Int32, Utilerías.ObtenerValor(labor.Mecánico)); db.AddInParameter(dbCommand, "@CHARaprobada", DbType.Boolean, Utilerías.ObtenerValor(labor.Aprobada)); db.AddOutParameter(dbCommand, "@nStatus", DbType.Int16, 2); db.AddOutParameter(dbCommand, "@strMessage", DbType.String, 250); db.ExecuteNonQuery(dbCommand); if (int.Parse(db.GetParameterValue(dbCommand, "@nStatus").ToString()) > 0) throw new Exception(db.GetParameterValue(dbCommand, "@strMessage").ToString()); } catch (Exception ex) { throw new Exception(ex.Message); } }
public void ModificarLaborRequerida(LaboresRequeridas labor) { try { this.Modificar.ModificarLaborRequerida(labor); } catch (Exception ex) { throw new Exception(ex.Message); } }