예제 #1
0
        void remplireData()
        {
            try
            {
                BibliothèqueDataSet.EmprunteurRow r = Program.ds.Emprunteur.FindByID_Emprunteur(ID);
                TypeComboBox.SelectedValue = r.IdTypeEmp;
                IdentifiantTXT.Text        = r.ID_Emprunteur;
                CinTXT.Text                  = r.CIN;
                LieuNaissanceTXT.Text        = r.LieuNaissance;
                NomTXT.Text                  = r.Nom;
                PrenomTXT.Text               = r.Prenom;
                FilierComboBox.SelectedValue = r.CodeFilier;
                EmailTXT.Text                = r.Email;
                TeleTXT.Text                 = r.Tele;

                DateNaissanceTimePicker.Value = r.DateNaissance;
                if (r.Sexe == "M")
                {
                    SexeM.Checked = true;
                }
                else
                {
                    SexeF.Checked = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void RechercherBTN_Click(object sender, EventArgs e)
        {
            if (!IdentifiantTXT1.Text.Equals(string.Empty))
            {
                string id = IdentifiantTXT1.Text;

                if (Program.ds.Emprunteur.FindByID_Emprunteur(id) != null)
                {
                    //Remplire les information d'emprunteur
                    try
                    {
                        chargerLesGrid(id);
                        BibliothèqueDataSet.EmprunteurRow r = Program.ds.Emprunteur.FindByID_Emprunteur(id);
                        IdentifiantTXT2.Text        = r.ID_Emprunteur;
                        CinTXT.Text                 = r.CIN;
                        NomTXT.Text                 = r.Nom;
                        PrenomTXT.Text              = r.Prenom;
                        FilierTXT.SelectedValue     = r.CodeFilier;
                        EmailTXT.Text               = r.Email;
                        textBox8.Text               = r.Tele;
                        TypeComboBOX2.SelectedValue = r.IdTypeEmp;
                        if (r.Sexe == "M")
                        {
                            SexeM.Checked = true;
                        }
                        else
                        {
                            SexeF.Checked = true;
                        }
                        disable();
                        ModifierBTN.Text = "Modifier";
                    }
                    catch (Exception ex) { MessageBox.Show(ex.Message); chargerLesGrid(id); }
                }
                else
                {
                    if (MessageBox.Show("Cette emprunteur n'exist pas ,voulez vous l'ajoute?", "ajouter emprunteur", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
                    {
                        AjouterEmrunteur ajou = new AjouterEmrunteur();
                        if (ajou.ShowDialog() != DialogResult.Cancel)
                        {
                            chargerAutoCompliteSourceIdentifiant();
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("Vous deviez remplire l'identifiant !");
            }
        }
예제 #3
0
 private void AjouterEmpBTN_Click(object sender, EventArgs e)
 {
     if (AjouterEmpBTN.Text == "Modifier")
     {
         AjouterEmpBTN.Text = "Valider";
         enable();
     }
     else
     {
         if (VerifierChampsRequis)
         {
             try
             {
                 string cin = CinTXT.Text;
                 if (TypeComboBox.SelectedValue.ToString() != "1")
                 {
                     cin = IdentifiantTXT.Text;
                 }
                 string sx = "M";
                 if (SexeF.Checked)
                 {
                     sx = "F";
                 }
                 BibliothèqueDataSet.EmprunteurRow r = Program.ds.Emprunteur.FindByID_Emprunteur(ID);
                 r.ID_Emprunteur = IdentifiantTXT.Text;
                 r.CIN           = cin;
                 r.Nom           = NomTXT.Text;
                 r.Prenom        = PrenomTXT.Text;
                 if (TypeComboBox.SelectedValue.ToString() == "2")
                 {
                     FilierComboBox.SelectedValue = "NAN";
                 }
                 r.CodeFilier    = FilierComboBox.SelectedValue.ToString();
                 r.DateNaissance = DateNaissanceTimePicker.Value;
                 r.LieuNaissance = LieuNaissanceTXT.Text;
                 r.Sexe          = sx; r.Email = EmailTXT.Text; r.Tele = TeleTXT.Text;
                 r.IdTypeEmp     = int.Parse(TypeComboBox.SelectedValue.ToString());
                 MessageBox.Show("l'Emprunteur est Modifier avec succes !");
                 Program.emprunteurTA.Update(Program.ds.Emprunteur);
                 AjouterEmpBTN.Text = "Modifier"; disable();
             }
             catch (Exception ex) { MessageBox.Show(ex.Message); }
         }
         else
         {
             MessageBox.Show("Vous deviez remplire les champs obligatoir!");
         }
     }
 }
        void LoadEmprunteurs(string constring, string SheetName, string typeEmp)
        {
            try
            {
                OleDbConnection con = new OleDbConnection(constring);
                OleDbCommand    cmd = new OleDbCommand("select Ninscription,CIN,Nom,Prenom,Filier,DateNaissance,LieuNaissance,Sexe,Email,Tele from [" +
                                                       SheetName + "$]", con);
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }
                OleDbDataReader rd = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                while (rd.Read())
                {
                    if (rd[0].ToString() != "")
                    {
                        BibliothèqueDataSet.EmprunteurRow r = Program.ds.Emprunteur.FindByID_Emprunteur(rd[0].ToString());
                        if (r == null)
                        {
                            BibliothèqueDataSet.FilierRow fi = Program.ds.Filier.FindByCodeFilier(rd[4].ToString());
                            if (fi == null)
                            {
                                fi = Program.ds.Filier.FindByCodeFilier("NAN");
                                MessageBox.Show("Cette filiere : " + rd[4].ToString() + "n'exist pas !\nCe(tte) etudiant(e) va etre inserer avec une filiere indéfini!veuillez la modifier ulterierement\n  Veuilez dabord ajouter cette filier!", "filiere introuvable", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            DateTime date; string dat = rd[5].ToString();
                            if (DateTime.TryParse(dat, out date))
                            {
                                date.ToString("yyyy-MM-dd");
                            }
                            Program.ds.Emprunteur.AddEmprunteurRow(rd[0].ToString().TrimStart(), rd[1].ToString().TrimStart(), rd[2].ToString().TrimStart(), rd[3].ToString().TrimStart(), fi, date,
                                                                   rd[6].ToString().TrimStart(), rd[7].ToString().Trim(), rd[8].ToString().TrimStart(), rd[9].ToString().TrimStart(), Program.ds.TypeEmprunteur.FindByIdTypeEmp(int.Parse(typeEmp)));
                        }
                    }
                }
                if (!rd.IsClosed)
                {
                    rd.Close();
                }

                Program.emprunteurTA.Update(Program.ds.Emprunteur);
                MessageBox.Show("L'importation de Emprunteurs est fait avec succees!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ".\n Vous peuvez redemarer l'operation!");
            }
        }
 private void ModifierBTN_Click(object sender, EventArgs e)
 {
     if (!IdentifiantTXT2.Text.Equals(string.Empty))
     {
         if (ModifierBTN.Text == "Modifier")
         {
             ModifierBTN.Text = "Valider";
             enable();
         }
         else
         {
             try
             {
                 string cin = CinTXT.Text;
                 if (TypeComboBOX2.SelectedValue.ToString() != "1")
                 {
                     cin = IdentifiantTXT2.Text;
                 }
                 BibliothèqueDataSet.EmprunteurRow er = Program.ds.Emprunteur.FindByID_Emprunteur(IdentifiantTXT2.Text);
                 er.CIN        = cin;
                 er.Nom        = NomTXT.Text;
                 er.Prenom     = PrenomTXT.Text;
                 er.CodeFilier = FilierTXT.SelectedValue.ToString();
                 er.Email      = EmailTXT.Text;
                 er.Tele       = textBox8.Text;
                 er.IdTypeEmp  = (int)TypeComboBOX2.SelectedValue;
                 string sx = "M";
                 if (SexeF.Checked)
                 {
                     sx = "F";
                 }
                 er.Sexe = sx;
                 MessageBox.Show("l'Emprunteur est Modifier avec succes !");
                 Program.emprunteurTA.Update(Program.ds.Emprunteur);
                 ModifierBTN.Text = "Modifier";
                 disable();
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
         }
     }
 }
예제 #6
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         id   = "ID_Emprunteur like '%" + IDTXT.Text + "%' ";
         cote = " and Cote like '%" + CoteTXT.Text + "%' ";
         DuAu = " and DateEmprunt >= '" + dateTimePicker1.Value.ToShortDateString() + "' and DateEmprunt<='" + dateTimePicker2.Value.ToShortDateString() + "'";
         filtrer();
         if (IDTXT.Text != "" && dataGridView1.RowCount > 0)
         {
             BibliothèqueDataSet.EmprunteurRow r = Program.ds.Emprunteur.FindByID_Emprunteur(dataGridView1.Rows[0].Cells[1].Value.ToString());
             nomPrenom  = r.Nom;
             nomPrenom += " " + r.Prenom;
         }
         else
         {
             nomPrenom = "";
         }
     }
     catch (Exception ex) { MessageBox.Show(ex.Message); }
 }
 void remplire()
 {
     BibliothèqueDataSet.EmprunteurRow r = Program.ds.Emprunteur.FindByID_Emprunteur(ID);
     IdentifiantTXT2.Text        = r.ID_Emprunteur;
     CinTXT.Text                 = r.CIN;
     NomTXT.Text                 = r.Nom;
     label1.Text                 = "Historique de " + r.Nom + " " + r.Prenom;
     PrenomTXT.Text              = r.Prenom;
     FilierTXT.SelectedValue     = r.CodeFilier;
     EmailTXT.Text               = r.Email;
     textBox8.Text               = r.Tele;
     TypeComboBOX2.SelectedValue = r.IdTypeEmp;
     if (r.Sexe == "M")
     {
         SexeM.Checked = true;
     }
     else
     {
         SexeF.Checked = true;
     }
 }