public bool DeleteCotizacionDetalle(TbFaCotizacionDetalle domain)
        {
            try
            {
                //var cd = context.TbPrCompraDetalle.FirstOrDefault(c => c.Id == idCD);
                context.TbFaCotizacionDetalle.Remove(domain);
                context.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                AltivaLog.Log.Insertar(ex.ToString(), "Error");
                throw;
            }
        }
        public TbFaCotizacionDetalle SaveCotizacionDetalle(TbFaCotizacionDetalle domain)
        {
            try
            {
                context.TbFaCotizacionDetalle.Add(domain);
                context.SaveChanges();

                return(domain);
            }
            catch (Exception ex)
            {
                AltivaLog.Log.Insertar(ex.ToString(), "Error");

                throw;
            }
        }
예제 #3
0
 public bool DeleteCotizacionDetalle(TbFaCotizacionDetalle domain)
 {
     return(repository.DeleteCotizacionDetalle(domain));
 }
예제 #4
0
        public TbFaCotizacionDetalle ViewModelToDomainSingleCD(CotizacionDetalleViewModels viewModel, CotizacionViewModel compra)
        {
            var domain = new TbFaCotizacionDetalle
            {
                IdCotizacionDetalle = viewModel.IdCotizacionDetalle,
                IdInventario        = viewModel.IdInventario,
                FechaCreacion       = viewModel.FechaCreacion,
                IdUsuarioCreador    = viewModel.IdUsuarioCreador,
                IdCotizacion        = viewModel.IdCotizacion,
                Cantidad            = viewModel.Cantidad
            };

            float dolar = (float)compra.TipoCambioDolar;
            float euro  = (float)compra.TipoCambioEuro;

            if (compra.IdMoneda == 1)
            {
                domain.PrecioBase  = viewModel.PrecioBase;
                domain.PrecioDolar = domain.PrecioBase / dolar;
                domain.PrecioEuro  = domain.PrecioBase / euro;

                domain.SubTotalBase  = viewModel.SubTotalBase;
                domain.SubTotalDolar = domain.SubTotalBase / dolar;
                domain.SubTotalEuro  = domain.SubTotalBase / euro;

                domain.SubTotalGravadoBase  = viewModel.SubTotalGravadoBase;
                domain.SubTotalGravadoDolar = domain.SubTotalGravadoBase / dolar;
                domain.SubTotalGravadoEuro  = domain.SubTotalGravadoBase / euro;

                domain.SubTotalExcentoBase  = viewModel.SubTotalExcentoBase;
                domain.SubTotalExcentoDolar = domain.SubTotalExcentoBase / dolar;
                domain.SubTotalExcentoEuro  = domain.SubTotalExcentoBase / euro;

                domain.PorcDescuento = viewModel.PorcDescuento;

                domain.TotalDescuentoBase  = viewModel.TotalDescuentoBase;
                domain.TotalDescuentoDolar = domain.TotalDescuentoBase / dolar;
                domain.TotalDescuentoEuro  = domain.TotalDescuentoBase / euro;

                domain.SubTotalGravadoNetoBase  = viewModel.SubTotalGravadoNetoBase;
                domain.SubTotalGravadoNetoDolar = domain.SubTotalGravadoNetoBase / dolar;
                domain.SubTotalGravadoNetoEuro  = domain.SubTotalGravadoNetoBase / euro;

                domain.SubTotalExcentoNetoBase  = viewModel.SubTotalExcentoNetoBase;
                domain.SubTotalExcentoNetoDolar = domain.SubTotalExcentoNetoBase / dolar;
                domain.SubTotalExcentoNetoEuro  = domain.SubTotalExcentoNetoBase / euro;

                domain.MontoIvaBase  = viewModel.MontoIvaBase;
                domain.MontoIvaDolar = domain.MontoIvaBase / dolar;
                domain.MontoIvaEuro  = domain.MontoIvaBase / euro;

                domain.TotalBase  = viewModel.TotalBase;
                domain.TotalDolar = domain.TotalBase / dolar;
                domain.TotalEuro  = domain.TotalBase / euro;
            }
            else if (compra.IdMoneda == 2)
            {
                domain.PrecioBase  = viewModel.PrecioBase;
                domain.PrecioDolar = viewModel.PrecioBase / dolar;
                domain.PrecioEuro  = domain.PrecioBase / euro;

                domain.SubTotalBase  = viewModel.SubTotalBase;
                domain.SubTotalDolar = viewModel.SubTotalBase / dolar;
                domain.SubTotalEuro  = domain.SubTotalBase / euro;

                domain.SubTotalGravadoBase  = viewModel.SubTotalGravadoBase;
                domain.SubTotalGravadoDolar = viewModel.SubTotalGravadoBase / dolar;
                domain.SubTotalGravadoEuro  = domain.SubTotalGravadoBase / euro;

                domain.SubTotalExcentoBase  = viewModel.SubTotalExcentoBase;
                domain.SubTotalExcentoDolar = viewModel.SubTotalExcentoBase / dolar;
                domain.SubTotalExcentoEuro  = domain.SubTotalExcentoBase / euro;

                domain.PorcDescuento = viewModel.PorcDescuento;

                domain.TotalDescuentoBase  = viewModel.TotalDescuentoBase;
                domain.TotalDescuentoDolar = viewModel.TotalDescuentoBase / dolar;
                domain.TotalDescuentoEuro  = domain.TotalDescuentoBase / euro;

                domain.SubTotalGravadoNetoBase  = viewModel.SubTotalGravadoNetoBase;
                domain.SubTotalGravadoNetoDolar = viewModel.SubTotalGravadoNetoBase / dolar;
                domain.SubTotalGravadoNetoEuro  = domain.SubTotalGravadoNetoBase / euro;

                domain.SubTotalExcentoNetoBase  = viewModel.SubTotalExcentoNetoBase;
                domain.SubTotalExcentoNetoDolar = viewModel.SubTotalExcentoNetoBase / dolar;
                domain.SubTotalExcentoNetoEuro  = domain.SubTotalExcentoNetoBase / euro;

                domain.MontoIvaBase  = viewModel.MontoIvaBase;
                domain.MontoIvaDolar = viewModel.MontoIvaBase / dolar;
                domain.MontoIvaEuro  = domain.MontoIvaBase / euro;

                domain.TotalBase  = viewModel.TotalBase;
                domain.TotalDolar = viewModel.TotalBase / dolar;
                domain.TotalEuro  = domain.TotalBase / euro;
            }
            else if (compra.IdMoneda == 3)
            {
                domain.PrecioBase  = viewModel.PrecioBase;
                domain.PrecioDolar = domain.PrecioBase / dolar;
                domain.PrecioEuro  = viewModel.PrecioBase / euro;

                domain.SubTotalBase  = viewModel.SubTotalBase;
                domain.SubTotalDolar = domain.SubTotalBase / dolar;
                domain.SubTotalEuro  = viewModel.SubTotalBase / euro;

                domain.SubTotalGravadoBase  = viewModel.SubTotalGravadoBase;
                domain.SubTotalGravadoDolar = domain.SubTotalGravadoBase / dolar;
                domain.SubTotalGravadoEuro  = viewModel.SubTotalGravadoBase / euro;

                domain.SubTotalExcentoBase  = viewModel.SubTotalExcentoBase;
                domain.SubTotalExcentoDolar = domain.SubTotalExcentoBase / dolar;
                domain.SubTotalExcentoEuro  = viewModel.SubTotalExcentoBase / euro;

                domain.PorcDescuento = viewModel.PorcDescuento;

                domain.TotalDescuentoBase  = viewModel.TotalDescuentoBase;
                domain.TotalDescuentoDolar = domain.TotalDescuentoBase / dolar;
                domain.TotalDescuentoEuro  = viewModel.TotalDescuentoBase / euro;

                domain.SubTotalGravadoNetoBase  = viewModel.SubTotalGravadoNetoBase;
                domain.SubTotalGravadoNetoDolar = domain.SubTotalGravadoNetoBase / dolar;
                domain.SubTotalGravadoNetoEuro  = viewModel.SubTotalGravadoNetoBase / euro;

                domain.SubTotalExcentoNetoBase  = viewModel.SubTotalExcentoNetoBase;
                domain.SubTotalExcentoNetoDolar = domain.SubTotalExcentoNetoBase / dolar;
                domain.SubTotalExcentoNetoEuro  = viewModel.SubTotalExcentoNetoBase / euro;

                domain.MontoIvaBase  = viewModel.MontoIvaBase;
                domain.MontoIvaDolar = domain.MontoIvaBase / dolar;
                domain.MontoIvaEuro  = viewModel.MontoIvaBase / euro;

                domain.TotalBase  = viewModel.TotalBase;
                domain.TotalDolar = domain.TotalBase / dolar;
                domain.TotalEuro  = viewModel.TotalBase / euro;
            }

            return(domain);
        }
예제 #5
0
 public TbFaCotizacionDetalle SaveCotizacionDetalle(TbFaCotizacionDetalle domain)
 {
     return(repository.SaveCotizacionDetalle(domain));
 }