private void buttonUrgence_Click(object sender, EventArgs e) { BO.Veterinaires veto = (BO.Veterinaires) this.comboBoxVeterianire.SelectedItem; BO.Animaux animal = (BO.Animaux) this.comboBoxAnimal.SelectedItem; DateTime date = new DateTime( DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, 0); BO.Agenda agenda = new BO.Agenda(); agenda.Veterinaires = veto; agenda.DateRdv = date; agenda.Animal = animal; agenda.Urgence = true; try { BLL.AgendaMgr.Add(agenda); UpdateContent(); } catch (Exception ex) { MessageBox.Show(ex.Message, GUI.Lang.FORM_DEFAULT_ERROR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonSubmit_Click(object sender, EventArgs e) { BO.Veterinaires veto = (BO.Veterinaires) this.comboBoxVeterianire.SelectedItem; BO.Animaux animal = (BO.Animaux) this.comboBoxAnimal.SelectedItem; DateTime date = new DateTime( this.dateTimePicker1.Value.Year, this.dateTimePicker1.Value.Month, this.dateTimePicker1.Value.Day, (int)this.numericUpDownHeure.Value, (int)this.numericUpDownMin.Value, 0); BO.Agenda agenda = new BO.Agenda(); agenda.Veterinaires = veto; agenda.DateRdv = date; agenda.Animal = animal; agenda.Urgence = false; try { BLL.AgendaMgr.Add(agenda); UpdateContent(); } catch (Exception ex) { MessageBox.Show(ex.Message, GUI.Lang.FORM_DEFAULT_ERROR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void InitializeConsultation() { //Pas connecté if (BLL.AccountMgr.loggedAccount == null) { this.Close(); } //Pas connecté en tant que vétérinaires, il est donc impossible de saisir la consultation vetoLogged = BLL.VeterinairesMgr.GetByAccount(BLL.AccountMgr.loggedAccount.Id); if (vetoLogged == null) { this.Close(); } //Chargement animal this.textBoxAniCode.Text = agenda.Animal.CodeAnimal.ToString(); this.textBoxAniColor.Text = agenda.Animal.Couleur; this.textBoxAniEspec.Text = agenda.Animal.Espece; this.textBoxAniName.Text = agenda.Animal.NomAnimal; this.textBoxAniRace.Text = agenda.Animal.Race; this.textBoxAniSexe.Text = agenda.Animal.Sexe.ToString(); this.textBoxAniTatoo.Text = agenda.Animal.Tatouage; //Chargement véto connecté this.textBoxActeVeto.Text = vetoLogged.NomVeto; try { consultation = BLL.ConsultationMgr.Get(agenda.DateRdv, agenda.Animal); this.buttonValidate.Enabled = true; if (consultation.Etat >= (short)BLL.ConsultationsEtat.SAISI_VETO_TERMINER_ET_FACTURE_POSSIBLE) { this.ReadOnly = true; } lignesConsultation = new BindingList <BO.LignesConsultations>(BLL.LignesConsultationsMgr.GetAll((Guid)consultation.CodeConsultation)); //Récupere tout les actes de la consultation } catch (Exception ex) //la consultation n'existe pas { consultation = new BO.Consultations { Animal = agenda.Animal, Etat = (short)BLL.ConsultationsEtat.EN_COURS_DE_SAISIE, Commentaire = "", Facture = null, DateConsultation = agenda.DateRdv, Veterinaire = vetoLogged, Archive = false }; this.buttonValidate.Enabled = false; } this.textBoxComment.Text = consultation.Commentaire; this.dataGridViewActe.DataSource = lignesConsultation; this.comboBoxActeType.DataSource = BLL.BaremesMgr.GetTypeActe(); }
private void UpdateContent() { BO.Veterinaires veto = (BO.Veterinaires) this.comboBoxVeto.SelectedItem; DateTime date = this.dateTimePickerDate.Value; this.dataGridViewAgenda.DataSource = BLL.AgendaMgr.GetAll(veto, date); this.dataGridViewAgenda.Columns["CodeAnimal"].Visible = false; this.dataGridViewAgenda.Columns["Urgence"].Visible = false; }
public static List <BO.Agenda> GetAll(BO.Veterinaires veto, DateTime date) { try { SqlConnection cnx = DAL.SqlConnexion.OpenConnexion(); String query; List <BO.Agenda> results; date = new DateTime(date.Year, date.Month, date.Day); if (veto == null) { query = @"SELECT * FROM Agendas ag LEFT JOIN Veterinaires v ON ag.CodeVeto = v.CodeVeto LEFT JOIN Animaux an ON ag.CodeAnimal = an.CodeAnimal LEFT JOIN Clients c ON an.CodeClient = c.CodeClient WHERE DateRdv BETWEEN cast(@dateRdv as SmallDateTime) AND cast(@dateRdv as SmallDateTime)+1 ORDER BY ag.DateRdv"; results = cnx.Query <BO.Agenda, BO.Veterinaires, BO.Animaux, BO.Clients, BO.Agenda>(query, (agenda, veterinaire, animal, client) => { animal.Client = client; agenda.Animal = animal; agenda.Veterinaires = veterinaire; return(agenda); }, new { dateRdv = date }, splitOn: "CodeVeto,CodeAnimal,CodeClient") .ToList <BO.Agenda>(); } else { query = @"SELECT * FROM Agendas ag LEFT JOIN Veterinaires v ON ag.CodeVeto = v.CodeVeto LEFT JOIN Animaux an ON ag.CodeAnimal = an.CodeAnimal LEFT JOIN Clients c ON an.CodeClient = c.CodeClient WHERE ag.CodeVeto = @codeVeto AND DateRdv BETWEEN cast(@dateRdv as SmallDateTime) AND cast(@dateRdv as SmallDateTime)+1 ORDER BY ag.DateRdv"; results = cnx.Query <BO.Agenda, BO.Veterinaires, BO.Animaux, BO.Clients, BO.Agenda>(query, (agenda, veterinaire, animal, client) => { animal.Client = client; agenda.Animal = animal; agenda.Veterinaires = veterinaire; return(agenda); }, new { codeVeto = veto.CodeVeto, dateRdv = date }, splitOn: "CodeVeto,CodeAnimal,CodeClient") .ToList <BO.Agenda>(); } SqlConnexion.CloseConnexion(cnx); return(results); } catch (Exception e) { throw e; } }
public static List <BO.Agenda> GetAll(BO.Veterinaires veto = null) { try { SqlConnection cnx = DAL.SqlConnexion.OpenConnexion(); String query; List <BO.Agenda> results; if (veto == null) { query = @"SELECT * FROM Agendas ag LEFT JOIN Veterinaires v ON ag.CodeVeto = v.CodeVeto LEFT JOIN Animaux an ON ag.CodeAnimal = an.CodeAnimal ORDER BY ag.DateRdv"; results = cnx.Query <BO.Agenda, BO.Veterinaires, BO.Animaux, BO.Agenda>(query, (agenda, veterinaire, animal) => { agenda.Animal = animal; agenda.Veterinaires = veterinaire; return(agenda); }, splitOn: "CodeVeto,CodeAnimal") .ToList <BO.Agenda>(); } else { query = @"SELECT * FROM Agendas ag LEFT JOIN Veterinaires v ON ag.CodeVeto = v.CodeVeto LEFT JOIN Animaux an ON ag.CodeAnimal = an.CodeAnimal WHERE ag.CodeVeto = @codeVeto ORDER BY ag.DateRdv"; results = cnx.Query <BO.Agenda, BO.Veterinaires, BO.Animaux, BO.Agenda>(query, (agenda, veterinaire, animal) => { agenda.Animal = animal; agenda.Veterinaires = veterinaire; return(agenda); }, new { codeVeto = veto.CodeVeto }, splitOn: "CodeVeto,CodeAnimal") .ToList <BO.Agenda>(); } SqlConnexion.CloseConnexion(cnx); return(results); } catch (Exception e) { throw e; } }
private void comboBoxVeterianire_SelectedIndexChanged(object sender, EventArgs e) { BO.Veterinaires veto = (BO.Veterinaires) this.comboBoxVeterianire.SelectedItem; this.dataGridViewAgenda.DataSource = BLL.AgendaMgr.GetAll(veto); }
public void UpdateContent() { BO.Veterinaires veto = (BO.Veterinaires) this.comboBoxVeterianire.SelectedItem; this.dataGridViewAgenda.DataSource = BLL.AgendaMgr.GetAll(veto, this.dateTimePicker1.Value); }
/// <summary> /// Retourne les objets Agenda ayant le veto et la date passé en params /// </summary> /// <param name="veto"></param> /// <param name="date"></param> /// <returns></returns> public static List <BO.Agenda> GetAll(BO.Veterinaires veto, DateTime date) { return(DAL.Agenda.GetAll(veto, date)); }
/// <summary> /// Retourne tout les objets Agenda avec le veto passé en paramas /// </summary> /// <param name="veto"></param> /// <returns></returns> public static List <BO.Agenda> GetAll(BO.Veterinaires veto = null) { return(DAL.Agenda.GetAll(veto)); }