예제 #1
0
        /// <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();
        }
예제 #2
0
 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;
 }
예제 #3
0
        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);
            }
        }
예제 #5
0
 public int GetNbPlacesAvailable(PlanningElement planning)
 {
     return _dal.GetNbPlacesAvailable((from p in _dal.GetAllPlanningElement()
                                          where p.Guid.Equals(planning.Guid)
                                          select p).ToList().First());
 }
예제 #6
0
        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);
        }
예제 #7
0
 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);
        }
예제 #9
0
 /// <summary>
 /// Ajoute un planning
 /// </summary>
 /// <param name="element">Planning a ajouter</param>
 public void AddPlanning(PlanningElement element)
 {
     DALManager.AddPlanning(element);
 }
예제 #10
0
 public void AjouterExecute()
 {
     _currentPlanning = new PlanningElement();
     _tempList.Add(_currentPlanning);
     EventControl.Update(_tempList.OrderBy(m => m.DateDebut).ToList());
 }
예제 #11
0
파일: DalManager.cs 프로젝트: GorelH/Agenda
 public void AddPlanning(PlanningElement element)
 {
     Plannings.Add(element);
     Evenements.Add(element.MonEvenement);
 }
예제 #12
0
 public int getReservedPlaces(PlanningElement plan)
 {
     return Dal.getReservedPlaces(plan);
 }
예제 #13
0
        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;
        }
예제 #14
0
 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;
 }
예제 #16
0
 public Reservation ReserverPlaces(PlanningElement planning, int nbPlaces)
 {
     return null;
 }
예제 #17
0
 public int GetNbPlacesAvailable(PlanningElement planning)
 {
     return 0;
 }
예제 #18
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;
        }
예제 #19
0
        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;
        }
예제 #20
0
 /// <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;
 }
예제 #21
0
        /// <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();
        }
예제 #22
0
 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);
        }
예제 #24
0
파일: DalManager.cs 프로젝트: GorelH/Agenda
 public void RemovePlanning(PlanningElement element)
 {
     Plannings.Remove(element);
 }
예제 #25
0
 public void SupprimerExecute()
 {
     _tempList.Remove(_currentPlanning);
     _currentPlanning = null;
     EventControl.Update(_tempList.OrderBy(m => m.DateDebut).ToList());
 }
예제 #26
0
 public string reservePlace(PlanningElement plan, int nbPlaces)
 {
     throw new NotImplementedException();
 }
예제 #27
0
 /// <summary>
 /// Supprime un planning
 /// </summary>
 /// <param name="element">Planning a supprimer</param>
 public void RemovePlanning(PlanningElement element)
 {
     DALManager.RemovePlanning(element);
 }