Exemplo n.º 1
0
        private void butQuery_Click(object sender, System.EventArgs e)
        {
            titles t = new titles();

            t.title = "A";
            ArrayList alBooks = PersistDAL.Query(typeof(titles), new SQLLike(t.title));
        }
Exemplo n.º 2
0
        private void cmdTestDelete_Click(object sender, System.EventArgs e)
        {
            titles objTestBook = new titles();

            objTestBook.title_id = txtTitleID.Text;
            PersistDAL.Delete(objTestBook);
        }
Exemplo n.º 3
0
        private void cmdTestInsert_Click(object sender, System.EventArgs e)
        {
            titles objTestBook = GetNewBookFromDisplayedData();

            PersistDAL.Insert(objTestBook);
            ResetDisplayedData(objTestBook);                    // au cas ou certain valeur serait généré automatiquement ( style compteur )
        }
Exemplo n.º 4
0
        private void cmdNouveau_Click(object sender, System.EventArgs e)
        {
            titles b = new titles();                    // reset l'affichage pour pouvoir créer un nouveau Book.

            b.pub_id  = "9999";
            b.pubdate = DateTime.Now;
            ResetDisplayedData(b);
        }
Exemplo n.º 5
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            titles b = new titles();

            b.title_id = "PC8888";
            PersistDAL.Read(b);
            //MessageBox.Show("<" + b.Editeur.pub_name +">",b.Editeur.pub_id);
        }
Exemplo n.º 6
0
        private void cmdTest_Click(object sender, System.EventArgs e)
        {
            titles b=new titles();
            b.pub_id="1000";

            ArrayList alBook=PersistDAL.ReadMultiple(b,null,"[pub_id]<1000",null,null);
            dataGrid1.DataSource=alBook;
        }
Exemplo n.º 7
0
        private void cmdTest_Click(object sender, System.EventArgs e)
        {
            titles b = new titles();

            b.pub_id = "1000";

            ArrayList alBook = PersistDAL.ReadMultiple(b, null, "[pub_id]<1000", null, null);

            dataGrid1.DataSource = alBook;
        }
Exemplo n.º 8
0
        private void cmdRead_Click(object sender, System.EventArgs e)
        {
            // Creation d'un object book
            titles objTestBook = new titles();

            objTestBook.title_id = txtTitleID.Text;             // j'initialise la 'clé primaire'

            // Persistance de l'obj
            PersistDAL.Read(objTestBook);                               // j'utilise la méthode statis Read pour le lire dans la base
            ResetDisplayedData(objTestBook);                            // je reactulise l'affichage
        }
Exemplo n.º 9
0
        private void cmdUpdateBench_Click(object sender, System.EventArgs e)
        {
            int nb     = 50;
            int repeat = 50;

            this.Cursor = Cursors.WaitCursor;
            titles[] at = new titles[nb];
            // initialisation des enreg
            for (int n = 0; n < nb; n++)
            {
                at[n]         = new titles();
                at[n].pubdate = DateTime.Now;
                at[n].type    = "";
                at[n].title   = "BENCH " + n.ToString();

                at[n].title_id = "B" + n.ToString();

                try { PersistDAL.Delete(at[n]); }
                catch {}
            }

            DateTime timeStart = DateTime.Now;

            // insert initial
            for (int n = 0; n < nb; n++)
            {
                PersistDAL.Insert(at[n]);
            }

            // sequence Read/Update sur les NB enreg, repété REPEAT fois
            for (int r = 0; r < repeat; r++)
            {
                for (int n = 0; n < nb; n++)
                {
                    PersistDAL.Read(at[n]);
                    PersistDAL.Update(at[n]);
                }
            }

            // delete final
            for (int n = 0; n < nb; n++)
            {
                PersistDAL.Delete(at[n]);
            }
            DateTime timeStop = DateTime.Now;

            TimeSpan temps = timeStop - timeStart;

            this.Cursor = Cursors.Default;
            MessageBox.Show("Bench pour " + nb.ToString() + " enregistrements\r\nlu/updaté " + repeat.ToString() + " fois = \r\n\r\n" + temps.TotalMilliseconds.ToString() + " ms");
        }
