public FicheReservation(Reservation re, Ressources r, DataGrid d)
        {
            rez = re;
            res = r;
            data = d;

            InitializeComponent();

            foreach (Particulier p in r.ListeClients)
            {
                ComboBoxItem monItem = new ComboBoxItem();
                monItem.Name = "idProp" + p.Id;
                monItem.Content = p.Id + " " + p.Nom + " " + p.Prenom;
                IDLoc.Items.Add(monItem);
            }

            foreach (Logement l in r.ListeLogements)
            {
                ComboBoxItem monItem = new ComboBoxItem();
                monItem.Name = "idlogement" + l.Id;
                int taille = l.GetType().ToString().Count();
                monItem.Content = l.Id + " " + l.GetType().ToString().Substring(11, taille - 11) + " " + l.Adresse.Ville;
                IDLog.Items.Add(monItem);
            }

            IDLoc.SelectedIndex = rez.IDClient - 1;
            IDLog.SelectedIndex = rez.IDLogement - 1;
            calendar1.BlackoutDates.Add(new CalendarDateRange(rez.DateDebut, rez.DateDebut.AddDays(7 * rez.Duree - 1)));
            calendar1.DisplayDate = rez.DateDebut;
            calendar1.SelectionMode = CalendarSelectionMode.None;
        }
        public bool Evaluer(Reservation l)
        {
            bool res = false;

            try
            {
                switch (attr.SelectedIndex)
                {
                    // ID Locataire
                    case 0:
                        if (l.IDClient == int.Parse(Value.Text))
                            res = true;
                        break;

                    // ID Logement
                    case 1:
                        if (l.IDLogement == int.Parse(Value.Text))
                            res = true;
                        break;

                }
            }
            catch (Exception) { }

            return res;
        }
Beispiel #3
0
 public Reservation(Reservation r)
 {
     _id = r._id;
     _IDclient = r._IDclient;
     _IDlogement = r._IDlogement;
     _dateDebut = r._dateDebut;
     _duree = r._duree;
 }
        public ModifierReservation(Reservation re, Ressources r, DataGrid d)
        {
            rez = re;
            res = r;
            data = d;

            InitializeComponent();

            foreach (Particulier p in r.ListeClients)
            {
                ComboBoxItem monItem = new ComboBoxItem();
                monItem.Name = "idProp" + p.Id;
                monItem.Content = p.Id + " " + p.Nom + " " + p.Prenom;
                IDLoc.Items.Add(monItem);
            }

            foreach (Logement l in r.ListeLogements)
            {
                ComboBoxItem monItem = new ComboBoxItem();
                monItem.Name = "idlogement" + l.Id;
                int taille = l.GetType().ToString().Count();
                monItem.Content = l.Id + " " + l.GetType().ToString().Substring(11, taille - 11) + " " + l.Adresse.Ville;
                IDLog.Items.Add(monItem);
            }

            for (int i = 0; i < dureeMax; i++)
            {
                ComboBoxItem monItem = new ComboBoxItem();
                monItem.Name = "dure" + i;
                monItem.Content = i + 1;
                Duree.Items.Add(monItem);
            }

            IDLoc.SelectedIndex = rez.IDClient - 1;
            IDLog.SelectedIndex = rez.IDLogement - 1;
            datedebut.SelectedDate = rez.DateDebut;
            Duree.SelectedIndex = rez.Duree - 1;
            datefin.SelectedDate = datedebut.SelectedDate.Value.AddDays(7 * int.Parse(Duree.Text));
        }