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; } }
public void Inserta(VendorContactBE pItem) { try { VendorContactDL VendorContact = new VendorContactDL(); VendorContact.Inserta(pItem); } 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; } }