public void UpdateSQL(Medicamentos Medicamento) { Conexion con = new Conexion(); SqlCommand comand = new SqlCommand("sp_UpMedicamento", con.OpenConn()); comand.CommandType = CommandType.StoredProcedure; SqlParameter param0 = new SqlParameter("@id", SqlDbType.Int); param0.Value = Medicamento.IdMedicamento; SqlParameter param1 = new SqlParameter("@nombre", SqlDbType.VarChar); param1.Value = Medicamento.Nombre; SqlParameter param2 = new SqlParameter("@cat", SqlDbType.VarChar); param2.Value = Medicamento.Categoria; SqlParameter param3 = new SqlParameter("@precio", SqlDbType.Float); param3.Value = Medicamento.Precio; comand.Parameters.Add(param0); comand.Parameters.Add(param1); comand.Parameters.Add(param2); comand.Parameters.Add(param3); comand.ExecuteNonQuery(); con.CloseConn(); }
private void BtnModificar_Click(object sender, EventArgs e) { try { string nombre = TxtNombre.Text; string codico = Txtcodigo.Text; string detalle = TxtDetalle.Text; int cantidad = Convert.ToInt32(TxtCantidad.Text); decimal valor = Convert.ToDecimal(TxtValor.Text); string proveedor = CboxProveedores.Text; decimal impuesto = Convert.ToDecimal(TxtImpuesto.Text); Medicamentos medicamento = new Medicamentos(codico, nombre, cantidad, valor, detalle, proveedor, impuesto); string res = servicios.ModificarMedicamentos(medicamento); MessageBox.Show(res, "Resultado de Modificar", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtPrecioVenta.Text = Convert.ToString(medicamento.PrecioVenta); TxtImpuesto.Text = Convert.ToString(medicamento.Impuesto); TxtIva.Text = Convert.ToString(medicamento.Iva); } catch (Exception) { MessageBox.Show("Error xd ", "Resultado de Modificar", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public async Task <IActionResult> Edit(int id, [Bind("Id_medicamento,Atc,Generico,Nombre,Presentacion,Pvp,Acargoos,Acargoafil,Laboratorio,Registro,Pr,Plan,Grupoter,Obser")] Medicamentos medicamentos) { if (id != medicamentos.Id_medicamento) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(medicamentos); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MedicamentosExists(medicamentos.Id_medicamento)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(medicamentos)); }
private void BtnBuscar_Click_1(object sender, EventArgs e) { Medicamentos medicamento = servicios.BuscarMedicamento(Txtcodigo.Text); if (medicamento != null) { try { Txtcodigo.Text = medicamento.CodigoMedicamento; TxtCantidad.Text = Convert.ToString(medicamento.Cantidad); TxtDetalle.Text = medicamento.Detalle; TxtImpuesto.Text = Convert.ToString(medicamento.Impuesto); TxtNombre.Text = medicamento.NombreMedicamento; TxtPrecioVenta.Text = Convert.ToString(medicamento.PrecioVenta); TxtValor.Text = Convert.ToString(medicamento.ValorUnitario); TxtPrecioVenta.Text = Convert.ToString(medicamento.PrecioVenta); CboxProveedores.Text = medicamento.Proveedor; TxtIva.Text = Convert.ToString(medicamento.Iva); } catch (Exception E) { MessageBox.Show("Error !! " + E); } } else { MessageBox.Show("No se encontro"); } }
public async Task <IActionResult> Edit(int id, [Bind("id_medicamento,atc,generico,nombre,presentacion,pvp,acargoos,acargoafil,laboratorio,registro,pr,plan,grupoter,obser")] Medicamentos medicamentos) { if (id != medicamentos.id_medicamento) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(medicamentos); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MedicamentosExists(medicamentos.id_medicamento)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(medicamentos)); }
//realiza la busqueda del dato que se desea buscar recorriendo de forma recursiva los nodos del arbol. public ActionResult busqueda() { LinkedList <Inventario> listaenlazada = new LinkedList <Inventario>(); Inventario tabla = new Inventario(); Medicamentos medicamentos = new Medicamentos(); //se debe de ingresar el nombre del medicamento de forma correcta string Nombre = Request.Form["nombre"].ToString(); //si encuentra el valor, la función de busqueda devolverá un valor de tipo medicamento, el cual contiene toda la información del nodo medicamentos = arbol.Buscar(arbol.raiz, Nombre); tabla.ID = medicamentos.ID; tabla.Nombre = medicamentos.Nombre; tabla.Descripción = medicamentos.Descripción; tabla.Precio = medicamentos.Precio; tabla.Cantidad = medicamentos.Cantidad; tabla.CasaFarmaceutica = medicamentos.CasaFarmaceutica; if (listaenlazada.Count != 0) { listaenlazada.Remove(listaenlazada.First); } listaenlazada.AddFirst(tabla); var model = from puntos in listaenlazada select puntos; return(View("busqueda", model)); }
private void Grid_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { var RowsIndex = Grid.CurrentRow.Index; try { var Codigo = Grid.Rows[RowsIndex].Cells[0].Value.ToString(); var Descricao = Grid.Rows[RowsIndex].Cells[1].Value.ToString(); Parametros.Valor = Grid.Rows[RowsIndex].Cells[0].Value.ToString(); Parametros.Nome = Grid.Rows[RowsIndex].Cells[1].Value.ToString(); if (Parametros.Form == "Medicamentos") { Form tela = new Medicamentos(); tela.MdiParent = MdiParent; tela.Show(); } Close(); } catch { } }
// Para realizar el pedido, se le pedirá al usuario su nombre, nombre de la Medicina, Doc. Identificación, dirección y la cantidad que desea compra. public ActionResult HacerPedido() { LinkedList <Inventario> listaenlazada = new LinkedList <Inventario>(); Inventario tabla = new Inventario(); Medicamentos medicamentos = new Medicamentos(); // se debe de ingresar el nombre del medicamento de forma correcta string Nombre = Request.Form["nombre"].ToString(); int cantidad = Convert.ToInt32(Request.Form["cantidad"]); medicamentos = arbol.HacerPedido(arbol.raiz, Nombre, cantidad); tabla.ID = medicamentos.ID; tabla.Nombre = medicamentos.Nombre; tabla.Descripción = medicamentos.Descripción; tabla.Precio = medicamentos.Precio; tabla.Cantidad = medicamentos.Cantidad; tabla.CasaFarmaceutica = medicamentos.CasaFarmaceutica; // si la cantidad de medicamentos pedidos es 1 o menor, el nodo se debe de eliminar. if ((tabla.Cantidad == 0) || (tabla.Cantidad < 0)) { arbol.eliminar(arbol.raiz, Nombre); tabla = null; } listaenlazada.AddFirst(tabla); var model = from puntos in listaenlazada select puntos; return(View("HacerPedido", model)); }
public IHttpActionResult PutMedicamentos(int id, Medicamentos medicamentos) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != medicamentos.id_medicamento) { return(BadRequest()); } db.Entry(medicamentos).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!MedicamentosExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
private void AddProducto_Click(object sender, EventArgs e) { try { string nombre = TxtNombre.Text; string codico = Txtcodigo.Text; string detalle = TxtDetalle.Text; int cantidad = Convert.ToInt32(TxtCantidad.Text); decimal valor = Convert.ToDecimal(TxtValor.Text); string proveedor = CboxProveedores.Text; decimal impuesto = Convert.ToDecimal(TxtImpuesto.Text); Medicamentos medicamento = new Medicamentos(codico, nombre, cantidad, valor, detalle, proveedor, impuesto); string mensaje = servicios.GuardarMedicamentos(medicamento); TxtPrecioVenta.Text = Convert.ToString(medicamento.PrecioVenta); TxtImpuesto.Text = Convert.ToString(medicamento.Impuesto); TxtIva.Text = Convert.ToString(medicamento.Iva); DtgListadeProductos.DataSource = servicios.ConsultarMedicamentos(); MessageBox.Show(mensaje); } catch (Exception) { MessageBox.Show("Error al ingresar los datos"); } }
public ActionResult DeleteConfirmed(int id) { Medicamentos medicamentos = db.Medicamentos.Find(id); db.Medicamentos.Remove(medicamentos); db.SaveChanges(); return(RedirectToAction("Index")); }
public void update(int id, Medicamentos medicamento) { var _medicamento = find(id); _medicamento = medicamento; _context.Medicamentos.Update(_medicamento); _context.SaveChanges(); }
private void DtgListadeProductos_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (FrmIreceptor != null) { Medicamentos medicamento = (Medicamentos)DtgListadeProductos.CurrentRow.DataBoundItem; FrmIreceptor.Recibir(medicamento); } }
public int Import_Medicamentos(String file) { System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); //StreamReader objReader = new StreamReader(file); //string sLine = ""; int retorno = 0; int rowcurrent = 0; DaoMedicamentos daoMedic = new DaoMedicamentos(); try { using (var stream = File.Open(file, FileMode.Open, FileAccess.Read)) { using (var reader = ExcelReaderFactory.CreateReader(stream)) { do { while (reader.Read()) { if (rowcurrent >= 5) { Medicamentos Medic = new Medicamentos(); Medic.atc = reader.GetString(1).Trim(); // fields[0].ToString().Trim(); Medic.generico = reader.GetString(2).Trim(); // fields[1].ToString().Trim(); Medic.nombre = reader.GetString(3).Trim(); // fields[2].ToString().Trim(); Medic.presentacion = reader.GetString(4).Trim(); // fields[3].ToString().Trim(); Medic.pvp = reader.GetDouble(5); // Convert.ToInt32(fields[4].ToString().Trim()); } Medic.acargoos = reader.GetDouble(6); // Convert.ToInt32(fields[5].ToString().Trim()); } Medic.acargoafil = reader.GetDouble(7); // Convert.ToInt32(fields[6].ToString().Trim()); } Medic.laboratorio = reader.GetString(8).Trim(); // fields[7].ToString().Trim(); Medic.registro = reader.GetDouble(9); // Convert.ToInt32(fields[8].ToString().Trim()); } Medic.pr = reader.GetDouble(10); // Convert.ToInt32(fields[9].ToString().Trim()); } Medic.grupoter = reader.GetDouble(11); // Convert.ToInt32(fields[11].ToString().Trim()); } if (!reader.IsDBNull(12)) { Medic.obser = reader.GetString(12).Trim(); } else { Medic.obser = ""; } // fields[12].ToString().Trim();*/ if (daoMedic.Insert_Medicamentos(Medic)) { retorno++; } } rowcurrent++; } } while (reader.NextResult()); } } } catch (Exception ex) { } return(retorno); }
private void Button_Click_1(object sender, RoutedEventArgs e) { ControladorMedicamento ca = new ControladorMedicamento(); Medicamentos a = new Medicamentos(); a.IdMedicamento = Int32.Parse(txtId.Text); ca.DeleteSQL(a); Show(); }
private void cmbVentaMedicamento_SelectionChanged(object sender, SelectionChangedEventArgs e) { Medicamentos medica = new Medicamentos(); Object selectedItemEm = cmbVentaMedicamento.SelectedItem; empleadosAr[contador] = selectedItemEm.ToString(); contador += 1; }
public MedicamentosView() { Console.Write("" + " ------------------------------\n" + " Projeto Medicamentos\n" + " ------------------------------\n"); meds = new Medicamentos(); Thread.Sleep(1250); }
public string ModificarStock(Medicamentos medicamento) { Conexion.Open(); string respuesta; respuesta = repositoryMedicamento.ModificarStock(medicamento); Conexion.Close(); return(respuesta); }
public Medicamentos BuscarMedicamento(string codigo) { Conexion.Open(); Medicamentos medicamento = new Medicamentos(); medicamento.CodigoMedicamento = codigo; medicamento = repositoryMedicamento.BuscarMedicamentos(medicamento); Conexion.Close(); return(medicamento); }
public override void ReverseInit(object returndData) { base.ReverseInit(returndData); var newMedicamento = returndData as Medicamento; if (!Medicamentos.Contains(newMedicamento)) { Medicamentos.Add(newMedicamento); } }
public ActionResult Index(HttpPostedFileBase postedFile) { List <Inventario> inventario = new List <Inventario>(); string filePath = string.Empty; if (postedFile != null) { //dirección del archivo string path = Server.MapPath("~/archivo/"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } filePath = path + Path.GetFileName(postedFile.FileName); string extension = Path.GetExtension(postedFile.FileName); postedFile.SaveAs(filePath); int contador = 0; string csvData = System.IO.File.ReadAllText(filePath); //El split del archivo es por columna foreach (string row in csvData.Split('\n')) { if ((!string.IsNullOrEmpty(row)) && (contador != 0)) { Inventario inventarios = new Inventario(); inventarios.ID = Convert.ToInt32(row.Split(';')[0]); inventarios.Nombre = " " + row.Split(';')[1]; inventarios.Descripción = row.Split(';')[2]; inventarios.CasaFarmaceutica = row.Split(';')[3]; inventarios.Precio = row.Split(';')[4]; inventarios.Cantidad = Convert.ToInt32(row.Split(';')[5]); inventario.Add(inventarios); lista.Add(inventarios); } else { contador++; } } } // al finalizar la lectura del archivo, los datos se ingresaron a una lista de forma ordenada // Se recorre la lista nodo por nodo para ingresar cada elemento que contenga el nodo dentro del arbol binario. foreach (Inventario nodo in inventario) { Medicamentos medicamentos = new Medicamentos(); medicamentos.ID = nodo.ID; medicamentos.Nombre = nodo.Nombre; medicamentos.Descripción = nodo.Descripción; medicamentos.CasaFarmaceutica = nodo.CasaFarmaceutica; medicamentos.Cantidad = nodo.Cantidad; medicamentos.Precio = nodo.Precio; Nodo actual = new Nodo(medicamentos); arbol.Insertar(actual); } return(View(inventario)); }
public List <Medicamentos> List_Medicamentos(string file) { StreamReader objReader = new StreamReader(file); string sLine = ""; List <Medicamentos> Return_list = new List <Medicamentos>(); while (sLine != null) { sLine = objReader.ReadLine(); if (sLine != null && sLine != "") { string[] fields = sLine.Split(','); if (fields[0] != "id") { if (fields[2].Trim() != "") { Medicamentos Medic = new Medicamentos(); Medic.atc = fields[0].ToString().Trim(); Medic.generico = fields[1].ToString().Trim(); Medic.nombre = fields[2].ToString().Trim(); Medic.presentacion = fields[3].ToString().Trim(); if (fields[4].Trim() != "") { Medic.pvp = Convert.ToInt32(fields[4].ToString().Trim()); } if (fields[5].Trim() != "") { Medic.acargoos = Convert.ToInt32(fields[5].ToString().Trim()); } if (fields[6].Trim() != "") { Medic.acargoafil = Convert.ToInt32(fields[6].ToString().Trim()); } Medic.laboratorio = fields[7].ToString().Trim(); if (fields[8].Trim() != "") { Medic.registro = Convert.ToInt32(fields[8].ToString().Trim()); } if (fields[9].Trim() != "") { Medic.pr = Convert.ToInt32(fields[9].ToString().Trim()); } if (fields[10].Trim() != "") { Medic.grupoter = Convert.ToInt32(fields[10].ToString().Trim()); } Medic.obser = fields[12].ToString().Trim(); Return_list.Add(Medic); } } } } objReader.Close(); return(Return_list); }
private void Button_Click(object sender, RoutedEventArgs e) { ControladorMedicamento ac = new ControladorMedicamento(); Medicamentos a = new Medicamentos(); a.Nombre = txtNombre.Text; a.Categoria = cmbTipo.Text; a.Precio = Double.Parse(txtPrecio.Text); ac.InsertSQL(a); Show(); }
public IHttpActionResult GetMedicamentos(int id) { Medicamentos medicamentos = db.Medicamentos.Find(id); if (medicamentos == null) { return(NotFound()); } return(Ok(medicamentos)); }
public async Task <IActionResult> Create([Bind("Id_medicamento,Atc,Generico,Nombre,Presentacion,Pvp,Acargoos,Acargoafil,Laboratorio,Registro,Pr,Plan,Grupoter,Obser")] Medicamentos medicamentos) { if (ModelState.IsValid) { _context.Add(medicamentos); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(medicamentos)); }
public ActionResult Edit([Bind(Include = "idMedicamento,idInventario,nombre,descripcion,dosis,idFarmacia")] Medicamentos medicamentos) { if (ModelState.IsValid) { db.Entry(medicamentos).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.idFarmacia = new SelectList(db.Farmacia, "idFarmacia", "nombre", medicamentos.idFarmacia); return(View(medicamentos)); }
public async Task <IActionResult> Create([Bind("id_medicamento,atc,generico,nombre,presentacion,pvp,acargoos,acargoafil,laboratorio,registro,pr,plan,grupoter,obser")] Medicamentos medicamentos) { if (ModelState.IsValid) { _context.Add(medicamentos); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(medicamentos)); }
private void btnGuardar_Click(object sender, EventArgs e) { if (!validar()) { } else { if (!(dataGridView1.SelectedRows.Count == 0)) { int idmed = int.Parse(dataGridView1.CurrentRow.Cells[0].Value.ToString()); int cantidad = int.Parse(txtCantidadIngresada.Text); Model model = new Model(); Medicamentos med = new Medicamentos(); InventarioMedicamentos im = new InventarioMedicamentos(); InventarioMedicamentos old = new InventarioMedicamentos(); old = model.Entidades.InventarioMedicamentos.Find(idmed); if (idmed != old.idmedicamento) { im.fechaCaducidad = dtFecha.Value.Date; im.CodLote = txtLote.Text; im.idmedicamento = idmed; string idprovee = cmbFabricante.SelectedItem.ToString(); proveedores p = model.Entidades.proveedores.Single(a => a.Nombre.Equals(idprovee)); im.idproveedor = p.idproveedor; if ((controladorinventario.insertarAinventario(im))) { MessageBox.Show("ok"); } else { MessageBox.Show("ERROR"); } } else // ACTUALIZA EL INVENTARIO DE MEDICAMENTOS { MessageBox.Show("ERROR COMPADRE"); } }//fin seleccion else { MessageBox.Show("POR FAVOR, SELECCIONE UNA OPCION"); } } /* * */ }
public IHttpActionResult PostMedicamentos(Medicamentos medicamentos) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Medicamentos.Add(medicamentos); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = medicamentos.id_medicamento }, medicamentos)); }
public ActionResult Update(int id, [FromBody] Medicamentos medicamento) { if (medicamento.id != id || !ModelState.IsValid) { return(BadRequest(ModelState)); } else { _medicamentoService.update(id, medicamento); return(Ok()); } }