Exemplo n.º 10
0
        private void cmdTestTransaction_Click(object sender, System.EventArgs e)
        {
            titles a = new titles();
            titles b = new titles();

            a.title_id = "A";
            //PersistDAL.Read(a);

            b.title_id = "B";
            //PersistDAL.Read(b);

            a.title = "livre A - " + DateTime.Now.ToLongTimeString();
            b.title = "libre B - " + DateTime.Now.ToLongTimeString();

/*			PersistDAL.Update(new object[] { a,b} );
 *                      PersistDAL.Delete(new object[] { a,b } );
 *
 */
            a.pubdate = DateTime.Now;
            b.pubdate = DateTime.Now;
            PersistDAL.Insert(new object[] { a, b });
        }
Exemplo n.º 11
0
 private void butQuery_Click(object sender, System.EventArgs e)
 {
     titles t=new titles();
     t.title="A";
     ArrayList alBooks=PersistDAL.Query(typeof(titles),new SQLLike(t.title));
 }
Exemplo n.º 12
0
 private void cmdNouveau_Click(object sender, System.EventArgs e)
 {
     titles b=new titles();		// reset l'affichage pour pouvoir créer un nouveau Book.
     b.pub_id="9999";
     b.pubdate=DateTime.Now;
     ResetDisplayedData(b);
 }
Exemplo n.º 13
0
        private void cmdRead_Click(object sender, System.EventArgs e)
        {
            // Creation d'un object book
            titles objTestBook=new titles();

            objTestBook.title_id=txtTitleID.Text;	// j'initialise la 'clé primaire'

            // Persistance de l'obj
            PersistDAL.Read(objTestBook);			// j'utilise la méthode statis Read pour le lire dans la base
            ResetDisplayedData(objTestBook);		// je reactulise l'affichage
        }
Exemplo n.º 14
0
        private void cmdTestDelete_Click(object sender, System.EventArgs e)
        {
            titles objTestBook = new titles();

            objTestBook.title_id=txtTitleID.Text;
            PersistDAL.Delete(objTestBook);
        }
Exemplo n.º 15
0
        private void ResetDisplayedData(titles b)
        {
            txtTitleID.Text  = b.title_id;
            txtTitle.Text    = b.title;
            txtAdvance.Text  = b.advance.ToString();
            txtNotes.Text    = b.notes;
            txtPrice.Text    = b.price.ToString();
            txtPubDate.Text  = b.pubdate.ToShortDateString();
            txtPubID.Text    = b.pub_id;
            txtRoyalty.Text  = b.royalty.ToString();
            txtType.Text     = b.type;
            txtYtdSales.Text = b.ytd_sales.ToString();
            if (b.advanceISNULL)
            {
                txtAdvance.BackColor = Color.Red;
            }
            else
            {
                txtAdvance.BackColor = Color.White;
            }
            if (b.notesISNULL)
            {
                txtNotes.BackColor = Color.Red;
            }
            else
            {
                txtNotes.BackColor = Color.White;
            };
            if (b.priceISNULL)
            {
                txtPrice.BackColor = Color.Red;
            }
            else
            {
                txtPrice.BackColor = Color.White;
            };
            if (b.pub_idISNULL)
            {
                txtPubID.BackColor = Color.Red;
            }
            else
            {
                txtPubID.BackColor = Color.White;
            };
            if (b.royaltyISNULL)
            {
                txtRoyalty.BackColor = Color.Red;
            }
            else
            {
                txtRoyalty.BackColor = Color.White;
            };
            if (b.ytd_salesISNULL)
            {
                txtYtdSales.BackColor = Color.Red;
            }
            else
            {
                txtYtdSales.BackColor = Color.White;
            };

            /*
             * if (b.Editeur!=null)
             * {
             *      txtPubNom.Text=b.Editeur.pub_name;
             *      txtPubVille.Text=b.Editeur.city;
             *      txtPubEtat.Text=b.Editeur.state;
             *      txtPubPays.Text=b.Editeur.country;
             * }
             */
        }
