private Medicamento armarBusquedaMedicamento() { Medicamento medicamento = new Medicamento(); if (nroMedicamentoBox.Text != "") medicamento.nroMedicamento = Convert.ToInt32(nroMedicamentoBox.Text); else medicamento.nroMedicamento = -1; medicamento.descripcion = descripcionBox.Text; return medicamento; }
private void bAgregar_Click(object sender, EventArgs e) { if (lbMedicamento.SelectedIndex != -1 && nCantidad.Value >= 1 && nCantidad.Value <= 3) { medicamento = new Medicamento(((Medicamento)lbMedicamento.SelectedItem).id, ((Medicamento)lbMedicamento.SelectedItem).nombre, (int)nCantidad.Value, dtpPrescripcion.Value); DialogResult = DialogResult.OK; } else MessageBox.Show("Errores en la eleccion de medicamento"); }
private Medicamento crearMedicamento(int fila) { Medicamento medicamento = new Medicamento(); int index = grillaMedicamentos.Columns["Nro. Medicamento"].Index; medicamento.nroMedicamento = Convert.ToInt32(grillaMedicamentos.Rows.SharedRow(fila).Cells[index].Value.ToString()); index = grillaMedicamentos.Columns["Descripcion Medicamento"].Index; medicamento.descripcion = grillaMedicamentos.Rows.SharedRow(fila).Cells[index].Value.ToString(); return medicamento; }
private void btnGuardar_Click(object sender, EventArgs e) { if (txtNombre.Text.Length == 0) { MessageBox.Show("Debe ingresar el Nombre...!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (txtPrecioUnidad.Text.Length == 0) { MessageBox.Show("Debe ingresar el Precio...!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (txtUnidades.Text.Length == 0) { MessageBox.Show("Debe ingresar las Unidades...!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { TransaccionClient proxy = new TransaccionClient(); proxy.Open(); Medicamento medi = new Medicamento(); double precio = Double.Parse(txtPrecioUnidad.Text) / 100; medi.NombreMedicamento = txtNombre.Text; medi.PrecioUnidad = precio; medi.UnidadesEnExistencia = int.Parse(txtUnidades.Text); DialogResult Confirmacion = MessageBox.Show("Esta seguro de Guardar los Cambios?", "CONFIRMACION", MessageBoxButtons.YesNo); if (Confirmacion == DialogResult.Yes) { proxy.CrearMedicamento(medi); MessageBox.Show("MEDICAMENTO AGREGADO CORRECTAMENTE","EXITO",MessageBoxButtons.OK,MessageBoxIcon.Exclamation); lblId.Text = ""; txtNombre.Text = ""; txtPrecioUnidad.Text = ""; txtUnidades.Text = ""; txtNombre.Enabled = false; txtPrecioUnidad.Enabled = false; txtUnidades.Enabled = false; btnGuardar.Enabled = false; btnNuevo.Enabled = true; } //else if (Confirmacion == DialogResult.No) //{ //} } }
private void btnEliminar_Click(object sender, EventArgs e) { { Medicamento medicamento = (Medicamento)lstMedicamento.SelectedItem; if (medicamento != null) { Medicamento.EliminarMedicamento(medicamento); ActualizarListaMedicamento(); LimpiarFormulario(); } else { MessageBox.Show("Por favor, Seleccione un item de la lista"); } } }
protected void btnPedir_Click(object sender, EventArgs e) { Pedido p; Medicamento m = (Medicamento)Session["medicamento"]; Cliente c = (Cliente)Session["usuario"]; try { p = new Pedido(0, c, m, Convert.ToInt32(lblCantidad.Text), ""); LogicaPedido.Agregar(p); } catch (Exception ex) { lblError.Text = ex.Message; } }
public bool EstaRelacionado(Medicamento medicamento) { try { var CadenaComando = "SELECT MedicamentoId FROM Lotes WHERE MedicamentoId=@id"; var Comando = new SqlCommand(CadenaComando, _connection); Comando.Parameters.AddWithValue("@id", medicamento.MedicamentoId); var reader = Comando.ExecuteReader(); return(reader.HasRows); } catch (Exception e) { throw new Exception(e.Message); } }
// GET: AgendamedicamentoController/Details/5 public ActionResult Details(int id) { Agendamedicamento agendamedicamento = _agendamedicamentoService.Obter(id); Medicamento medicamento = _medicamentoService.Obter(agendamedicamento.IdMedicamento); Animal animal = _animalService.Obter(agendamedicamento.IdAnimal); Consulta consulta = _consultaService.Obter(agendamedicamento.IdConsulta); Pessoa pessoa = _pessoaService.Obter(agendamedicamento.IdPessoa); ViewBag.Medicamento = medicamento.Nome; ViewBag.Animal = animal.Nome; ViewBag.Consulta = consulta.Descricao; ViewBag.Pessoa = pessoa.Nome; AgendamedicamentoModel agendamedicamentoModel = _mapper.Map <AgendamedicamentoModel>(agendamedicamento); return(View(agendamedicamentoModel)); }
public void pesquisarMedicamentoAnalitico(Int32 idAnalitico) { try { Medicamento medPesquisado = meds.pesquisar(new Medicamento(idAnalitico, null, null, null)); if (medPesquisado != null) { foreach (Lote lote in medPesquisado.Lotes) { Console.Write("\n Lote " + lote.Id + "\n" + " Quantidade: " + lote.Quantidade + "\n" + " Vencimento: " + lote.Vencimento + "\n"); } } } catch (Exception) { } }
// GET: Medicamento/Details/5 public ActionResult Details(int?id) { if (id == null) { TempData["mensaje"] = "Especifique el medicamento."; return(RedirectToAction("Index")); } Medicamento medicamento = db.Medicamento.Find(id); if (medicamento == null) { TempData["mensaje"] = "El medicamento no éxiste."; return(RedirectToAction("Index")); } return(View(medicamento)); }
public void InsertMedicamento(Medicamento medicamento) { sqlServerConnection = new SqlServerConnection(); SqlCommand cmd = null; SqlConnection connection = sqlServerConnection.Abrir(); //----------------------------INSERCION DATOS PROPIOS DE USUARIO----------------------------------------- string query = "INSERT INTO Medicamento (NombreGeneral, FormaFarmaceutica, Concentracion, PricipalIndicacion, PrecioUnidad, Activo, UnidadesEnvase, UnidadMedida, Categoria)" + "VALUES (@NombreGeneral, @FormaFarmaceutica, @Concentracion, @PricipalIndicacion, @PrecioUnidad, @Activo, @UnidadesEnvase, @UnidadMedida, @Categoria);"; cmd = new SqlCommand(query, connection); //Se crean los parámetros cmd.Parameters.Add("@NombreGeneral", SqlDbType.VarChar); cmd.Parameters.Add("@FormaFarmaceutica", SqlDbType.VarChar); cmd.Parameters.Add("@Concentracion", SqlDbType.VarChar); cmd.Parameters.Add("@PricipalIndicacion", SqlDbType.VarChar); cmd.Parameters.Add("@PrecioUnidad", SqlDbType.Int); cmd.Parameters.Add("@Activo", SqlDbType.Int); cmd.Parameters.Add("@UnidadesEnvase", SqlDbType.Int); cmd.Parameters.Add("@UnidadMedida", SqlDbType.VarChar); cmd.Parameters.Add("@Categoria", SqlDbType.Int); //Inserción de datos a los parámetros cmd.Parameters["@NombreGeneral"].Value = medicamento.NombreGeneral; cmd.Parameters["@FormaFarmaceutica"].Value = medicamento.FormaFarmaceutica; cmd.Parameters["@Concentracion"].Value = medicamento.Concentracion; cmd.Parameters["@PricipalIndicacion"].Value = medicamento.PricipalIndicacion; cmd.Parameters["@PrecioUnidad"].Value = medicamento.PrecioUnidad; cmd.Parameters["@Activo"].Value = medicamento.Activo; cmd.Parameters["@UnidadesEnvase"].Value = medicamento.UnidadesEnvase; cmd.Parameters["@UnidadMedida"].Value = medicamento.UnidadMedida; cmd.Parameters["@Categoria"].Value = medicamento.Categoria; //Verificación de Query int res = cmd.ExecuteNonQuery(); if (res > 0) { MessageBox.Show("Inserción Exitosa", "Carita Feliz"); } else { MessageBox.Show("Explotóooo", "BUUUUM"); } sqlServerConnection.Cerrar(); }
public static void Modificar(Medicamento oMed) { SqlConnection oConexion = new SqlConnection(Conexion.STR); SqlCommand oComando = new SqlCommand("ModificarMedicamento", oConexion); oComando.CommandType = CommandType.StoredProcedure; oComando.Parameters.AddWithValue("@far", oMed.Far.ruc); oComando.Parameters.AddWithValue("@codigo", oMed.Codigo); oComando.Parameters.AddWithValue("@nombre", oMed.Nombre); oComando.Parameters.AddWithValue("@descripcion", oMed.Descripcion); oComando.Parameters.AddWithValue("@precio", oMed.Precio); SqlParameter oParametro = new SqlParameter("@Retorno", SqlDbType.Int); oParametro.Direction = ParameterDirection.ReturnValue; oComando.Parameters.Add(oParametro); try { oConexion.Open(); oComando.ExecuteNonQuery(); int valReturn = (int)oComando.Parameters["@Retorno"].Value; if (valReturn == 1) { throw new Exception("Modificacion exitosa"); } else if (valReturn == -1) { throw new Exception("Error - No existe tal Medicamento"); } else if (valReturn == -2) { throw new Exception("Error SQL"); } } catch (Exception ex) { throw ex; } finally { oConexion.Close(); } }
protected void bt_guardar_Click(object sender, EventArgs e) { try { remedio = new Medicamento(); stock = new StockMedicamento(); remedio.descripcion = txtName.Text.ToString(); remedio.monoDroga = txtName0.Text.ToString(); remedio.codigo = generarCodigo(); remedio.descripcionAmpliada = txt_ampliada.Text; //Guarda el stock necesario y de alerta para este tipo de medicamento que está creando remedio.stockInicioMes = Convert.ToInt32(txt_stockInicial.Text); remedio.stockMinimo = Convert.ToInt32(txt_stockMinimo.Text); remedio.stockAlerta = Convert.ToInt32(txt_stockAlerta.Text); remedio.stockMaximo = Convert.ToInt32(txt_stockMax.Text); remedio.diasAlertas = Convert.ToInt32(txt_diasAlerta.Text); stock.codigoMedicamento = remedio.codigo; stock.codigoStock = generarCodigoStock(); stock.stockActual = Convert.ToInt32(txt_stockInicial.Text); stock.lote = 4; UnidadMedida um = iUniMed.getPorCriterio <UnidadMedida>(ddl_unidadMed.SelectedValue.ToString()).First <UnidadMedida>(); remedio.unidadMedida = um.codigoUnidadMed; Formato form = iformato.getPorCriterio <Formato>(ddl_Formato.SelectedValue.ToString()).First <Formato>(); remedio.formato = form.codigoPresentacion; iMed.save <Medicamento>(remedio); iStock.save <StockMedicamento>(stock); txtName.Text = ""; txtName0.Text = ""; txt_ampliada.Text = ""; txt_stockInicial.Text = ""; txt_stockInicial.Text = ""; txt_stockMinimo.Text = ""; txt_stockMax.Text = ""; txt_diasAlerta.Text = ""; String msj = "El medicamento ha sido creado correctamente, con el nro: " + remedio.codigo; Intermediario.confirmarCambios(); this.Page.Response.Write("<script language='JavaScript'>window.alert('" + msj + "');</script>"); } catch (Exception) { } }
//BAJA MEDICAMENTO public void BajaMedicamento(Medicamento medicamento) { //GET CONNECTION STRING SqlConnection connection = new SqlConnection(Conexion.ConnectionString); //STORED PROCEDURE SqlCommand sp = new SqlCommand("BajaMedicamento", connection); sp.CommandType = CommandType.StoredProcedure; //PARAMETROS sp.Parameters.AddWithValue("@Codigo", medicamento.pCodigo); sp.Parameters.AddWithValue("@Farmaceutica", medicamento.pFarmaceutica.pRUC); //RETORNO SqlParameter retorno = new SqlParameter("@retorno", SqlDbType.Int); retorno.Direction = ParameterDirection.ReturnValue; sp.Parameters.Add(retorno); try { connection.Open(); //BAJA MEIDICAMENTO sp.ExecuteNonQuery(); //RETORNO switch ((int)retorno.Value) { case 1: //EXITO break; //MEDICAMENTO NO EXISTE case -1: throw new Exception("El medicamento no existe."); //EXCEPCION NO CONTROLADA default: throw new Exception("Ha ocurrido un error vuelva a intentarlo mas tarde."); } } catch { throw; } finally { connection.Close(); } }
protected void btnModificar_Click(object sender, EventArgs e) { try { Medicamento m = (Medicamento)Session["medicamento"]; m.Nombre = txtNombre.Text.Trim(); m.Descripcion = txtDescripcion.Text; m.Precio = Convert.ToDouble(txtPrecio.Text); LogicaMedicamento.Modificar(m); } catch (Exception ex) { lblError.Text = ex.Message; } }
private void btnAgregar_Click(object sender, EventArgs e) { try { if (grbCargaDe.Text == "Ingrese Alergia") { Alergia_Service alerg_ser = new Alergia_Service(); Alergia alergias = new Alergia(); if (txtNombre.Text == "") { MessageBox.Show("Debe completar el campo"); txtNombre.Focus(); } else { // FALTA VERIFICAR QUE NO SE REPITA alergias.Nombre1 = txtNombre.Text.Trim(); alerg_ser.CargarAlergia(alergias); MessageBox.Show("Se cargo con exito"); this.Dispose(); } } else if (grbCargaDe.Text == "Ingrese Medicamento") { Medicamento_Service Medicament_Ser = new Medicamento_Service(); Medicamento Medicament = new Medicamento(); if (txtNombre.Text == "") { MessageBox.Show("Debe completar el campo"); txtNombre.Focus(); } else { // FALTA VERIFICAR QUE NO SE REPITA Medicament.Nombre1 = txtNombre.Text.Trim(); Medicament_Ser.CargarMedicamento(Medicament); MessageBox.Show("Se cargo con exito"); this.Dispose(); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public async Task <ActionResult> DeleteConfirmed(int id) { Medicamento medicamento = await db.Medicamento.FindAsync(id); if (medicamento == null) { return(Json(new { success = false, message = "No se encuentra" }, JsonRequestBehavior.AllowGet)); } //if (medicamento.Count > 0) //{ // return Json(new { success = false, message = "Esta Especie contiene Razas hijos, no es posible Eliminar" }, JsonRequestBehavior.AllowGet); //} db.Medicamento.Remove(medicamento); await db.SaveChangesAsync(); return(Json(new { success = true, message = "Registro de Medicamento Eliminado" }, JsonRequestBehavior.AllowGet)); }
// GET: /Medicamento/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Medicamento medicamento = db.Medicamento.Find(id); if (medicamento == null) { return(HttpNotFound()); } ViewBag.EspecieId = new SelectList(db.Especie, "EspecieId", "Descripcion", medicamento.EspecieId); ViewBag.LaboratorioId = new SelectList(db.Laboratorio, "LaboratorioId", "Descripcion", medicamento.LaboratorioId); ViewBag.TipoMedicamentoId = new SelectList(db.TipoMedicamento, "TipoMedicamentoId", "Descripcion", medicamento.TipoMedicamentoId); return(View(medicamento)); }
protected void btnEliminar_Click(object sender, EventArgs e) { try { Medicamento oMed = (Medicamento)Session["MedicamentoABM"]; LogicaMedicamento.Eliminar(oMed); this.LimpioFormulario(); lblError.Text = "Eliminacion exitosa"; } catch (Exception ex) { lblError.Text = ex.Message; } }
public ActionResult BuscarMedicina(string nombre) { //Buscar en arbol if (String.IsNullOrEmpty(nombre)) { return(View()); } else { //Medicamento encontrado = medicamentos.Find(x => x.nombre.Contains(nombre)); //Medicamento encontrado = medicamentos.Find(x => x.id == arbolMedicinas.Buscar(nombre)); Medicamento encontrado = buscarEnLista(arbolMedicinas.Buscar(nombre)); // YA FUNCIONA :) return(View(encontrado)); } }
public static void TomarMedicamento(int id) { using (Epilepsia_TP_Entities ctx = new Epilepsia_TP_Entities()) { try { Medicamento medicamento = ctx.Medicamento.Find(id); medicamento.UltimaVez = DateTime.Now; ctx.SaveChanges(); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("Excepción: " + e.Message); return; } } }
public void Salvar(MedicamentoDto medicamentoDto) { bool insert = false; Medicamento medicamento = Dao.Buscar <Medicamento>(m => m.Id.Equals(medicamentoDto.Codigo)).FirstOrDefault(); insert = medicamento == null; medicamento = AutoMapper.Mapper.Map(medicamentoDto, medicamento); if (insert) { Inserir(medicamento); } else { Atualizar(medicamento); } }
public IActionResult Eliminar(int id) { try { using (BDHospitalContext db = new BDHospitalContext()) { Medicamento oMedicamento = db.Medicamento.Where(x => x.Iidmedicamento == id).First(); db.Medicamento.Remove(oMedicamento); db.SaveChanges(); } } catch (Exception e) { Error = e.Message; } return(RedirectToAction("Index")); }
private void InOrderTraversal(Action <Medicamento <T> > action, AVLTreeNode <T> node) { if (node == null) { return; } var medicamento = new Medicamento <T>(); medicamento.nombre = node._Nombre; medicamento.Id_medicamento = node.Value; medicamento.Existencia = node._Existencia; InOrderTraversal(action, node.Left); action(medicamento); InOrderTraversal(action, node.Right); }
// GET: Medicamento/Edit/5 public ActionResult Edit(int?id) { if (id == null) { TempData["mensaje"] = "Especifique el medicamento."; return(RedirectToAction("Index")); } Medicamento medicamento = db.Medicamento.Find(id); if (medicamento == null) { TempData["mensaje"] = "El medicamento no éxiste."; return(RedirectToAction("Index")); } ViewBag.ID_EXPEDIENTE = new SelectList(db.Expediente, "id", "ID_PACIENTE", medicamento.ID_EXPEDIENTE); return(View(medicamento)); }
public ActionResult Create(int?id) { Medicamento medicamento = new Medicamento(); var med = from m in db.Medicamento where m.idMedicamento == id select m; foreach (Medicamento medi in med) { medicamento = medi; break; } ViewBag.idMedicamento = new SelectList(from m in db.Medicamento where m.idMedicamento == id select m, "idMedicamento", "nombreMedicamento"); return(View()); }
protected void btnModificar_Click(object sender, EventArgs e) { try { LogicaFarmaceutica logicaFarmaceutica = new LogicaFarmaceutica(); LogicaMedicamento logicaMedicamento = new LogicaMedicamento(); Farmaceutica farmaceutica = logicaFarmaceutica.BuscarFarmaceutica(ddlFarmaceuticas.SelectedItem.Value); if (farmaceutica == null) { throw new Exception("La farmaceutica no existe."); } string descripcion = txtDescripcion.Text; double precio; string nombre = txtNombre.Text; int codigo; //VARIFICAR INT try { codigo = Convert.ToInt32(txtCodigo.Text); } catch { throw new Exception("El codigo debe ser un numero."); } //VERIFICAR DOUBLE try { precio = double.Parse(txtPrecio.Text); } catch { throw new Exception("El precio debe ser un numero."); } Medicamento medicamento = new Medicamento(codigo, farmaceutica, nombre, descripcion, precio); logicaMedicamento.ModificarMedicamento(medicamento); lblERROR.ForeColor = System.Drawing.Color.Green; lblERROR.Text = "Modificacion exitosa."; } catch (Exception ex) { lblERROR.ForeColor = System.Drawing.Color.Red; lblERROR.Text = ex.Message; } }
protected void ImageButton3_Click(object sender, ImageClickEventArgs e) { Paciente oPaciente = LPaciente.Find(x => x.dni == txtdni.Text); Diagnostico oDiagnostico = oPaciente.ultimodiagnostico(); Medicamento oMedicamento = LMedicamentos.Find(x => x.nombre == DropMedicamentos.Text); DropMedicamentos.Items.Remove(DropMedicamentos.Text); oDiagnostico.AddMedicamento(oMedicamento); if (DropMedicamentos.Items.Count == 0) { string save = "No hay medicamentos recomendados"; this.Page.Response.Write("<script language='JavaScript'>window.alert('" + save + "');</script>"); Server.Transfer("MenuPrincipal.aspx"); } }
public ActionResult Create([Bind(Include = "MedicamentoId,Nombre,EspecieId,TipoMedicamentoId,LaboratorioId,Descripcion,Precio,Stock,Estado")] Medicamento medicamento) { ViewBag.Especies = new SelectList(db.Especie, "EspecieId", "Descripcion", medicamento.EspecieId); ViewBag.Laboratorios = new SelectList(db.Laboratorio, "LaboratorioId", "Descripcion", medicamento.LaboratorioId); ViewBag.TipoMedicamentos = new SelectList(db.TipoMedicamento, "TipoMedicamentoId", "Descripcion", medicamento.TipoMedicamentoId); try { int registrado = db.SP_RegistrarMedicamento( medicamento.Nombre, medicamento.EspecieId, medicamento.TipoMedicamentoId, medicamento.LaboratorioId, medicamento.Descripcion, medicamento.Precio ); if (registrado > 0) { ViewBag.MessageSuccess = "Registro grabado!"; return(View(medicamento)); } return(View(medicamento)); } catch (EntityCommandExecutionException e) { if (e.InnerException.Message.Contains("NombreEspecieUK")) { ViewBag.MessageError = "Ya existe medicamento!"; } else if (e.InnerException.Message.Contains("FK")) { ViewBag.MessageError = "No se olvide de seleccionar Especie, Laboratorio y Tipo Medicamento"; } else { ViewBag.MessageError = "No se pudo guardar registro!"; } return(View(medicamento)); } catch (Exception e) { ViewBag.MessageError = e.Message; return(View(medicamento)); } }
public Medicamento ObterMedicamentoId(int id) { SqlCommand command = new SqlCommand(); command.Connection = Conexao.connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "obterMedicamentoId"; command.Parameters.AddWithValue("@id", id); Conexao.Conectar(); var reader = command.ExecuteReader(); Medicamento medicamento = null; try { while (reader.Read()) { medicamento = new Medicamento(); medicamento.Id_Med = Convert.ToInt32(reader["Id_Med"]); medicamento.Nome_Med = reader["Nome_Med"].ToString(); medicamento.Diluicao_Med = reader["Diluicao_Med"].ToString(); medicamento.Dose_Med = reader["Dose_Med"].ToString(); medicamento.Armazena_Med = reader["Armazena_Med"].ToString(); medicamento.Incompa_Med = reader["Armazena_Med"].ToString(); medicamento.Infusao_Med = reader["Infusao_Med"].ToString(); medicamento.Qtde_Med = Convert.ToInt32(reader["Qtde_Med"]); medicamento.Preco_Med = Convert.ToDouble(reader["Preco_Med"]); medicamento.Id_Fornecedor = Convert.ToInt32(reader["Id_Fornecedor"]); } return(medicamento); } catch (Exception) { throw; } finally { Conexao.Desconectar(); } }
public ActionResult Editar([FromBody] Medicamento medicamento) { if (!medicamento.validarDatos()) { return(BadRequest()); } MedicamentoImp medicamentoImp = new MedicamentoImp(new MedicamentoPersistencia()); bool seActualizo = medicamentoImp.editar(medicamento); if (seActualizo) { return(Ok()); } else { return(BadRequest()); } }
private void btnCadastrarMedicamento_Click(object sender, EventArgs e) { //Crio um medicamento com o construtor padrão para popular e adicionar na lista. Medicamento medicamentoQueVouAddNaLista = new Medicamento(); //Preencho as informacoes do medicamento com as informacoes digitadas pelo usuário medicamentoQueVouAddNaLista.Nome = txtNomeMedicamento.Text; medicamentoQueVouAddNaLista.IdadeMinima = Convert.ToInt32(txtIdadeMinima.Text); medicamentoQueVouAddNaLista.Dosagem = Convert.ToDouble(txtDosagem.Text); //Adiciono o medicamento na lista =) listaMedicamentos.Add(medicamentoQueVouAddNaLista); MessageBox.Show("Cadastrado com sucesso"); cbxMedicacaoProPaciente.DataSource = null; cbxMedicacaoProPaciente.DisplayMember = "Nome"; cbxMedicacaoProPaciente.DataSource = listaMedicamentos; }
public ActionResult Registrar([FromBody] Medicamento medicamento) { if (!medicamento.validarDatos()) { return(BadRequest()); } MedicamentoImp medicamentoImp = new MedicamentoImp(new MedicamentoPersistencia()); medicamentoImp.registrar(medicamento); if (medicamento.IdMedicamento > 0) { return(Ok(medicamento)); } else { return(BadRequest()); } }
public int ModificarMedicamento(Medicamento medicamentoNuevo) { try { var query = (from it in context.Medicamentos where it.Id == medicamentoNuevo.Id select it).FirstOrDefault(); query.Descripcion = medicamentoNuevo.Descripcion; query.Codigo = medicamentoNuevo.Codigo; query.Peso = medicamentoNuevo.Peso; context.SubmitChanges(); } catch (Exception) { return(2); } return(0); }
//Cuando selecciona un medicamento del codigo completa los datos del medicamento protected void completarDatos(object sender, EventArgs e) { String usar = ddl_medicamentos.SelectedValue; remedio = iMed.getPorCriterio<Medicamento>(usar).First<Medicamento>(); txt_descripcionMed.Text = remedio.descripcion; txt_codigoMed.Text = Convert.ToString(remedio.codigo); txt_cantidad.Text = ""; bt_cancel.Visible = true; bt_Nuevo.Visible = true; }
public ActionResult Actualizar(Medicamento medicamento) { var proxy = new TransaccionClient(); proxy.ModificarMedicamento(medicamento); return RedirectToAction("Index"); }
public ActionResult Crear(Medicamento nuevoMedicamento) { var proxy = new TransaccionClient(); proxy.CrearMedicamento(nuevoMedicamento); return RedirectToAction("Index"); }
private void btnBuscaMed_Click(object sender, RoutedEventArgs e) { Medicamento med = new Medicamento("Selecionar"); med.isCrud = false; med.Closing += new System.ComponentModel.CancelEventHandler(med_Closing); med.Show(); }
public List<Medicamento> ListMedicamento() { var list = new List<Medicamento>(); var Medicamento = new Medicamento { Id = 1, Nome = "NOVALGINA", Periodo = "1", TipoPeriodo = "Dias" }; var Medicamento2 = new Medicamento { Id = 2, Nome = "ASPIRINA", Periodo = "2", TipoPeriodo = "Meses" }; list.Add(Medicamento); list.Add(Medicamento2); return list; }
//Cuando selecciona un medicamento, completa los datos del medicamento protected void completarDatos(object sender, EventArgs e) { int totalActual = 0; String usar = ddl_medicamentos.SelectedValue; remedio = iMed.getPorCriterio<Medicamento>(usar).First<Medicamento>(); txt_descripcionMed.Text = remedio.descripcion; txt_codigoMed.Text = Convert.ToString(remedio.codigo); stockMed = iStockM.getCriterioById<StockMedicamento>("","", remedio.codigo).First<StockMedicamento>(); listaStkM = iStockM.getCriterioById<StockMedicamento>("", "", remedio.codigo); //calcula la cantidad total de stock foreach (StockMedicamento stk in listaStkM) { if (stk.fechaBaja == null) totalActual = totalActual + Convert.ToInt32(stk.stockActual); } txt_disponible.Text = Convert.ToString(totalActual); txt_cantidad.Text = ""; }
private List<Medicamento> AgregarAListaMedicamentos(Medicamento unMedicamento) { List<Medicamento> aux = receta.ListaMedicamentos; aux.Add(medicamento); return aux; }