Пример #1
0
        public PdfPTable pdf_table(PdfPTable tableLayout, List <Command> lscmd)
        {
            float[] headers = { 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 }; //Header Widths
            tableLayout.SetWidths(headers);                               //Set the pdf headers
            tableLayout.WidthPercentage = 100;                            //Set the PDF File witdh percentage
            tableLayout.HeaderRows      = 1;
            //Add Title to the PDF file at the top



            tableLayout.AddCell(new PdfPCell(new Phrase("the details of the command", new Font(Font.FontFamily.HELVETICA, 8, 1, new iTextSharp.text.BaseColor(0, 0, 0))))
            {
                Colspan             = 12,
                Border              = 0,
                PaddingBottom       = 5,
                HorizontalAlignment = Element.ALIGN_CENTER
            });


            ////Add header
            AddCellToHeader(tableLayout, "IdCommand");
            AddCellToHeader(tableLayout, "Product");
            AddCellToHeader(tableLayout, "Quantity");
            AddCellToHeader(tableLayout, "Name");
            AddCellToHeader(tableLayout, "Phone");
            AddCellToHeader(tableLayout, "Phone 2");
            AddCellToHeader(tableLayout, "Adresse");
            AddCellToHeader(tableLayout, "City");
            AddCellToHeader(tableLayout, "Zip Code");
            AddCellToHeader(tableLayout, "Email");
            ////Add body
            IserviceProduct spp = new serviceProduct();

            foreach (var cmd in lscmd)
            {
                AddCellToBody(tableLayout, cmd.idcmd.ToString());
                AddCellToBody(tableLayout, spp.GetById(cmd.idprod).nameprod);
                AddCellToBody(tableLayout, cmd.qteprod.ToString());
                AddCellToBody(tableLayout, cmd.name.ToString());
                AddCellToBody(tableLayout, cmd.phone.ToString());
                AddCellToBody(tableLayout, cmd.phone2 != null? cmd.phone2.ToString():"");
                AddCellToBody(tableLayout, cmd.adresse);
                AddCellToBody(tableLayout, cmd.gov);
                AddCellToBody(tableLayout, cmd.code);
                AddCellToBody(tableLayout, cmd.email);
            }

            return(tableLayout);
        }
Пример #2
0
        public void validateCommande(Command cmd)
        {
            //validate command iscomfirmed =true and substract the qte of the command from the productS
            IserviceProduct spp  = new serviceProduct();
            Command         _cmd = this.GetById(cmd.idcmd);
            Product         prod = spp.GetById(_cmd.idprod);

            _cmd.dateliv     = cmd.dateliv;
            _cmd.isComfirmed = true;
            this.Update(_cmd);
            this.Commit();
            prod.qteprod = prod.qteprod - cmd.qteprod;
            spp.Update(prod);
            spp.Commit();
        }