public void Actualiza(VendorBE pItem, List <VendorAddressBE> pListaVendorAddress, List <VendorContactBE> pListaVendorContact, List <VendorClassificationBE> pListaVendorClassification)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    VendorDL               Vendor               = new VendorDL();
                    VendorAddressDL        VendorAddress        = new VendorAddressDL();
                    VendorContactDL        VendorContact        = new VendorContactDL();
                    VendorClassificationDL VendorClassification = new VendorClassificationDL();

                    foreach (var item in pListaVendorAddress)
                    {
                        if (item.TipoOper == Convert.ToInt32(Operacion.Nuevo)) //Nuevo
                        {
                            item.IdVendor = pItem.IdVendor;
                            VendorAddress.Inserta(item);
                        }
                        else
                        {
                            VendorAddress.Actualiza(item);
                        }
                    }

                    foreach (var item in pListaVendorContact)
                    {
                        if (item.TipoOper == Convert.ToInt32(Operacion.Nuevo)) //Nuevo
                        {
                            item.IdVendor = pItem.IdVendor;
                            VendorContact.Inserta(item);
                        }
                        else
                        {
                            VendorContact.Actualiza(item);
                        }
                    }

                    foreach (var item in pListaVendorClassification)
                    {
                        if (item.TipoOper == Convert.ToInt32(Operacion.Nuevo)) //Nuevo
                        {
                            item.IdVendor = pItem.IdVendor;
                            VendorClassification.Inserta(item);
                        }
                        else
                        {
                            VendorClassification.Actualiza(item);
                        }
                    }

                    Vendor.Actualiza(pItem);

                    ts.Complete();
                }
            }
            catch (Exception ex)
            { throw ex; }
        }
示例#2
0
 public void Elimina(VendorContactBE pItem)
 {
     try
     {
         VendorContactDL VendorContact = new VendorContactDL();
         VendorContact.Elimina(pItem);
     }
     catch (Exception ex)
     { throw ex; }
 }
示例#3
0
 public void Actualiza(VendorContactBE pItem)
 {
     try
     {
         VendorContactDL VendorContact = new VendorContactDL();
         VendorContact.Actualiza(pItem);
     }
     catch (Exception ex)
     { throw ex; }
 }
示例#4
0
 public List <VendorContactBE> ListaTodosActivo(int Vendor)
 {
     try
     {
         VendorContactDL VendorContact = new VendorContactDL();
         return(VendorContact.ListaTodosActivo(Vendor));
     }
     catch (Exception ex)
     { throw ex; }
 }
示例#5
0
 public VendorContactBE Selecciona(int IdVendorContact)
 {
     try
     {
         VendorContactDL VendorContact = new VendorContactDL();
         VendorContactBE objEmp        = VendorContact.Selecciona(IdVendorContact);
         return(objEmp);
     }
     catch (Exception ex)
     { throw ex; }
 }
        public void Elimina(VendorBE pItem)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    VendorDL               Vendor               = new VendorDL();
                    VendorAddressDL        VendorAddress        = new VendorAddressDL();
                    VendorContactDL        VendorContact        = new VendorContactDL();
                    VendorClassificationDL VendorClassification = new VendorClassificationDL();

                    List <VendorAddressBE> lstVendorAddress = null;
                    lstVendorAddress = new VendorAddressDL().ListaTodosActivo(pItem.IdVendor);

                    foreach (var item in lstVendorAddress)
                    {
                        VendorAddress.Elimina(item);
                    }

                    List <VendorContactBE> lstVendorContact = null;
                    lstVendorContact = new VendorContactDL().ListaTodosActivo(pItem.IdVendor);

                    foreach (var item in lstVendorContact)
                    {
                        VendorContact.Elimina(item);
                    }

                    List <VendorClassificationBE> lstVendorClassification = null;
                    lstVendorClassification = new VendorClassificationDL().ListaTodosActivo(pItem.IdVendor);

                    foreach (var item in lstVendorClassification)
                    {
                        VendorClassification.Elimina(item);
                    }



                    Vendor.Elimina(pItem);

                    ts.Complete();
                }
            }
            catch (Exception ex)
            { throw ex; }
        }
        public Int32 Inserta(VendorBE pItem, List <VendorAddressBE> pListaVendorAddress, List <VendorContactBE> pListaVendorContact, List <VendorClassificationBE> pListaVendorClassification)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    VendorDL               Vendor               = new VendorDL();
                    VendorAddressDL        VendorAddress        = new VendorAddressDL();
                    VendorContactDL        VendorContact        = new VendorContactDL();
                    VendorClassificationDL VendorClassification = new VendorClassificationDL();

                    int IdVendor = 0;
                    IdVendor = Vendor.Inserta(pItem);

                    foreach (var item in pListaVendorAddress)
                    {
                        item.IdVendor = IdVendor;
                        VendorAddress.Inserta(item);
                    }

                    foreach (var item in pListaVendorContact)
                    {
                        item.IdVendor = IdVendor;
                        VendorContact.Inserta(item);
                    }

                    foreach (var item in pListaVendorClassification)
                    {
                        item.IdVendor = IdVendor;
                        VendorClassification.Inserta(item);
                    }


                    ts.Complete();

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