示例#1
0
        public IEnumerable <Command> ListCommand()
        {
            IserviceProduct spp = new serviceProduct();
            var             cmd = this.GetMany().OrderBy(d => d.isComfirmed == false).Reverse();

            return(cmd);
        }
示例#2
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);
        }
示例#3
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();
        }
示例#4
0
        public void validateCommande(int id, DateTime datee)
        {
            //validate command iscomfirmed =true and substract the qte of the command from the productS

            Command _cmd = new Command();

            _cmd = this.Get(x => x.idcmd == id);

            _cmd.dateliv     = datee;
            _cmd.isComfirmed = true;
            this.Update(_cmd);
            this.Commit();

            IserviceProduct spp  = new serviceProduct();
            Product         prod = spp.Get(x => x.idprod == _cmd.idprod);

            prod.qteprod = prod.qteprod - _cmd.qteprod;
            spp.Update(prod);
            spp.Commit();
            IserviceMail sm = new serviceMail();

            sm.sendMail(_cmd.email, "order from ri9 Tounsi have been reviewed",
                        "your order have been reviewed and it will be delievered " + datee.ToShortDateString() + "<br>We will call you as soon as possible");
        }