public async Task Update(TablaDetalleDTO entity) { try { TablaDetalle tablaDetalle = mapper.Map <TablaDetalle>(entity); await tablaDetalleRepository.Update(tablaDetalle); } catch (Exception ex) { throw ex; } }
public IActionResult UpdateTablaEmpresaDetalle(int idDet, [FromBody] TablaDetalle entity) { try { tablaDetalleBusiness.Update(idDet, entity); return(Ok(true)); } catch (Exception) { throw; } }
public IActionResult CreateTablaEmpresaDetalle([FromBody] TablaDetalle entity) { try { tablaDetalleBusiness.Create(entity); return(Ok(true)); } catch (Exception) { throw; } }
public async Task <TablaDetalleDTO> GetById(int ind) { try { TablaDetalle tablaDetalle = await tablaDetalleRepository.GetById(ind); TablaDetalleDTO tablaDetalleDTO = mapper.Map <TablaDetalleDTO>(tablaDetalle); return(tablaDetalleDTO); } catch (Exception ex) { throw ex; } }
public void UpdateOrden(int IdDetalle, short Orden) { try { SiinErpContext context = new SiinErpContext(); TablaDetalle entity = context.TablasDetalles.Find(IdDetalle); entity.Orden = Orden; context.SaveChanges(); } catch (Exception ex) { errorBusiness.Create("UpdateOrdenTablaDetalle", ex.Message, null); throw; } }
public void Create(TablaDetalle entity) { try { entity.FechaCreacion = DateTimeOffset.Now; SiinErpContext context = new SiinErpContext(); context.TablasDetalles.Add(entity); context.SaveChanges(); } catch (Exception ex) { errorBusiness.Create("CreateTablaEmpresaDetalle", ex.Message, null); throw; } }
public void Update(int IdDetalle, TablaDetalle entity) { try { SiinErpContext context = new SiinErpContext(); TablaDetalle ob = context.TablasDetalles.Find(IdDetalle); ob.Codigo = entity.Codigo; ob.Descripcion = entity.Descripcion; ob.Estado = entity.Estado; ob.ModificadoPor = entity.ModificadoPor; ob.FechaModificado = DateTimeOffset.Now; context.SaveChanges(); } catch (Exception ex) { errorBusiness.Create("UpdateTablaDetalle", ex.Message, null); throw; } }
public Movimiento Imprimir(int IdMov) { try { SiinErpContext context = new SiinErpContext(); Movimiento entity = context.Movimientos.Find(IdMov); entity.sFechaFormatted = entity.FechaDoc.ToString("dd/MM/yyyy"); entity.NoDoc = entity.TipoDoc + entity.NumDoc; entity.sFechaVen = entity.FechaVencimiento.ToString("dd/MM/yyyy"); if (entity.IdEmpresa > 0) { Empresa entityEmpresa = context.Empresas.Find(entity.IdEmpresa); entity.NombreEmpresa = entityEmpresa.RazonSocial; entity.Empresa = entityEmpresa; } if (entity.IdDetAlmacen > 0) { TablaDetalle entityAlmacen = context.TablasDetalles.Find(entity.IdDetAlmacen); entity.NombreAlmacen = entityAlmacen.Descripcion; } if (entity.IdDetConcepto != null && entity.IdDetConcepto > 0) { TablaDetalle entityConcepto = context.TablasDetalles.Find(entity.IdDetConcepto); entity.NombreConcepto = entityConcepto.Descripcion; } if (entity.IdDetCenCosto != null && entity.IdDetCenCosto > 0) { TablaDetalle entityCentroCosto = context.TablasDetalles.Find(entity.IdDetCenCosto); entity.NombreCentroCosto = entityCentroCosto.Descripcion; } if (entity.IdPlazoPago != null && entity.IdPlazoPago > 0) { PlazoPago entityPlago = context.PlazosPagos.Find(entity.IdPlazoPago); entity.PlazoPago = entityPlago; } if (entity.IdTercero != null && entity.IdTercero > 0) { Tercero entityTercero = context.Terceros.Find(entity.IdTercero); entityTercero.NombreCiudad = context.Ciudades.Find(entityTercero.IdCiudad).NombreCiudad; entity.NombreTercero = entityTercero.NombreTercero; entity.Tercero = entityTercero; } if (entity.IdVendedor != null && entity.IdVendedor > 0) { Vendedor entityVendedor = context.Vendedores.Find(entity.IdVendedor); entity.NombreVendedor = entityVendedor.NombreVendedor; } if (entity.IdResolucion != null && entity.IdResolucion > 0) { entity.Resolucion = context.Resolucion.Find(entity.IdResolucion); entity.Resolucion.sFecha = entity.Resolucion.Fecha.ToString("yyyy-MM-dd"); } entity.ListaDetalle = (from d in context.MovimientosDetalles.Where(x => x.IdMovimiento == IdMov) join a in context.Articulos on d.IdArticulo equals a.IdArticulo select new MovimientoDetalle() { IdDetalleMovimiento = d.IdDetalleMovimiento, IdMovimiento = d.IdMovimiento, IdArticulo = d.IdArticulo, Cantidad = d.Cantidad, PcDscto = d.PcDscto, VrBruto = d.VrBruto, PcIva = d.PcIva, VrCosto = d.VrCosto, VrNeto = d.VrNeto, VrUnitario = d.VrUnitario, NombreArticulo = a.NombreArticulo, Articulo = a, CodArticulo = a.CodArticulo }).ToList(); return(entity); } catch (Exception ex) { errorBusiness.Create("ImprimirMovimiento", ex.Message, null); throw; } }
public async Task <IResponse> RegistrarAsync(Logger logger, AfiliacionRequest request) { var response = new Response(); string codRubro; logger.Info("[{0}] | UsuarioZiPago: [{1}] | Inicio.", nameof(RegistrarAsync)); using (var txAsync = await DbContext.Database.BeginTransactionAsync()) { try { if (!await tdService.VerificarExisteTablaDetalleAsync(logger, Constantes.strCodTablaRubroNegocio, request.OtroRubroNegocio)) { codRubro = await tdService.ObtenerMaxTablaDetalleAsync(logger, Constantes.strCodTablaRubroNegocio); codRubro = Convert.ToString(Convert.ToInt32(codRubro) + 1).PadLeft(3, '0'); TablaDetalle td = new TablaDetalle { Cod_Tabla = Constantes.strCodTablaRubroNegocio, Valor = codRubro, Descr_Valor = request.OtroRubroNegocio }; DbContext.TablasDetalle.Add(td); request.EntidadUsuario.CodigoRubroNegocio = codRubro; } DbContext.Attach(request.EntidadUsuario); DbContext.Entry(request.EntidadUsuario).Property("CodigoRubroNegocio").IsModified = true; DbContext.Entry(request.EntidadUsuario).Property("CodigoTipoPersona").IsModified = true; DbContext.Entry(request.EntidadUsuario).Property("CodigoTipoDocumento").IsModified = true; DbContext.Entry(request.EntidadUsuario).Property("NumeroDocumento").IsModified = true; DbContext.Entry(request.EntidadUsuario).Property("RazonSocial").IsModified = true; DbContext.Entry(request.EntidadUsuario).Property("ApellidoPaterno").IsModified = true; DbContext.Entry(request.EntidadUsuario).Property("ApellidoMaterno").IsModified = true; DbContext.Entry(request.EntidadUsuario).Property("Nombres").IsModified = true; DbContext.Entry(request.EntidadUsuario).Property("Sexo").IsModified = true; DbContext.Entry(request.EntidadUsuario).Property("FechaNacimiento").IsModified = true; DbContext.Entry(request.EntidadUsuario).Property("TelefonoMovil").IsModified = true; DbContext.Entry(request.EntidadUsuario).Property("TelefonoFijo").IsModified = true; DbContext.Entry(request.EntidadUsuario).Property("FechaActualizacion").IsModified = true; await DbContext.SaveChangesAsync(); DbContext.Add(request.EntidadDomicilio); await DbContext.SaveChangesAsync(); foreach (ComercioCuentaZiPago item in request.ListComercioCuenta) { ComercioZiPago comercio = new ComercioZiPago { CodigoComercio = item.ComercioZiPago.CodigoComercio, IdUsuarioZiPago = item.ComercioZiPago.IdUsuarioZiPago, Descripcion = item.ComercioZiPago.Descripcion, CorreoNotificacion = item.ComercioZiPago.CorreoNotificacion, Activo = Constantes.strValor_Activo, FechaCreacion = DateTime.Now }; CuentaBancariaZiPago cuenta = new CuentaBancariaZiPago { IdBancoZiPago = item.CuentaBancariaZiPago.IdBancoZiPago, NumeroCuenta = item.CuentaBancariaZiPago.NumeroCuenta, CodigoTipoCuenta = item.CuentaBancariaZiPago.CodigoTipoCuenta, CodigoTipoMoneda = item.CuentaBancariaZiPago.CodigoTipoMoneda, CCI = item.CuentaBancariaZiPago.CCI, Activo = Constantes.strValor_Activo, FechaCreacion = DateTime.Now }; ComercioCuentaZiPago comercioCuenta = new ComercioCuentaZiPago { Activo = Constantes.strValor_Activo, FechaCreacion = DateTime.Now }; var responseCtaExiste = await DbContext.ObtenerCuentaBancariaZiPagoAsync(cuenta); if (responseCtaExiste is null || responseCtaExiste.IdCuentaBancaria == 0) { comercioCuenta.ComercioZiPago = comercio; comercioCuenta.CuentaBancariaZiPago = cuenta; cuenta.ComerciosCuentasZiPago.Add(comercioCuenta); DbContext.Add(comercio); DbContext.Add(cuenta); await DbContext.SaveChangesAsync(); } else { comercioCuenta.ComercioZiPago = comercio; comercioCuenta.CuentaBancariaZiPago = responseCtaExiste; comercio.ComerciosCuentasZiPago.Add(comercioCuenta); DbContext.Add(comercio); await DbContext.SaveChangesAsync(); } } txAsync.Commit(); response.Mensaje = Constantes.strRegistroRealizado; }