public DalManager() { mArtistes = new List<Artiste>(); Artiste artiste_a = new Artiste(1, "Bogtob", "Karim", new DateTime(1212, 12, 12)); mArtistes.Add(artiste_a); Artiste artiste_b = new Artiste(2, "Faure", "Vivien", new DateTime(1111, 11, 11)); mArtistes.Add(artiste_b); Concert concert = new Concert(3, mArtistes, "LES BOGOSS", 2.00f, "LES BOGOSS EN FOLIE", Concert.DispositionCli.SUPERSON, 90, 3); Exposition exposition_a = new Exposition(4, mArtistes, "PEINTURE NEXT GEN", 2.00f, "NEW PEINTURES", 42); mLieux.Add(new Lieu(5, "84 Rue du Troufion", "99999", "Baie des cochons", 999, "CUBA", .2f, "+66666666", "Sierra Maestra")); mLieux.Add(new Lieu(6, "37B Rue des Alouettes", "63201", "Baie des singes", 1999, "FRANCE", .2f, "+06321303", "Clermont-Ferrand")); mPlannings.Add(new PlanningElement(7, new DateTime(2013, 1, 1), new DateTime(2013, 2, 1), concert, mLieux.ElementAt(0), 66)); mPlannings.Add(new PlanningElement(8, new DateTime(2014, 1, 1), new DateTime(2014, 2, 1), concert, mLieux.ElementAt(1), 66)); mPlannings.Add(new PlanningElement(9, new DateTime(2013, 2, 3), new DateTime(2013, 2, 5), exposition_a, mLieux.ElementAt(1), 59)); mUsers.Add("kbogtob", new User("Bogtob", "Karim", "kbogtob", "blabla")); mUsers.Add("vfaure", new User("Faure", "Vivien", "vfaure", "bloblo")); }
/// <summary> /// Constructeur par copie de Exposition /// </summary> /// <param name="exp"></param> public Exposition(Exposition exp) : base(exp as Evenement) { _nombreOeuvreExposees = exp.NombreOeuvreExposees; }
/// <summary> /// Recherche un événement par son Guid /// </summary> /// <param name="inGuid">Guid de l'événement</param> /// <returns>Evénement concerné</returns> public Evenement GetEventByGuid(string inGuid) { Evenement evenement = null; DataTable table = GetDataTable("select * from EVENTS where GUID = '" + inGuid + "';"); if (table.Rows.Count > 0) { DataRow col = table.Rows[0]; string guid = col["GUID"].ToString(); string title = col["TITLE"].ToString(); string description = col["DESCRIPTION"].ToString(); string price = col["PRICE"].ToString(); string eventType = col["EVENT_TYPE_GUID"].ToString(); string eventTypeString = GetTypeFromEvent(eventType).ToLower(); switch (eventTypeString) { case "concert": evenement = new Concert(title, description, float.Parse(price), new Guid(guid), null, 0, 0, GetArtistsForEvent(guid)); break; case "exposition": evenement = new Exposition(title, description, float.Parse(price), new Guid(guid), 0, GetArtistsForEvent(guid)); break; } } return evenement; }
/// <see cref="IDal.Cs"/> public List<Evenement> GetEvenementByLieu(string lieu) { List<Evenement> events = new List<Evenement>(); Guid? placeGuid = getPlaceIdByName(lieu); DataTable table = GetDataTable("select ev.GUID, ev.TITLE, ev.DESCRIPTION, ev.PRICE, ev.EVENT_TYPE_GUID from EVENTS ev, EVENT_DATE_PLACE edp, PLACES p WHERE edp.PLACE_GUID = p.GUID AND edp.EVENT_GUID = ev.GUID AND p.GUID = '" + placeGuid + "';"); foreach (DataRow col in table.Rows) { string guid = col["GUID"].ToString(); string title = col["TITLE"].ToString(); string description = col["DESCRIPTION"].ToString(); string price = col["PRICE"].ToString(); string eventType = col["EVENT_TYPE_GUID"].ToString(); string eventTypeString = GetTypeFromEvent(eventType).ToLower(); Evenement evenement = null; switch (eventTypeString) { case "concert": evenement = new Concert(title, description, float.Parse(price), new Guid(guid), null, 0, 0, GetArtistsForEvent(guid)); break; case "exposition": evenement = new Exposition(title, description, float.Parse(price), new Guid(guid), 0, GetArtistsForEvent(guid)); break; } events.Add(evenement); } return events; }
/// <see cref="IDal.Cs"/> public List<Evenement> GetAllEvenements() { List<Evenement> events = new List<Evenement>(); DataTable table = GetDataTable("select * from EVENTS;"); foreach (DataRow col in table.Rows) { string guid = col["GUID"].ToString(); string title = col["TITLE"].ToString(); string description = col["DESCRIPTION"].ToString(); string price = col["PRICE"].ToString(); string eventType = col["EVENT_TYPE_GUID"].ToString(); string eventTypeString = GetTypeFromEvent(eventType).ToLower(); Evenement evenement = null; switch (eventTypeString) { case "concert": evenement = new Concert(title, description, float.Parse(price), new Guid(guid), null, 0, 0, GetArtistsForEvent(guid)); break; case "exposition": evenement = new Exposition(title, description, float.Parse(price), new Guid(guid), 0, GetArtistsForEvent(guid)); break; } events.Add(evenement); } return events; }
private Evenement getEvenement(string evnmtGuid) { DataTable dt = select("select * from EVENTS WHERE guid = '" + evnmtGuid + "';"); string guid, title, description, event_type_guid, type; float price; Evenement evenementRet; DataRow row = dt.Rows[0]; guid = row["GUID"].ToString(); title = row["TITLE"].ToString(); description = row["DESCRIPTION"].ToString(); event_type_guid = row["EVENT_TYPE_GUID"].ToString(); price = float.Parse(row["PRICE"].ToString()); type = getEventType(guid); if(type.Equals("concert")) { evenementRet = new Concert(getArtisteByEvenement(guid), description, guid, title, price, "aucune disposition particulière", getDureeMinute(guid)); } else { evenementRet = new Exposition(getArtisteByEvenement(guid), description, guid, title, price, 0); } return evenementRet; }
public EntitiesLayer.Evenement castToEntitiesEvent() { EntitiesLayer.Evenement ev; if (Concert) ev = new EntitiesLayer.Concert(Artistes.castToArtiste(), Description, Guid, Tarif, Titre, DispositionParticuliere, DureeEnMinutes, NombreLoges); else ev = new EntitiesLayer.Exposition(NombreOeuvresExposees, Artistes.castToArtiste(), Description, Guid, Tarif, Titre); return ev; }