public static ZoneViewModel getZone(int idZone) { ZoneDAO pDAO = ZoneDAO.getZones(idZone); ZoneViewModel e = new ZoneViewModel(pDAO.idZonePrelevementDAO, pDAO.nomZonePrelevementDAO, pDAO.lat1DAO, pDAO.lat2DAO, pDAO.lat3DAO, pDAO.lat4DAO, pDAO.long1DAO, pDAO.long2DAO, pDAO.long3DAO, pDAO.long4DAO); return(e); }
public static void updateZone(ZoneDAO u) { string query = "UPDATE zoneprelevement set nom=\"" + u.nomZonePrelevementDAO + "\", lat1=\"" + u.lat1DAO + "\", lat2=\"" + u.lat2DAO + "\", lat3=\"" + u.lat3DAO + "\", lat4=\"" + u.lat4DAO + "\", long1=\"" + u.long1DAO + "\", long2=\"" + u.long2DAO + "\", long3=\"" + u.long3DAO + "\", long4=\"" + u.long4DAO + "\" where idZonePrelevement=" + u.idZonePrelevementDAO + ";"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.connection); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd); cmd.ExecuteNonQuery(); }
public static void insertZone(ZoneDAO u) { int id = getMaxIdZone() + 1; string query = "INSERT INTO zoneprelevement VALUES (\"" + id + "\",\"" + u.nomZonePrelevementDAO + "\",\"" + u.lat1DAO + "\",\"" + u.lat2DAO + "\",\"" + u.lat3DAO + "\",\"" + u.lat4DAO + "\",\"" + u.long1DAO + "\",\"" + u.long2DAO + "\",\"" + u.long3DAO + "\",\"" + u.long4DAO + "\");"; MySqlCommand cmd2 = new MySqlCommand(query, DALConnection.connection); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd2); cmd2.ExecuteNonQuery(); }
public static ObservableCollection <ZoneViewModel> listeZones() { ObservableCollection <ZoneDAO> lDAO = ZoneDAO.listeZones(); ObservableCollection <ZoneViewModel> l = new ObservableCollection <ZoneViewModel>(); foreach (ZoneDAO element in lDAO) { ZoneViewModel e = new ZoneViewModel(element.idZonePrelevementDAO, element.nomZonePrelevementDAO, element.lat1DAO, element.lat2DAO, element.lat3DAO, element.lat4DAO, element.long1DAO, element.long2DAO, element.long3DAO, element.long4DAO); l.Add(e); } return(l); }
public static ObservableCollection <ZoneDAO> selectZones() { ObservableCollection <ZoneDAO> l = new ObservableCollection <ZoneDAO>(); string query = "SELECT * FROM zoneprelevement;"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.connection); cmd.ExecuteNonQuery(); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { ZoneDAO u = new ZoneDAO(reader.GetInt32(0), reader.GetString(1), reader.GetDecimal(2), reader.GetDecimal(3), reader.GetDecimal(4), reader.GetDecimal(5), reader.GetDecimal(6), reader.GetDecimal(7), reader.GetDecimal(8), reader.GetDecimal(9)); l.Add(u); } reader.Close(); return(l); }
public static ZoneDAO getZone(int idZone) { string query = "SELECT * FROM zoneprelevement WHERE idZonePrelevement=" + idZone + ";"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.connection); cmd.ExecuteNonQuery(); MySqlDataReader reader = cmd.ExecuteReader(); reader.Read(); ZoneDAO zone; if (reader.HasRows) { zone = new ZoneDAO(reader.GetInt32(0), reader.GetString(1), reader.GetDecimal(2), reader.GetDecimal(3), reader.GetDecimal(4), reader.GetDecimal(5), reader.GetDecimal(6), reader.GetDecimal(7), reader.GetDecimal(8), reader.GetDecimal(9)); } else { zone = new ZoneDAO(1, "Mauvais Num Zone", 0.0M, 0.0M, 0.0M, 0.0M, 0.0M, 0.0M, 0.0M, 0.0M); } reader.Close(); return(zone); }
public ZoneServiceImp(ZoneDAO zoneDAO, FlowDAO flowDAO, VehicleDAO vehicleDAO) { this.zoneDAO = zoneDAO; this.flowDAO = flowDAO; this.vehicleDAO = vehicleDAO; }
public static void insertZone(ZoneViewModel zp) { ZoneDAO.insertZone(new ZoneDAO(zp.idZonePrelevementProperty, zp.nomZonePrelevementProperty, zp.lat1Property, zp.lat2Property, zp.lat3Property, zp.lat4Property, zp.long1Property, zp.long2Property, zp.long3Property, zp.long4Property)); }
public static void supprimerZone(int id) { ZoneDAO.supprimerZone(id); }
private ZonesService() { zoneDAO = new ZoneDAO(); }
public VehicleServiceImpl(VehicleDAO vehicleDAO, FlowDAO flowDAO, ZoneDAO zoneDAO) { this.vehicleDAO = vehicleDAO; this.flowDAO = flowDAO; this.zoneDAO = zoneDAO; }