コード例 #1
0
ファイル: BDOperations.cs プロジェクト: serpiente/vacapp
 /*
  * Add a cow to local database
  */
 public static void AddCow(Cow cowJSON)
 {
     using (CowDataContext context = new CowDataContext(CowDataContext.DBConnectionString))
     {
         try
         {
             cowDB cow = new cowDB();
             cow.nv = cowJSON.nv;
             cow.nombre = cowJSON.nombre;
             cow.dias_lac = cowJSON.dias_lac;
             cow.hato = cowJSON.hato;
             cow.loc = cowJSON.loc;
             cow.lts_dia = cowJSON.lts_dia;
             cow.partos = cowJSON.partos;
             cow.ultimo_parto = cowJSON.ultimo_parto;
             cow.primer_servicio = cowJSON.primer_servicio;
             System.Diagnostics.Debug.WriteLine("agregando");
             context.cows.InsertOnSubmit(cow);
             context.SubmitChanges();
         }
         catch (Exception e)
         {
             System.Diagnostics.Debug.WriteLine(e);
         }
     }
 }
コード例 #2
0
ファイル: BDOperations.cs プロジェクト: serpiente/vacapp
 public static void deleteAllCows()
 {
     using (CowDataContext context = new CowDataContext(CowDataContext.DBConnectionString))
     {
         IQueryable<cowDB> entityQuery = from c in context.cows select c;
         IList<cowDB> entityToDelete = entityQuery.ToList();
         context.cows.DeleteAllOnSubmit(entityToDelete);
         context.SubmitChanges();
     }
 }