/// <summary> /// ELIMINA un registro de la Entidad GestionComercial.ProductoPrecio /// En la BASE de DATO la Tabla : [GestionComercial.ProductoPrecio] /// <summary> /// <param name="filtro"></param> /// <returns></returns> public DTOResponseProcedure Delete(BaseFiltroProductoPrecio filtro) { DTOResponseProcedure codigoRetorno = null; try { using (_GestionComercialDataContext SQLDC = new _GestionComercialDataContext(conexion)) { var reslutDelete = SQLDC.omgc_D_ProductoPrecio(filtro.codEmpresa, filtro.codProductoPrecio, filtro.segUsuarioActual, filtro.segIPMaquinaPC); foreach (var item in reslutDelete) { codigoRetorno = new DTOResponseProcedure { ErrorCode = item.ErrorCode.HasValue ? item.ErrorCode.Value : 0, ErrorMessage = item.ErrorMessage }; } return(codigoRetorno); } } catch (Exception ex) { throw ex; } }
/// <summary> /// ACTUALIZA EL ULTIMO Nº EMITIDO EN +1 del registro de una ENTIDAD de registro de Tipo ComprobantesSeries /// En la BASE de DATO la Tabla : [GestionComercial.ComprobantesSeries] /// <summary> /// <param name="objDocumentoSerie"></param> /// <returns></returns> public DTOResponseProcedure UpdateUltimo(BEDocumentoSerie objDocumentoSerie) { DTOResponseProcedure codigoRetorno = null; try { using (_GestionComercialDataContext SQLDC = new _GestionComercialDataContext(conexion)) { var result = SQLDC.omgc_U_DocumentoSerie_Ultimo(objDocumentoSerie.codEmpresaRUC, objDocumentoSerie.codDocumentoSerie, objDocumentoSerie.segUsuarioEdita, objDocumentoSerie.segMaquinaEdita); foreach (var item in result) { codigoRetorno = new DTOResponseProcedure { ErrorCode = item.ErrorCode.HasValue ? item.ErrorCode.Value : 0, ErrorMessage = item.ErrorMessage }; } return(codigoRetorno); } } catch (Exception ex) { throw ex; } }
/// <summary> /// ELIMINA un registro de la Entidad GestionComercial.ComprobantesSeries /// En la BASE de DATO la Tabla : [GestionComercial.ComprobantesSeries] /// <summary> /// <param name="prm_CodigoTalonario"></param> /// <returns></returns> public DTOResponseProcedure Delete(string prm_codEmpresaRUC, int prm_codDocumentoSerie, string prm_SegUsuarioDelete, string prm_SegMaquina) { DTOResponseProcedure codigoRetorno = null; try { using (_GestionComercialDataContext SQLDC = new _GestionComercialDataContext(conexion)) { var result = SQLDC.omgc_D_DocumentoSerie(prm_codEmpresaRUC, prm_codDocumentoSerie, prm_SegUsuarioDelete, prm_SegMaquina); foreach (var item in result) { codigoRetorno = new DTOResponseProcedure { ErrorCode = item.ErrorCode.HasValue ? item.ErrorCode.Value : 0, ErrorMessage = item.ErrorMessage }; } return(codigoRetorno); } } catch (Exception ex) { throw ex; } }
/// <summary> /// Almacena el registro de una ENTIDAD de registro de Tipo ProductoFoto /// En la BASE de DATO la Tabla : [Almacen.ProductoFotos] /// <summary> /// <param name="itemProductoFotos"></param> /// <returns></returns> public DTOResponseProcedure InsertUpdate(BEProductoFoto productoFoto) { DTOResponseProcedure codigoRetorno = null; try { using (_AlmacenDataContext SQLDC = new _AlmacenDataContext(conexion)) { var result = SQLDC.omgc_I_ProductoFoto(productoFoto.codProducto, productoFoto.FotografiaF, productoFoto.Fotografia, productoFoto.Estado, productoFoto.segUsuarioCrea, productoFoto.segMaquinaEdita); foreach (var item in result) { codigoRetorno = new DTOResponseProcedure { ErrorCode = item.ErrorCode.HasValue ? item.ErrorCode.Value : 0, ErrorMessage = item.ErrorMessage }; } return(codigoRetorno); } } catch (Exception ex) { throw ex; } }
/// <summary> /// Almacena el registro de una ENTIDAD de registro de Tipo ProductoPrecio /// En la BASE de DATO la Tabla : [GestionComercial.ProductoPrecio] /// <summary> /// <param name="productoPrecio"></param> /// <returns></returns> public DTOResponseProcedure InsertUpdate(BEProductoPrecio productoPrecio) { DTOResponseProcedure codigoRetorno = null; try { using (_GestionComercialDataContext SQLDC = new _GestionComercialDataContext(conexion)) { var resultInsertUpdate = SQLDC.omgc_I_ProductoPrecio( productoPrecio.codProductoPrecio, productoPrecio.codEmpresa, productoPrecio.codProducto, productoPrecio.CodigoArguMoneda, productoPrecio.CodigoListaPrecio, productoPrecio.CodigoPuntoVenta, productoPrecio.ValorCosto, productoPrecio.ValorVenta, productoPrecio.MargenUtilidad / 100, productoPrecio.MediaPorcentaje / 100, productoPrecio.PorcenComision / 100, productoPrecio.PorcenComisionMax / 100, productoPrecio.DescuentoMaximo / 100, productoPrecio.Estado, productoPrecio.segUsuarioCrea, productoPrecio.segMaquinaCrea); foreach (var item in resultInsertUpdate) { codigoRetorno = new DTOResponseProcedure { ErrorCode = item.ErrorCode, ErrorMessage = item.ErrorMessage }; } return(codigoRetorno); } } catch (Exception ex) { throw ex; } }
/// <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 ComprobantesSeries /// En la BASE de DATO la Tabla : [GestionComercial.ComprobantesSeries] /// <summary> /// <param name="objDocumentoSerie"></param> /// <returns></returns> public DTOResponseProcedure Update(BEDocumentoSerie objDocumentoSerie) { DTOResponseProcedure codigoRetorno = null; try { using (_GestionComercialDataContext SQLDC = new _GestionComercialDataContext(conexion)) { var result = SQLDC.omgc_U_DocumentoSerie( objDocumentoSerie.CodigoPersonaEmpre, objDocumentoSerie.codDocumentoSerie, objDocumentoSerie.CodigoComprobante, objDocumentoSerie.Descripcion, objDocumentoSerie.CodigoPuntoVenta, objDocumentoSerie.NombreReporte, objDocumentoSerie.NumeroSerie, objDocumentoSerie.NumeroInicio, objDocumentoSerie.NumeroFinal, objDocumentoSerie.UltimoEmitido, objDocumentoSerie.Estado, objDocumentoSerie.segUsuarioEdita, objDocumentoSerie.segMaquinaEdita); foreach (var item in result) { codigoRetorno = new DTOResponseProcedure { ErrorCode = item.ErrorCode.HasValue ? item.ErrorCode.Value : 0, ErrorMessage = item.ErrorMessage }; } return(codigoRetorno); } } catch (Exception ex) { throw ex; } }
/// <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); }