public static bool Insertar(Paquete p) { bool retorno = false; try { command.CommandText = "insert into Paquetes values (@direccionEntrega, @trackingID, @alumno)"; command.Parameters.Clear(); command.Parameters.Add(new SqlParameter("direccionEntrega", p.DireccionEntrega)); command.Parameters.Add(new SqlParameter("trackingID", p.TrackingID)); command.Parameters.Add(new SqlParameter("alumno", "Joaquin Rojas")); connection.Open(); if (command.ExecuteNonQuery() == 1) { retorno = true; } } catch (Exception) { PaqueteDAO.ErrorDAO(); } finally { connection.Close(); } return(retorno); }
public void MockCicloDeVida() { while (this.Estado != EEstado.Entregado) { Thread.Sleep(4000); this.Estado++; this.InfomaEstado(this, null); } try { PaqueteDAO.Insertar(this); } catch (Exception ex) { throw new Exception("Error en metodo : MockCicloDeVida , clase : Paquetes ", ex); } }