public ViewModelReservation(Reservation modelReservation, List<Coupe> coupes)
 {
     _reservation = modelReservation;
     _coupes = coupes;
 }
Example #2
0
 public Reservation getReservationFromRow(DataRow row)
 {
     Reservation r = new Reservation(
         getMatchByID(Convert.ToInt32(row["MatcheID"])),
         getSpectateurByID(Convert.ToInt32(row["SpectateurID"])),
         Convert.ToInt32(row["NombrePlacesReservees"]));
     r.Id = Convert.ToInt32(row["ID"]);
     return r;
 }
 private void Add()
 {
     Reservation r = new Reservation(SelectedItem.MyMatch, SelectedItem.MyReservation.MySpectateur, SelectedItem.Places);
     this.SelectedItem = new ReservationViewModel(r);
     Reservations.Add(this.SelectedItem);
 }
        private void Add()
        {
            EntitiesLayer.Reservation r = new EntitiesLayer.Reservation();

            this.SelectedItem = new ViewModelReservation(r,_coupes);
            Reservations.Add(this.SelectedItem);
        }
Example #5
0
 public ReservationWS( Reservation reservation)
 {
     this.MyMatch = new MatchWS(reservation.MyMatch);
     this.MySpectateurWS = new SpectateurWS(reservation.MySpectateur);
     this.Places = reservation.Places;
 }
Example #6
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;
        }
Example #7
0
        public Reservation GetReservation(System.Guid guidResa)
        {
            Reservation resa = null;

            SqlCommand command = new SqlCommand("SELECT * FROM Reservation WHERE ID = '" + guidResa + "';",
                _connection);

            SqlDataReader reader = command.ExecuteReader();

            if (reader.Read())
            {
                string text = "";

                resa = new Reservation();

                resa.Guid = (System.Guid)reader[0];
                resa.NbPlaces = (int)reader[1];
                resa.Planning = null;

                System.Guid ev = (System.Guid)reader[2];
                System.Guid lieu = (System.Guid)reader[3];
                DateTime date = (DateTime)reader[4];

                text += ev.ToString() + "\t" + lieu.ToString() + "\t" + date + "\n";

                foreach (PlanningElement pe in GetAllPlanningElement())
                {
                    text += pe.MonEvement.Guid.ToString() + "\t" + pe.MonLieu.Guid.ToString() + "\t" + pe.DateDebut + "\n";

                    if (ev.Equals(pe.MonEvement.Guid) && lieu.Equals(pe.MonLieu.Guid) && date.Equals(pe.DateDebut))
                    {
                        resa.Planning = pe;
                        break;
                    }
                }

                System.IO.File.WriteAllText(@"C:\Users\Thomas\Downloads\WriteLines.txt", text);
            }

            reader.Close();

            return resa;
        }
 public ReservationViewModel(Reservation res)
 {
     MyReservation = res;
     cm = new CoupeManager();
 }