public DataTable cargarTotal()
 {
     using (ServicioDetalle comp = new ServicioDetalle())
     {
         return(comp.CargaTotal());
     }
 }
 public DataTable cargarDetalle(int id)
 {
     using (ServicioDetalle comp = new ServicioDetalle())
     {
         return(comp.CargarDetalle(id));
     }
 }
        public string ingresarDetalle(int idP, int idV, int cant)
        {
            Detalle nuevoProducto = new Detalle(idP, idV, cant);

            using (ServicioDetalle elProducto = new ServicioDetalle())
                return(elProducto.ingresarDetalle(nuevoProducto));
        }
Beispiel #4
0
        private ServicioDetalle GetItemDetalle()
        {
            ServicioDetalle item = new ServicioDetalle();

            item.Id_Servicio_Detalle = 0;
            item.NombreServicio      = TextBoxNombreServicio.Text;
            item.Id_Servicio         = ((Servicio)ViewState["Servicio"]).Id_Servicio;
            item.Cantidad            = Utilidades.ToInt(this.TextBoxCantidad.Text);
            item.Precio  = Utilidades.ToDecimal(this.TextBoxPrecio.Text);
            item.Importe = item.Cantidad * item.Precio;
            return(item);
        }
Beispiel #5
0
        protected void BotonAgregarDetalle_Click(object sender, EventArgs e)
        {
            Servicio servicio = (Servicio)ViewState["Servicio"];

            if (ValidarNumericos())
            {
                ServicioDetalle nuevoItem = GetItemDetalle();
                servicio.Detalle.Add(nuevoItem);
                ViewState["Servicio"] = servicio;
                LlenarGrid();
                CalcularTotal();
                LimpiarCamposDetalle();
                Utilidades.ShowToastr(this, "Agregado Correctamente", "Correcto");
            }
            else
            {
                Utilidades.ShowToastr(this, "Error", "error", "warning");
            }
        }
        public IActionResult OnPost(int?id)
        {
            if (ModelState.IsValid)
            {
                if (id != null)
                {
                    var servicioDetalleDb = _context.ServicioDetalle.Include(a => a.ServicioId).FirstOrDefault(x => x.ServicioDetalleID == id);
                    servicioDetalleDb.DescripcionDetalleServicio = ServicioDetalle.DescripcionDetalleServicio;
                    _context.SaveChanges();
                }
                else
                {
                    var servicioDetalle = new ServicioDetalle
                    {
                        ServicioId = _context.Servicio.FirstOrDefault(x => x.ServicioID == Convert.ToInt32(servicioID)),
                        DescripcionDetalleServicio = ServicioDetalle.DescripcionDetalleServicio
                    };
                    _context.ServicioDetalle.Add(servicioDetalle);
                    _context.SaveChanges();
                }
            }

            return(RedirectToPage("Index"));
        }