// inserta el registro public void insertaRegistro(AttLogs log) { string sql = "insert into checadas (id_interno, fecha_hora, no_checador) values (@idIn, @fecha, @noCh)"; int rows = 0; using (var conn = this._conexion.getConexion()) { conn.Open(); string error = string.Empty; using (var cmd = new MySqlCommand()) { cmd.Connection = conn; // define parametros cmd.Parameters.AddWithValue("@idIn", log.enrolIdNumber); cmd.Parameters.AddWithValue("@noCh", log.noChecador); string fechaFormato = "yyyy-MM-dd HH:mm"; cmd.Parameters.AddWithValue("@fecha", log.fecha.ToString(fechaFormato)); string s = log.fecha.ToString(fechaFormato); ManejoSql res = Utilerias.EjecutaSQL(sql, ref rows, cmd); if (!res.ok) { throw new Exception(res.numErr + ": " + res.descErr); } } } }
public static void Main() { AttLogs attDev = new AttLogs(); if (attDev.DoConnect()) { attDev.GetLogData(); attDev.Disconnect(); } else { Console.WriteLine("Couldn't connect to the device!"); } }
public int Insert(AttLogs attLogs) { _currentDbContext.Entry(attLogs).State = EntityState.Added; _currentDbContext.SaveChanges(); return(attLogs.Id); }