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; }
        }
        public void Actualiza(InspectionCertificateBE pItem, List <InspectionCertificateDetailBE> pListaInspectionCertificateDetail)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    InspectionCertificateDL       InspectionCertificate       = new InspectionCertificateDL();
                    InspectionCertificateDetailDL InspectionCertificateDetail = new InspectionCertificateDetailDL();

                    foreach (var item in pListaInspectionCertificateDetail)
                    {
                        if (item.TipoOper == Convert.ToInt32(Operacion.Nuevo)) //Nuevo
                        {
                            item.IdInspectionCertificate = pItem.IdInspectionCertificate;
                            InspectionCertificateDetail.Inserta(item);
                        }
                        else
                        {
                            InspectionCertificateDetail.Actualiza(item);
                        }
                    }


                    InspectionCertificate.Actualiza(pItem);

                    ts.Complete();
                }
            }
            catch (Exception ex)
            { throw ex; }
        }
        public void Elimina(InvoiceBE pItem)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    InvoiceDL               Invoice               = new InvoiceDL();
                    InvoiceDetailDL         InvoiceDetail         = new InvoiceDetailDL();
                    InspectionCertificateDL InspectionCertificate = new InspectionCertificateDL();

                    //INSPECTION CERTIFICATE DETAIL
                    List <InvoiceDetailBE> lstInvoiceDetail = null;
                    lstInvoiceDetail = new InvoiceDetailDL().ListaTodosActivo(pItem.IdInvoice);

                    foreach (var item in lstInvoiceDetail)
                    {
                        InspectionCertificate.ActualizaSituacion(item.IdInspectionCertificate, 14);

                        InvoiceDetail.Elimina(item);
                    }

                    Invoice.Elimina(pItem);

                    ts.Complete();
                }
            }
            catch (Exception ex)
            { throw ex; }
        }
 public List <InspectionCertificateBE> ListaInvoiceDetail(int IdCompany, string NumberCertificate)
 {
     try
     {
         InspectionCertificateDL InspectionCertificate = new InspectionCertificateDL();
         return(InspectionCertificate.ListaInvoiceDetail(IdCompany, NumberCertificate));
     }
     catch (Exception ex)
     { throw ex; }
 }
 public List <InspectionCertificateBE> ListaVendorStatus(int IdCompany, int IdVendor, int IdStatus, int NumberIni, int NumberFin)
 {
     try
     {
         InspectionCertificateDL InspectionCertificate = new InspectionCertificateDL();
         return(InspectionCertificate.ListaVendorStatus(IdCompany, IdVendor, IdStatus, NumberIni, NumberFin));
     }
     catch (Exception ex)
     { throw ex; }
 }
 public List <InspectionCertificateBE> ListaNumberCertificate(int IdCompany, int IdClient, string NumberCertificate)
 {
     try
     {
         InspectionCertificateDL InspectionCertificate = new InspectionCertificateDL();
         return(InspectionCertificate.ListaNumberCertificate(IdCompany, IdClient, NumberCertificate));
     }
     catch (Exception ex)
     { throw ex; }
 }
 public List <InspectionCertificateBE> ListaClientDate(int IdCompany, int IdClient, int IdStatus, DateTime DateFrom, DateTime DateTo)
 {
     try
     {
         InspectionCertificateDL InspectionCertificate = new InspectionCertificateDL();
         return(InspectionCertificate.ListaClientDate(IdCompany, IdClient, IdStatus, DateFrom, DateTo));
     }
     catch (Exception ex)
     { throw ex; }
 }
 public void ActualizaSituacion(int IdInspectionCertificate, int IdStatus)
 {
     try
     {
         InspectionCertificateDL InspectionCertificate = new InspectionCertificateDL();
         InspectionCertificate.ActualizaSituacion(IdInspectionCertificate, IdStatus);
     }
     catch (Exception ex)
     { throw ex; }
 }
 public List <InspectionCertificateBE> ListaTodosActivo(int IdCompany)
 {
     try
     {
         InspectionCertificateDL InspectionCertificate = new InspectionCertificateDL();
         return(InspectionCertificate.ListaTodosActivo(IdCompany));
     }
     catch (Exception ex)
     { throw ex; }
 }
 public int SeleccionaBusquedaCount(int IdCompany, int IdClient)
 {
     try
     {
         InspectionCertificateDL InspectionCertificate = new InspectionCertificateDL();
         return(InspectionCertificate.SeleccionaBusquedaCount(IdCompany, IdClient));
     }
     catch (Exception ex)
     { throw ex; }
 }
 public InspectionCertificateBE SeleccionaNumberInvoice(string NumberInvoice)
 {
     try
     {
         InspectionCertificateDL InspectionCertificate = new InspectionCertificateDL();
         InspectionCertificateBE objEmp = InspectionCertificate.SeleccionaNumberInvoice(NumberInvoice);
         return(objEmp);
     }
     catch (Exception ex)
     { throw ex; }
 }
 public InspectionCertificateBE Selecciona(int IdInspectionCertificate)
 {
     try
     {
         InspectionCertificateDL InspectionCertificate = new InspectionCertificateDL();
         InspectionCertificateBE objEmp = InspectionCertificate.Selecciona(IdInspectionCertificate);
         return(objEmp);
     }
     catch (Exception ex)
     { throw ex; }
 }
        public void ActualizaSituacion(int IdInvoice, int IdStatus)
        {
            try
            {
                InvoiceDL Invoice = new InvoiceDL();
                Invoice.ActualizaSituacion(IdInvoice, IdStatus);

                //INSPECTION CERTIFICATE DETAIL
                InspectionCertificateDL InspectionCertificate = new InspectionCertificateDL();
                List <InvoiceDetailBE>  lstInvoiceDetail      = null;
                lstInvoiceDetail = new InvoiceDetailDL().ListaTodosActivo(IdInvoice);

                foreach (var item in lstInvoiceDetail)
                {
                    InspectionCertificate.ActualizaSituacion(item.IdInspectionCertificate, 14);
                }
            }
            catch (Exception ex)
            { throw ex; }
        }
        public void ActualizaSituacionMasivo(List <InspectionCertificateBE> pListaInspectionCertificate)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    InspectionCertificateDL objInspectionCertificate = new InspectionCertificateDL();

                    foreach (InspectionCertificateBE item in pListaInspectionCertificate)
                    {
                        objInspectionCertificate.ActualizaSituacion(item.IdInspectionCertificate, item.IdStatus);
                    }

                    ts.Complete();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }