public String SyncUsers() { string selectQuery = "select * from arduino_db"; DataUser dataUser = new DataUser(); DataTable table = new DataTable(); MySqlDataAdapter adapter = new MySqlDataAdapter(selectQuery, connection); adapter.Fill(table); List <DataUser> usersTable = new List <DataUser>(); foreach (DataRow row in table.Rows) { usersTable.Add(new DataUser() { Id = Convert.ToInt16(row["id"]), Name = row["name"].ToString(), Pass = row["pass"].ToString() }); } return(ArduSerial.SerialJoinUsers("users", usersTable)); }
public String SyncProfiles() { string selectQuery = "select * from profiles"; DataProfile dataUser = new DataProfile(); DataTable table = new DataTable(); MySqlDataAdapter adapter = new MySqlDataAdapter(selectQuery, connection); adapter.Fill(table); List <DataProfile> profilesTable = new List <DataProfile>(); foreach (DataRow row in table.Rows) { profilesTable.Add(new DataProfile() { Id = Convert.ToInt16(row["id"]), Name = row["name"].ToString(), Delay = Convert.ToInt16(row["delay"]), HourStart = row["start"].ToString(), HourEnd = row["end"].ToString() }); } return(ArduSerial.SerialJoinProfiles("profiles", profilesTable)); }