Пример #1
0
        public async Task <IActionResult> PutDetalleReceta(long id, DetalleReceta detalleReceta)
        {
            if (id != detalleReceta.Id)
            {
                return(BadRequest());
            }

            _context.Entry(detalleReceta).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DetalleRecetaExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #2
0
        public async Task <ActionResult <DetalleReceta> > PostDetalleReceta(DetalleReceta detalleReceta)
        {
            _context.DetallesRecetas.Add(detalleReceta);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetDetalleReceta", new { id = detalleReceta.Id }, detalleReceta));
        }
        public DlgModificarReceta(MySqlConnection xConnection, int nIdReceta = 0, bool bModify = false, int nIdDetalleBit = 0)
        {
            InitializeComponent();
            this.xConnection   = xConnection;
            this.xReceta       = new Recetas(xConnection);
            this.xDetalleRec   = new DetalleReceta(xConnection);
            this.xBitacora     = new Bitacora(xConnection);
            this.xInventario   = new Inventario(xConnection);
            this.nIdReceta     = nIdReceta;
            this.nIdDetalleBit = nIdDetalleBit;

            if (nIdReceta > 0)
            {
                ConsultarReceta();
            }
            else if (nIdDetalleBit > 0)
            {
                ConsultarBitacora();
            }

            if (bModify)
            {
                tbNombre.ReadOnly    = true;
                btnAgregar.Visible   = false;
                btnConfirmar.Visible = false;
                dgvIngredientes.Columns[3].ReadOnly = true;
                dgvIngredientes.Columns[4].Visible  = false;
            }
        }
Пример #4
0
        private void btnAgregarReceta_Click(object sender, EventArgs e)
        {
            DetalleReceta dc = new DetalleReceta();

            dc.cantidad    = Convert.ToString(txtCantidad.Text);
            dc.paciente    = (Paciente)cmbPaciente.SelectedItem;
            dc.medicamento = (Medicamento)cmbMedicamento.SelectedItem;
            receta.detalle_receta.Add(dc);
            ActualizarDataGrid();
        }
Пример #5
0
 private void btnEliminarReceta_Click(object sender, EventArgs e)
 {
     {
         DetalleReceta dd = (DetalleReceta)dtgDetalleReceta.CurrentRow.DataBoundItem;
         if (dd != null)
         {
             receta.detalle_receta.Remove(dd);
         }
         ActualizarDataGrid();
     }
 }