Ejemplo n.º 1
0
        public Int32 Inserta(InvoiceBE pItem, List <InvoiceDetailBE> pListaInvoiceDetail)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    InvoiceDL               Invoice               = new InvoiceDL();
                    InvoiceDetailDL         InvoiceDetail         = new InvoiceDetailDL();
                    InspectionCertificateDL InspectionCertificate = new InspectionCertificateDL();

                    int IdInvoice = 0;
                    IdInvoice = Invoice.Inserta(pItem);

                    foreach (var item in pListaInvoiceDetail)
                    {
                        InspectionCertificate.ActualizaSituacion(item.IdInspectionCertificate, 15);

                        item.IdInvoice = IdInvoice;
                        InvoiceDetail.Inserta(item);
                    }

                    ts.Complete();

                    return(IdInvoice);
                }
            }
            catch (Exception ex)
            { throw ex; }
        }