Exemple #1
0
        private void AddBook_Load(object sender, EventArgs e)
        {
            c = new Connexion();
            b = new Books();

            SelectfromTable("SELECT * FROM Autor", "autor_name", cb_Writer);
            SelectfromTable("SELECT * FROM EDITOR", "EDITOR_name", cb_Publisher);
            SelectfromTable("SELECT * FROM Category", "nom", cb_cate);
            SelectfromTable("SELECT * FROM Zon", "nom", cb_zon);


            if (b.ID != null)
            {
                dataTable = c.showDataTable(String.Format(@"SELECT * FROM dbo.book WHERE book_id = '{0}'", b.ID));

                using (MemoryStream ms = new MemoryStream(c.getImage(int.Parse(dataTable.Rows[0]["image_id"].ToString()))))
                {
                    image          = Image.FromStream(ms);
                    pic_book.Image = image;
                }

                tb_Title.Text    = dataTable.Rows[0]["title"].ToString();
                tb_ISBN.Text     = dataTable.Rows[0]["book_isbn"].ToString();
                tb_Pnum.Text     = dataTable.Rows[0]["page_number"].ToString();
                tb_Amount.Text   = dataTable.Rows[0]["quantity"].ToString();
                mtb_datePub.Text = DateTime.Parse(dataTable.Rows[0]["date_created"].ToString()).ToString("dd:mm:yyyy");

                cb_Writer.Text    = c.executer_valeur(string.Format(@"SELECT autor_name FROM Autor WHERE [aut_id] = '{0}'", dataTable.Rows[0]["aut_id"].ToString()));
                cb_Publisher.Text = c.executer_valeur(string.Format(@"SELECT EDITOR_name FROM EDITOR WHERE [EDITOR_id] = '{0}'", dataTable.Rows[0]["id_editor"].ToString()));
                cb_cate.Text      = c.executer_valeur(string.Format(@"SELECT nom FROM category WHERE [id] = '{0}'", dataTable.Rows[0]["category"].ToString()));
                cb_zon.Text       = c.executer_valeur(string.Format(@"SELECT nom FROM Zon WHERE [id] = '{0}'", dataTable.Rows[0]["zon_id"].ToString()));

                But_Ok.Text = "Update";
            }
        }
Exemple #2
0
        int ZonID()
        {
            c = new Connexion();

            int i = int.Parse(c.executer_valeur(string.Format(@"SELECT [id] FROM [dbo].[Zon] WHERE [nom] =  '{0}'", zon)));

            return(i);
        }
Exemple #3
0
        int CategoryID()
        {
            c = new Connexion();

            int i = int.Parse(c.executer_valeur(string.Format(@"Select [id] from [dbo].[Category] WHERE [nom] = '{0}'", category)));

            return(i);
        }
Exemple #4
0
        int PublisherId()
        {
            c = new Connexion();

            int i = int.Parse(c.executer_valeur(string.Format(@"SELECT [EDITOR_id] FROM editor WHERE [EDITOR_name] = '{0}'", book_editor)));

            return(i);
        }
Exemple #5
0
        int autorId()
        {
            c = new Connexion();

            int i = int.Parse(c.executer_valeur(string.Format(@"SELECT aut_id FROM Autor WHERE autor_name = '{0}'", book_autor)));

            return(i);
        }
Exemple #6
0
 public Boolean existence_Codebibl() //existence de la clé primaire si le count renvoie 0 alors le code n’existe pas
 {
     if (con.executer_valeur("select count(*) from Bibliothecaire where CodeBibl='" + CodeBibl + "'") == "0")
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Exemple #7
0
 int getZonNumber(string zonId)
 {
     c = new Connexion();
     return(int.Parse(c.executer_valeur(string.Format(@"SELECT * FROM dbo.Zon WHERE  [id] = '{0}'", zonId))));
 }
Exemple #8
0
 string getAutorName(string autorId)
 {
     c = new Connexion();
     return(c.executer_valeur(string.Format(@"SELECT [autor_name] FROM Autor WHERE [aut_id] = '{0}'", autorId)));
 }