Exemplo n.º 16
0
        private titles GetNewBookFromDisplayedData()
        {
            titles b = new titles();

            if (txtAdvance.BackColor == Color.Red)
            {
                b.advanceISNULL = true;
            }
            else
            {
                b.advance = decimal.Parse(txtAdvance.Text);
            }
            b.title_id = txtTitleID.Text;
            if (txtNotes.BackColor == Color.Red)
            {
                b.notesISNULL = true;
            }
            else
            {
                b.notes = txtNotes.Text;
            }
            if (txtPrice.BackColor == Color.Red)
            {
                b.priceISNULL = true;
            }
            else
            {
                b.price = decimal.Parse(txtPrice.Text);
            }
            b.pubdate = DateTime.Parse(txtPubDate.Text);
            if (txtPubID.BackColor == Color.Red)
            {
                b.pub_idISNULL = true;
            }
            else
            {
                b.pub_id = txtPubID.Text;
            }
            if (txtRoyalty.BackColor == Color.Red)
            {
                b.royaltyISNULL = true;
            }
            else
            {
                b.royalty = int.Parse(txtRoyalty.Text);
            }
            b.title = txtTitle.Text;
            b.type  = txtType.Text;
            if (txtYtdSales.BackColor == Color.Red)
            {
                b.ytd_salesISNULL = true;
            }
            else
            {
                b.ytd_sales = int.Parse(txtYtdSales.Text);
            }


/*
 *                      b.Editeur=new Publisher();
 *                      b.Editeur.pub_id=b.pub_id;
 *                      b.Editeur.pub_name=txtPubNom.Text;
 *                      b.Editeur.city=txtPubVille.Text;
 *                      b.Editeur.state=txtPubEtat.Text;
 *                      b.Editeur.country=txtPubPays.Text;
 */
            return(b);
        }
Exemplo n.º 17
0
        private void cmdTestTransaction_Click(object sender, System.EventArgs e)
        {
            titles a=new titles();
            titles b=new titles();

            a.title_id="A";
            //PersistDAL.Read(a);

            b.title_id="B";
            //PersistDAL.Read(b);

            a.title="livre A - " + DateTime.Now.ToLongTimeString();
            b.title="libre B - " + DateTime.Now.ToLongTimeString();
            /*			PersistDAL.Update(new object[] { a,b} );
            PersistDAL.Delete(new object[] { a,b } );

            */
            a.pubdate=DateTime.Now;
            b.pubdate=DateTime.Now;
            PersistDAL.Insert(new object[] { a,b });
        }
Exemplo n.º 18
0
        private void cmdUpdateBench_Click(object sender, System.EventArgs e)
        {
            int nb=50;
            int repeat=50;

            this.Cursor=Cursors.WaitCursor;
            titles[] at=new titles[nb];
            // initialisation des enreg
            for(int n=0;n<nb;n++)
            {
                at[n]=new titles();
                at[n].pubdate=DateTime.Now;
                at[n].type="";
                at[n].title="BENCH "+n.ToString();

                at[n].title_id="B"+n.ToString();

                try { PersistDAL.Delete(at[n]); }
                catch{}
            }

            DateTime timeStart=DateTime.Now;
            // insert initial
            for(int n=0;n<nb;n++)
            {
                PersistDAL.Insert(at[n]);
            }

            // sequence Read/Update sur les NB enreg, repété REPEAT fois
            for(int r=0;r<repeat;r++)
            {
                for(int n=0;n<nb;n++)
                {
                    PersistDAL.Read(at[n]);
                    PersistDAL.Update(at[n]);
                }
            }

            // delete final
            for(int n=0;n<nb;n++)
            {
                PersistDAL.Delete(at[n]);
            }
            DateTime timeStop=DateTime.Now;

            TimeSpan temps=timeStop-timeStart;

            this.Cursor=Cursors.Default;
            MessageBox.Show("Bench pour " + nb.ToString() + " enregistrements\r\nlu/updaté " + repeat.ToString() +" fois = \r\n\r\n" + temps.TotalMilliseconds.ToString() + " ms");
        }
Exemplo n.º 19
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            titles b=new titles();

            b.title_id="PC8888";
            PersistDAL.Read(b);
            //MessageBox.Show("<" + b.Editeur.pub_name +">",b.Editeur.pub_id);
        }
Exemplo n.º 20
0
        private void cmdUpdate_Click(object sender, System.EventArgs e)
        {
            titles objTestBook = GetNewBookFromDisplayedData();                 // je crée un objet a partir de l'affichage

            PersistDAL.Update(objTestBook);                                     // on persist l'objet dans la base de données via la méthode static update
        }
Exemplo n.º 21
0
 private void ResetDisplayedData(titles b)
 {
     txtTitleID.Text=b.title_id;
     txtTitle.Text=b.title;
     txtAdvance.Text=b.advance.ToString();
     txtNotes.Text=b.notes;
     txtPrice.Text=b.price.ToString();
     txtPubDate.Text=b.pubdate.ToShortDateString();
     txtPubID.Text=b.pub_id;
     txtRoyalty.Text=b.royalty.ToString();
     txtType.Text=b.type;
     txtYtdSales.Text=b.ytd_sales.ToString();
     if (b.advanceISNULL) txtAdvance.BackColor=Color.Red; else txtAdvance.BackColor=Color.White;
     if (b.notesISNULL) txtNotes.BackColor=Color.Red; else txtNotes.BackColor=Color.White;;
     if (b.priceISNULL) txtPrice.BackColor=Color.Red; else txtPrice.BackColor=Color.White;;
     if (b.pub_idISNULL) txtPubID.BackColor=Color.Red; else txtPubID.BackColor=Color.White;;
     if (b.royaltyISNULL) txtRoyalty.BackColor=Color.Red; else txtRoyalty.BackColor=Color.White;;
     if (b.ytd_salesISNULL) txtYtdSales.BackColor=Color.Red; else txtYtdSales.BackColor=Color.White;;
     /*
     if (b.Editeur!=null)
     {
         txtPubNom.Text=b.Editeur.pub_name;
         txtPubVille.Text=b.Editeur.city;
         txtPubEtat.Text=b.Editeur.state;
         txtPubPays.Text=b.Editeur.country;
     }
     */
 }
Exemplo n.º 22
0
        private titles GetNewBookFromDisplayedData()
        {
            titles b=new titles();

            if (txtAdvance.BackColor==Color.Red) b.advanceISNULL=true; else b.advance=decimal.Parse(txtAdvance.Text);
            b.title_id=txtTitleID.Text;
            if (txtNotes.BackColor==Color.Red) b.notesISNULL=true; else b.notes=txtNotes.Text;
            if (txtPrice.BackColor==Color.Red) b.priceISNULL=true; else b.price=decimal.Parse(txtPrice.Text);
            b.pubdate=DateTime.Parse(txtPubDate.Text);
            if (txtPubID.BackColor==Color.Red) b.pub_idISNULL=true; else b.pub_id=txtPubID.Text;
            if (txtRoyalty.BackColor==Color.Red) b.royaltyISNULL=true; else b.royalty=int.Parse(txtRoyalty.Text);
            b.title=txtTitle.Text;
            b.type=txtType.Text;
            if (txtYtdSales.BackColor==Color.Red) b.ytd_salesISNULL=true; else b.ytd_sales=int.Parse(txtYtdSales.Text);

            /*
            b.Editeur=new Publisher();
            b.Editeur.pub_id=b.pub_id;
            b.Editeur.pub_name=txtPubNom.Text;
            b.Editeur.city=txtPubVille.Text;
            b.Editeur.state=txtPubEtat.Text;
            b.Editeur.country=txtPubPays.Text;
            */
            return b;
        }