コード例 #1
0
 public bool UpdateLibros(Libro displayP)
 {
     try
     {
         SqlLibro p = new SqlLibro(displayP);
         EnlaceLibreriaDataContext dc = new EnlaceLibreriaDataContext();
         dc.UpdateLibro(p.LibroID, p.EditorialID, p.NombreAutor, p.Genero, p.PrecioUnitario, p.Descricion);
     }
     catch (Exception ex)
     {
         errorMessage = "Update error, " + ex.Message;
         hasError     = true;
     }
     return(!hasError);
 }
コード例 #2
0
 public bool AddLibro(Libro displayP)
 {
     hasError = false;
     try
     {
         SqlLibro p = new SqlLibro(displayP);
         EnlaceLibreriaDataContext dc = new EnlaceLibreriaDataContext();
         int?newlibroID = 0;
         dc.AddLibro(p.EditorialID, p.NombreAutor, p.Genero, p.PrecioUnitario, p.Descricion, ref newlibroID);
         p.LibroID = (int)newlibroID;
         displayP.LibroAdded2DB(p);    //update corresponding Libro ProductId using SqlLibro
     }
     catch (Exception ex)
     {
         errorMessage = "Add error, " + ex.Message;
         hasError     = true;
     }
     return(!hasError);
 }