/// <summary> /// Almacena el registro de una ENTIDAD de registro de Tipo ProductoPrecio /// En la BASE de DATO la Tabla : [GestionComercial.ProductoPrecio] /// <summary> /// <param name="itemProductoPrecio"></param> /// <returns></returns> public ReturnValor InsertUpdate(BEProductoPrecio objProductoPrecio) { try { oReturnValor = validaDatos(objProductoPrecio, HelpEventos.Accion.Nuevo); if (!oReturnValor.Exitosa) { return(oReturnValor); } using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) { var resultUpdate = productoPrecioData.InsertUpdate(objProductoPrecio); oReturnValor.Exitosa = resultUpdate.ErrorCode > 0 ? true : false; oReturnValor.Message = oReturnValor.Exitosa ? HelpEventos.MessageEvento(HelpEventos.Process.NEW) : resultUpdate.ErrorMessage; if (oReturnValor.Exitosa) { tx.Complete(); } } } catch (Exception ex) { oReturnValor = HelpException.mTraerMensaje(ex, false, this.GetType().Name + '.' + MethodBase.GetCurrentMethod().Name, objProductoPrecio.segUsuarioEdita, objProductoPrecio.codEmpresa.ToString()); } return(oReturnValor); }
/// <summary> /// Almacena el registro de una ENTIDAD de registro de Tipo ListaDePrecioDetalle /// En la BASE de DATO la Tabla : [GestionComercial.ListaDePrecioDetalle] /// <summary> /// <param name="itemListaDePrecioDetalle"></param> /// <param name="listaProductoPrecio"></param> /// <returns></returns> public ReturnValor UpdateDetalle(BEListaDePrecioDetalle itemListaDePrecioDetalle, List <BEProductoPrecio> listaProductoPrecio) { DTOResponseProcedure objProductoPrecio = null; try { using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) { int indPrecioUpdate = -1; returnValor.Exitosa = listaDePrecioDetalleData.Update(itemListaDePrecioDetalle); ProductoPrecioData productoPrecioData = new ProductoPrecioData(); //listaProductoPrecio = oProductoPrecioData.List(itemListaDePrecioDetalle.CodigoProducto, string.Empty, null, itemListaDePrecioDetalle.CodigoPersonaEmpre, itemListaDePrecioDetalle.CodigoPuntoVenta, true); if (listaProductoPrecio.Count == 1) { if (itemListaDePrecioDetalle.refEsParaVenta) { listaProductoPrecio[0].ValorVenta = itemListaDePrecioDetalle.PrecioUnitario; } else { listaProductoPrecio[0].ValorCosto = itemListaDePrecioDetalle.PrecioUnitario; } listaProductoPrecio[0].segUsuarioCrea = itemListaDePrecioDetalle.segUsuarioEdita; listaProductoPrecio[0].segUsuarioEdita = itemListaDePrecioDetalle.segUsuarioEdita; objProductoPrecio = productoPrecioData.InsertUpdate(listaProductoPrecio[0]); } if (returnValor.Exitosa && objProductoPrecio.ErrorCode > 0) { returnValor.Message = HelpEventos.MessageEvento(HelpEventos.Process.EDIT); tx.Complete(); } } } catch (Exception ex) { returnValor = HelpException.mTraerMensaje(ex); } return(returnValor); }
/// <summary> /// Almacena el registro de una ENTIDAD de registro de Tipo ListaDePrecioDetalle /// En la BASE de DATO la Tabla : [GestionComercial.ListaDePrecioDetalle] /// <summary> /// <param name="listaListaDePrecioDetalle"></param> /// <param name="listaProductoPrecio"></param> /// <returns></returns> public ReturnValor InsertDetalle(List <BEListaDePrecioDetalle> lstListaDePrecioDetalle, List <BEProductoPrecio> lstProductoPrecio, int pcodEmpresa) { DTOResponseProcedure objProductoPrecio = null; try { using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) { foreach (BEListaDePrecioDetalle listaPrecioDetalle in lstListaDePrecioDetalle) { returnValor.codRetorno = listaDePrecioDetalleData.Insert(listaPrecioDetalle); if (returnValor.codRetorno != 0) { returnValor.Exitosa = true; } ProductoPrecioData productoPrecioData = new ProductoPrecioData(); lstProductoPrecio = productoPrecioData.List(new BaseFiltroProductoPrecio { codEmpresa = pcodEmpresa, codProducto = listaPrecioDetalle.codProducto, codRegMoneda = string.Empty, codListaPrecio = null, codEmpresaRUC = listaPrecioDetalle.CodigoPersonaEmpre, codPuntoVenta = listaPrecioDetalle.CodigoPuntoVenta, indEstado = true }); if (lstProductoPrecio.Count == 1) { if (listaPrecioDetalle.refEsParaVenta) { lstProductoPrecio[0].ValorVenta = listaPrecioDetalle.PrecioUnitario; } else { lstProductoPrecio[0].ValorCosto = listaPrecioDetalle.PrecioUnitario; } lstProductoPrecio[0].segUsuarioCrea = listaPrecioDetalle.segUsuarioEdita; lstProductoPrecio[0].segUsuarioEdita = listaPrecioDetalle.segUsuarioEdita; lstProductoPrecio[0].CodigoArguMoneda = listaPrecioDetalle.CodigoArguMoneda; lstProductoPrecio[0].codProducto = listaPrecioDetalle.codProducto; lstProductoPrecio[0].CodigoPuntoVenta = listaPrecioDetalle.CodigoPuntoVenta; lstProductoPrecio[0].CodigoListaPrecio = listaPrecioDetalle.CodigoLista; lstProductoPrecio[0].Estado = true; objProductoPrecio = productoPrecioData.InsertUpdate(lstProductoPrecio[0]); } } if (returnValor.Exitosa && objProductoPrecio.ErrorCode > 0) { returnValor.Message = HelpEventos.MessageEvento(HelpEventos.Process.NEW); tx.Complete(); } } } catch (Exception ex) { returnValor = HelpException.mTraerMensaje(ex); } return(returnValor); }