/// <see cref="IDal.Cs"/> public void AddPlanning(PlanningElement element) { SqlConnection sqlConnection = new SqlConnection(ConnectionString); StringBuilder insertPlanning = new StringBuilder(); StringBuilder insertEvent = new StringBuilder(); insertEvent.Append("insert into EVENTS"); insertEvent.Append(" values('").Append(element.MonEvenement.Guid).Append("'"); insertEvent.Append(", '").Append(element.MonEvenement.Titre).Append("'"); insertEvent.Append(", '").Append(element.MonEvenement.Description).Append("'"); insertEvent.Append(", ").Append(element.MonEvenement.Tarif); insertEvent.Append(", (select GUID from EVENT_TYPES where DESCRIPTION = 'concert'));"); insertPlanning.Append("insert into EVENT_DATE_PLACE"); insertPlanning.Append(" values('").Append(element.MonEvenement.Guid.ToString()).Append("'"); insertPlanning.Append(", '").Append(element.MonLieu.Guid.ToString()).Append("'"); insertPlanning.Append(", CONVERT(datetime, '").Append(element.DateDebut.ToString()).Append("', 103)"); insertPlanning.Append(", CONVERT(datetime, '").Append(element.DateFin.ToString()).Append("', 103)"); insertPlanning.Append(",").Append(element.NombrePlacesreserves).Append(");"); sqlConnection.Open(); ExecureNonQueryRequest(sqlConnection, insertEvent.ToString()); ExecureNonQueryRequest(sqlConnection, insertPlanning.ToString()); sqlConnection.Close(); }
public PlanningElementWS(PlanningElement pe) { DateDebut = pe.DateDebut; DateFin = pe.DateFin; Guid = pe.Guid; MonEvenement = new EvenementWS(pe.MonEvenement); MonLieu = new LieuWS(pe.MonLieu); NombrePlacesReservees = pe.NombrePlacesReservees; }
public PlanningElementViewModel(PlanningElement pe) { PlanningElement = pe; SelectedPlace = PlanningElement.MonLieu.Nom; if (PlanningElement.MonEvenement.Artistes.Count > 0) SelectedArtist = PlanningElement.MonEvenement.Artistes[0].Nom; Places = MainWindow.Instance.BM.GetLieu().Select(l => l.Nom); ArtisteList = pe.MonEvenement.Artistes.Select(a => a.Nom); }
public PlanningElementViewModel(PlanningElement pel) { PlanningElement = pel; SelectedPlace = PlanningElement.MonLieu.Nom; if ( PlanningElement.MonEvenement.Artistes.Count > 0 ) SelectedArtist = PlanningElement.MonEvenement.Artistes[0].Nom; Places = BusinessManager.Instance.Lieux().Select(l => l.Nom); if(!pel.Guid.Equals("<new>")) { IEnumerable<Artiste> ieTmp = BusinessManager.Instance.GetArtistByEvent(PlanningElement.MonEvenement.Guid); if(ieTmp.Count() > 0) ArtisteList = ieTmp.Select(a => a.Nom); } }
public int GetNbPlacesAvailable(PlanningElement planning) { return _dal.GetNbPlacesAvailable((from p in _dal.GetAllPlanningElement() where p.Guid.Equals(planning.Guid) select p).ToList().First()); }
public void AddEvent() { var pe = new PlanningElement(new Concert("Default", "Default", 0f, Guid.NewGuid(), null, 0, 0, null), new Lieu(App.BusinessManager.GetFirstPlaceGuid().ToString(), "Default", "", "", 0, ""), DateTime.Now, DateTime.Now, 0); Events.Add(new PlanningElementViewModel(pe)); App.BusinessManager.AddPlanning(pe); }
public int GetNbPlacesAvailable(String login, String passwd, System.Guid pe) { PlanningElement plan = new PlanningElement(); plan.Guid = pe; return new BusinessManager().GetNbPlacesAvailable(plan); }
private void Add() { PlanningElement pl = new PlanningElement(new DateTime(), null, "<new>", new Concert(new List<Artiste>(), "description", "guid", "titre", 0, "dispo part", 0), new Lieu("a7c77b00-887b-4f1e-9a17-142830855d4b", "la coopé", "adresse", "cp", 0, "pays", 0, "0473******", "ville"), 0); this.SelectedItem = new PlanningElementViewModel(pl); _listModif.Add(pl); _planningElements.Add(this.SelectedItem); }
/// <summary> /// Ajoute un planning /// </summary> /// <param name="element">Planning a ajouter</param> public void AddPlanning(PlanningElement element) { DALManager.AddPlanning(element); }
public void AjouterExecute() { _currentPlanning = new PlanningElement(); _tempList.Add(_currentPlanning); EventControl.Update(_tempList.OrderBy(m => m.DateDebut).ToList()); }
public void AddPlanning(PlanningElement element) { Plannings.Add(element); Evenements.Add(element.MonEvenement); }
public int getReservedPlaces(PlanningElement plan) { return Dal.getReservedPlaces(plan); }
public int GetNbPlacesAvailable(PlanningElement planning) { float ret; SqlCommand command = new SqlCommand("SELECT NUMBER_PLACES FROM PLACES " + "WHERE GUID = @placeGuid", _connection); command.Parameters.Add("@placeGuid", SqlDbType.UniqueIdentifier).Value = planning.MonLieu.Guid; SqlDataReader reader = command.ExecuteReader(); reader.Read(); ret = (float)reader[0]; reader.Close(); command = new SqlCommand("SELECT RESERVED_PLACES FROM EVENT_DATE_PLACE " +"WHERE EVENT_GUID = @event " +"and DATE_BEGIN = @datedeb " + "and PLACE_GUID = @placeGuid", _connection); command.Parameters.Add("@event", SqlDbType.UniqueIdentifier).Value = planning.MonEvement.Guid; command.Parameters.Add("@DateDeb", SqlDbType.DateTime).Value = planning.DateDebut; command.Parameters.Add("@placeGuid", SqlDbType.UniqueIdentifier).Value = planning.MonLieu.Guid; reader = command.ExecuteReader(); reader.Read(); ret -= (int)reader[0]; reader.Close(); return (int)ret; }
public static PlanningElementWS Convert(PlanningElement pe) { return new PlanningElementWS(pe.DateDebut, pe.DateFin, pe.Guid, EvenementWS.Convert(pe.MonEvement), LieuWS.Convert(pe.MonLieu), pe.NbPlacesReservees); }
public PlannigElementViewModel(PlanningElement p) { _planningEvent = p; }
public Reservation ReserverPlaces(PlanningElement planning, int nbPlaces) { return null; }
public int GetNbPlacesAvailable(PlanningElement planning) { return 0; }
public Reservation ReserverPlaces(PlanningElement planning, int nbPlaces) { Reservation resa = null; if (GetNbPlacesAvailable(planning) >= nbPlaces) { resa = new Reservation(planning, nbPlaces, Guid.NewGuid()); SqlCommand command = new SqlCommand("INSERT INTO RESERVATION VALUES('"+resa.Guid.ToString()+"','" + nbPlaces.ToString() + "','" + planning.MonEvement.Guid.ToString() + "','" + planning.MonLieu.Guid.ToString() + "', @dateDeb);", _connection); command.Parameters.Add("@dateDeb", SqlDbType.DateTime).Value = planning.DateDebut; command.ExecuteNonQuery(); command = new SqlCommand("UPDATE EVENT_DATE_PLACE SET RESERVED_PLACES = (RESERVED_PLACES + " + nbPlaces.ToString() + ");", _connection); command.ExecuteNonQuery(); } return resa; }
public int GetNbPlacesAvailableStored(PlanningElement planning) { int ret; SqlCommand command = new SqlCommand("GET_AVAIABLE_PLACES", _connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@placeGuid", planning.MonLieu.Guid)); command.Parameters.Add(new SqlParameter("@eventGuid", planning.MonEvement.Guid)); command.Parameters.Add(new SqlParameter("@dateGuid", planning.DateDebut)); SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { ret = (Int32)reader[0]; } else throw new NullReferenceException(); reader.Close(); return ret; }
/// <summary> /// Constructeur principal de la classe. /// </summary> /// <param name="pe"><see cref="_planning"/></param> /// <param name="nbPlaces"><see cref="_nbPlaces"/></param> /// <param name="guid"><see cref="_guid"/></param> public Reservation(PlanningElement pe, int nbPlaces, System.Guid guid) { _planning = pe; _nbPlaces = nbPlaces; _guid = guid; }
/// <see cref="IDal.Cs"/> public void RemovePlanning(PlanningElement element) { SqlConnection sqlConnection = new SqlConnection(ConnectionString); StringBuilder query = new StringBuilder(); query.Append("delete from EVENT_DATE_PLACE"); query.Append(" WHERE EVENT_GUID = '").Append(element.MonEvenement.Guid.ToString()).Append("'"); query.Append(" AND PLACE_GUID = '").Append(element.MonLieu.Guid.ToString()).Append("'"); query.Append(" AND DATE_BEGIN = CONVERT(datetime, '").Append(element.DateDebut.ToString()).Append("', 103);"); sqlConnection.Open(); ExecureNonQueryRequest(sqlConnection, query.ToString()); sqlConnection.Close(); }
public PlanningElementViewModel(PlanningElement element) { _element = element; }
private void Add() { PlanningElement pe = new PlanningElement(0, DateTime.Now, DateTime.Now, new Concert(0, new List<Artiste>(), "", 0, "", Concert.DispositionCli.NORMAL, 0, 0), new Lieu(0, "", "", "", 0, "", 0, "", ""), 0); this.SelectedItem = new PlanningElementViewModel(pe); mListModif.Add(pe); mPlannings.Add(this.SelectedItem); }
public void RemovePlanning(PlanningElement element) { Plannings.Remove(element); }
public void SupprimerExecute() { _tempList.Remove(_currentPlanning); _currentPlanning = null; EventControl.Update(_tempList.OrderBy(m => m.DateDebut).ToList()); }
public string reservePlace(PlanningElement plan, int nbPlaces) { throw new NotImplementedException(); }
/// <summary> /// Supprime un planning /// </summary> /// <param name="element">Planning a supprimer</param> public void RemovePlanning(PlanningElement element) { DALManager.RemovePlanning(element); }