Ejemplo n.º 1
0
 public static TPunto GetPuntoFromDr(SqlCeDataReader dr)
 {
     TPunto p = new TPunto();
     p.puntoId = dr.GetInt32(0);
     p.nombre = dr.GetString(1);
     p.edificioId = dr.GetInt32(2);
     p.tag = dr.GetString(3);
     p.cota = dr.GetString(4);
     p.cubiculo = dr.GetString(5);
     p.observaciones = dr.GetString(6);
     return p;
 }
Ejemplo n.º 2
0
 public async Task<string> SetPunto(string db, string pass, TPunto p)
 {
     if (p == null)
     {
         return "ERROR: No se ha paso un objeto";
     }
     else
     {
         try
         {
             SqlCeConnection conn = CntFCN50.TOpen(db, pass);
             CntFCN50.SetPunto(p, conn);
             CntFCN50.TClose(conn);
             return "OK";
         }
         catch (Exception ex)
         {
             return String.Format("ERROR: {0}", ex.Message);
         }
     }
 }
Ejemplo n.º 3
0
 public static void SetPunto(TPunto p, SqlCeConnection conn)
 {
     if (p == null) return;
     // comprobamos si existe el registro
     TPunto punto = GetTPunto(p.puntoId, conn);
     string sql = "";
     if (punto != null)
     {
         sql = @"UPDATE puntos SET nombre = '{1}', edificioId = {2}, tag = '{3}', cota = '{4}', cubiculo = '{5}', observaciones = '{6}'
                 WHERE puntoId = {0}";
     }
     else
     {
         sql = @"INSERT INTO puntos (puntoId, nombre, edificioId, tag, cota, cubiculo, observaciones)
                 VALUES({0},'{1}', {2}, '{3}','{4}','{5}','{6}')";
     }
     sql = String.Format(sql, p.puntoId, p.nombre, p.edificioId, p.tag, p.cota, p.cubiculo, p.observaciones);
     using (SqlCeCommand cmd = conn.CreateCommand())
     {
         cmd.CommandText = sql;
         int nrec = cmd.ExecuteNonQuery();
     }
 }