예제 #1
0
        private void Bibliotheque_Load(object sender, EventArgs e)
        {
            try
            {
                using (ClsIFACGestion_BibliothequeClient proxGestBiblio = new ClsIFACGestion_BibliothequeClient())
                {
                    ClsBOGestion_Bibliotheque objGestionBiblio = proxGestBiblio.SelectWhereIsAdmin(_Lecteur_ID, _BiblioID);

                    using (ClsIFACReservationClient proxReserv = new ClsIFACReservationClient())
                    {
                        using (ClsIFACEmpruntClient prox = new ClsIFACEmpruntClient())
                        {
                            ClsBOEmprunt objEmprunt = prox.SelectPrixByLecteur(_Lecteur_ID);
                            if (_IsAdmin != true)
                            {
                                #region Controls Hide si juste lecteur
                                tabControl1.Controls.Remove(tabStats);
                                tabControl2.Controls.Remove(tabAuteurs);
                                tabControl2.Controls.Remove(tabGenres);
                                tabControl2.Controls.Remove(tabExemplaires);
                                groupBox1.Hide();
                                groupBox2.Hide();
                                groupBox3.Hide();
                                #endregion
                                dgvEmpruntsEnCours.DataSource = prox.SelectEmpruntEnCoursByUtilisateur(_Lecteur_ID);
                                dgvHistEmp.DataSource = prox.SelectEmpruntHistoriqueByUtilisateur(_Lecteur_ID);
                                lblPrixHistEmp.Text = objEmprunt.Prix.ToString();

                                dgvReservEnCours.DataSource = proxReserv.SelectReservEnCoursByUtilisateur(_Lecteur_ID);
                                dgvHistReserv.DataSource = proxReserv.SelectReservHistoriqueByUtilisateur(_Lecteur_ID);

                            }
                            else
                            {
                                dgvEmpruntsEnCours.DataSource = prox.SelectAllEmpruntEnCours().ToList();
                                dgvHistEmp.DataSource = prox.SelectEmpruntHistoriqueByUtilisateur(_Lecteur_ID);
                                lblPrixHistEmp.Text = objEmprunt.Prix.ToString();

                                dgvReservEnCours.DataSource = proxReserv.SelectReservEnCoursByUtilisateur(_Lecteur_ID);
                                dgvHistReserv.DataSource = proxReserv.SelectReservHistoriqueByUtilisateur(_Lecteur_ID);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #2
0
        private void btnReserver_Click(object sender, EventArgs e)
        {
            try
            {
                using (ClsIFACEmpruntClient proxEmp = new ClsIFACEmpruntClient())
                {
                    List<ClsBOEmprunt> lstEmprunt = proxEmp.CountNbrExemplaireByISBN(cmbReservLivres.SelectedValue.ToString());

                    if (lstEmprunt.Count != 0)
                    {
                        MessageBox.Show("Il reste des exemplaires disponibles du livre choisi, dirigez vous vers l'onglet emprunts pour en emprunter un !");
                    }
                    else if (cmbReservLivres.SelectedIndex < 0)
                    {
                        MessageBox.Show("Veuillez sélectionner un livre à réserver !");
                    }
                    else if (cmbReservLivres.SelectedIndex > -1)
                    {
                        using (ClsIFACReservationClient prox = new ClsIFACReservationClient())
                        {
                            dgvReservation.DataSource = prox.Reserver(cmbReservLivres.SelectedValue.ToString(), _Lecteur_ID);
                            dgvReservEnCours.DataSource = prox.SelectReservEnCoursByUtilisateur(_Lecteur_ID);
                            MessageBox.Show("Votre réservation a bien été enregistrée !");
                        }
                    }
                    else
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #3
0
 private void btnReservEnCoursRech_Click(object sender, EventArgs e)
 {
     try
     {
         using (ClsIFACReservationClient prox = new ClsIFACReservationClient())
         {
             if (cmbReservEnCoursByLecteur.SelectedIndex < 0)
             {
                 dgvReservEnCours.DataSource = prox.SelectAllReservation().ToList();
             }
             else
             {
                 dgvReservEnCours.DataSource = prox.SelectReservEnCoursByUtilisateur(Convert.ToInt32(cmbReservEnCoursByLecteur.SelectedValue));
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }