Example #1
0
        private void btnConfirme_Click(object sender, EventArgs e)
        {
            EmployerDAO empd = new EmployerDAO();
            Employer    emp2 = empd.Find(user);
            DateTime    auj  = DateTime.Now.Date;
            string      d    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            DateTime    auj2 = DateTime.Parse(d);


            // Employer emp = new Employer(0,"","","","","","","","","", auj,auj,null);
            decimal total, don, ret;

            total = Convert.ToDecimal(txtTotal.Text);
            don   = Convert.ToDecimal(txtmtdonne.Text);
            ret   = Convert.ToDecimal(txtmtretourne.Text);
            metiers.Ticket m = new metiers.Ticket(idTick, emp2, total, don, ret, auj2);
            //metiers.Ticket m2 = new metiers.Ticket(emp2, total, don, ret, auj);

            TicketDAO bd = new TicketDAO();

            bd.Add(m);
            //  bd.Add2(m2);

            metiers.Ticket m2 = bd.Find(Convert.ToInt32(txtnumtick.Text));
            foreach (DataGridViewRow Row in dgvProd.Rows)
            {
                try
                {
                    LigneTicketDAO ltb             = new LigneTicketDAO();
                    int            ProductId       = Convert.ToInt32(Row.Cells["id"].Value);
                    string         ProductName     = Row.Cells["Nomproduit"].Value.ToString();
                    decimal        ProductPrice    = Convert.ToDecimal(Row.Cells["prix"].Value);
                    int            ProductQuantity = Convert.ToInt32(Row.Cells["qte"].Value);
                    decimal        ProductTotal    = Convert.ToDecimal(Row.Cells["totalProduit"].Value);
                    ProduitDAO     pb = new ProduitDAO();
                    Produit        p  = pb.Find(ProductId);
                    LigneTicket    l  = new LigneTicket(0, p, m2, ProductName, ProductQuantity, ProductPrice, ProductTotal);
                    ltb.Add(l);
                }
                catch
                {
                    //means Rows are ended
                }
            }



            new Ticket(txtTotal.Text, txtmtdonne.Text, txtmtretourne.Text).ShowDialog();
            this.Hide();
            UIEmployer f1 = new UIEmployer(user);

            f1.Show();
        }
Example #2
0
        private void btnajouterCat_Click(object sender, EventArgs e)
        {
            MemoryStream ms = new MemoryStream();

            imagecat.Image.Save(ms, imagecat.Image.RawFormat);
            byte[] img = ms.ToArray();



            Categorie cate = new Categorie(0, txtnom.Text, txtDesc.Text, img);

            CategorieDAO bd = new CategorieDAO();

            bd.Add(cate);
            this.Hide();
            //    UIEmployer.ActiveForm.Hide();
            UIEmployer emp = new UIEmployer(user);

            emp.Show();
        }
Example #3
0
        private void pbxUIEmp_Click(object sender, EventArgs e)
        {
            UIEmployer f1 = new UIEmployer(user);

            f1.Show();
        }