コード例 #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();
        }
コード例 #2
0
 private void btnRegisterTick_Click(object sender, EventArgs e)
 {
     if (MetroMessageBox.Show(this, Strings.ConfRegister, Strings.Register, MessageBoxButtons.YesNo, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
     {
         TicketDAO tdao = new TicketDAO();
         Ticket    tick = new Ticket()
         {
             Type    = "1",
             Name    = txtTickName.Text,
             Price   = decimal.Parse(txtTickPrice.Text),
             EventId = int.Parse(lblTickEvent2.Text)
         };
         tdao.Add(tick);
         MetroMessageBox.Show(this, Strings.SuccessRegistered, Strings.Registered, MessageBoxButtons.OK, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
     }
     panelAddTicket.Visible = false;
     lblTitle.Visible       = true;
     lblTitle2.Visible      = true;
     lblTitle3.Visible      = false;
     lbltitle4.Visible      = false;
 }
コード例 #3
0
 public Ticket Add(Ticket entity)
 {
     return(ticketDAO.Add(entity));
 }