Esempio n. 1
0
        private void dateTimePicker_agenda_date_ValueChanged(object sender, EventArgs e)
        {
            DateTime dateAgenda = DateTime.Parse(dateTimePicker_agenda_date.Value.ToString());
            Guid     codeVeto   = ((Veterinaires)combo_agenda_veto.SelectedItem).CodeVeto.Value;

            dataGridView_agenda.DataSource = MgtAgenda.AfficherToutAvecParametres(codeVeto, dateAgenda);
        }
        private void BTN_Suppr_Click(object sender, EventArgs e)
        {
            Agendas monAgenda = new Agendas();

            monAgenda.CodeAnimal = (Guid)dataGrid.CurrentRow.Cells["CodeAnimal"].Value;
            monAgenda.CodeVeto   = (Guid)dataGrid.CurrentRow.Cells["CodeVeto"].Value;
            monAgenda.DateRDV    = (DateTime)dataGrid.CurrentRow.Cells["DateRDV"].Value;

            MgtAgenda.Supprimer(monAgenda);

            ChargementDataGrid();
        }
        // Click
        private void BTN_Urgence_Click(object sender, EventArgs e)
        {
            Agendas      monAgenda = new Agendas();
            Clients      monClient = (Clients)COMBO_Client.SelectedItem;
            Animaux      monAnimal = (Animaux)COMBO_Animal.SelectedItem;
            Veterinaires monVeto   = (Veterinaires)COMBO_Veto.SelectedItem;

            monAgenda.CodeAnimal = monAnimal.CodeAnimal;
            monAgenda.CodeVeto   = monVeto.CodeVeto;
            monAgenda.DateRDV    = DateTime.Now;

            MgtAgenda.Ajouter(monAgenda);

            ChargementDataGrid();
        }
        /// <summary>
        /// Recharge la DataGrid
        /// </summary>
        private void ChargementDataGrid(bool estInitialisation = false)
        {
            if (!estInitialisation)
            {
                MgtClient    monMgtClient = MgtClient.GetInstance();
                MgtAnimal    monMgtAnimal = new MgtAnimal();
                Clients      monClientSelectionne;
                Animaux      monAnimal;
                Veterinaires monVeto;

                monVeto              = (Veterinaires)COMBO_Veto.SelectedItem;
                monAnimal            = (Animaux)COMBO_Animal.SelectedItem;
                monClientSelectionne = (Clients)COMBO_Client.SelectedItem;

                dataGrid.DataSource = MgtAgenda.AfficherToutAvecDetail().FindAll(x => x.CodeVeto == monVeto.CodeVeto && x.DateRDV.Value.Date == DateTime.Parse(DATE_RendezVous.Value.ToString()).Date);
            }
        }
        private void BTN_Valider_Click(object sender, EventArgs e)
        {
            Clients      monClient = (Clients)COMBO_Client.SelectedItem;
            Animaux      monAnimal = (Animaux)COMBO_Animal.SelectedItem;
            Veterinaires monVeto   = (Veterinaires)COMBO_Veto.SelectedItem;
            Agendas      monAgenda = new Agendas();

            monAgenda.CodeAnimal = monAnimal.CodeAnimal;
            monAgenda.CodeVeto   = monVeto.CodeVeto;
            try
            {
                monAgenda.DateRDV = new DateTime(DATE_RendezVous.Value.Year, DATE_RendezVous.Value.Month, DATE_RendezVous.Value.Day, (int)COMBO_Heure.SelectedValue, (int)COMBO_Minutes.SelectedValue, 0);
            }
            catch (Exception ex)
            {
                throw new Exception("Problème lors du passage de la date concernant l'ajout d'un RDV en urgence :\n" + ex.Message);
            }

            MgtAgenda.Ajouter(monAgenda);

            ChargementDataGrid();
        }