public Sintomas GetSymptoms(string sintomas) { try { OpenConnection(); string str = string.Format(@"SELECT Sintomas FROM dbo.Sintomas WHERE CodSintomas = @sintomas"); using (cmd = new SqlCommand(str, conn)) { cmd.Parameters.AddWithValue("@sintomas", sintomas); using (Dr = cmd.ExecuteReader()) { Sintomas model = null; while (Dr.Read()) { model = new Sintomas(); model.Sintoma = Convert.ToString(Dr[0]); } return(model); } } } catch (SqlException ex) { throw new Exception("Error the get the Symptoms " + ex.Message); } finally { ClosedConnection(); } }
internal void GetSintomas(CheckedListBox listSintomas, List <Sintomas> listaSin) { try { sql = "select * from sintoma"; SqlCommand comando1 = new SqlCommand(sql, con); con.Open(); reader = comando1.ExecuteReader(); while (reader.Read()) { Sintomas sin = new Sintomas(); sin.Id_Sintoma = Convert.ToInt32(reader.GetValue(0)); sin.Sintoma = reader.GetValue(1).ToString(); sin.Puntaje = Convert.ToInt32(reader.GetValue(2)); sin.Status = 0; listaSin.Add(sin); listSintomas.Items.Add(reader.GetValue(1)); } con.Close(); } catch (Exception e) { con.Close(); MessageBox.Show("" + e); } }
protected void btnRegistroSintomas_Click(object sender, EventArgs e) { /*THIS EVENT OF CLASS METHOD TO INSERT THE SYMPTOMS*/ try { if (txtSintomas.Text != "" && txtCodSintomas.Text != "") { var symptoms = new Sintomas(); symptoms.CodSintomas = txtCodSintomas.Text; symptoms.Sintoma = txtSintomas.Text; var registrar = new RegistrosEntrada(); registrar.InsertSintoms(symptoms); txtCodSintomas.Text = string.Empty; txtSintomas.Text = string.Empty; ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Registro feito com sucesso');", true); //lblMsg.Text = "Registro realizado com sucesso!"; //lblMsg.ForeColor = Color.Green; } else { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Ops!Campo Sintomas não pode ser vazio');", true); } } catch (Exception ex) { lblMsg.Text = "Erro ao registrar um novo sintomas" + ex.Message; } }
public List <Sintomas> listar() { AccesoaDatos datos = new AccesoaDatos(); Sintomas sintoma; List <Sintomas> lista = new List <Sintomas>(); try { datos.SetearQuery("SELECT * FROM Sintomas"); datos.EjecutarLector(); while (datos.lector.Read()) { sintoma = new Sintomas(); sintoma.ID = datos.lector.GetInt32(0); sintoma.Nombre = datos.lector.GetString(1); lista.Add(sintoma); } return(lista); } catch (Exception ex) { throw ex; } finally { datos.CerrarConexion(); } }
public ActionResult DeleteConfirmed(int id) { Sintomas sintomas = db.Sintomas.Find(id); db.Sintomas.Remove(sintomas); db.SaveChanges(); return(RedirectToAction("Index")); }
private void BtnNovoSintoma_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtNomeSintoma.Text)) { return; } Sintomas.Add(new Sintoma(txtNomeSintoma.Text)); txtNomeSintoma.Text = ""; RecarregarListaSintomas(); }
public ActionResult Edit([Bind(Include = "Id,nombre")] Sintomas sintomas) { if (ModelState.IsValid) { db.Entry(sintomas).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(sintomas)); }
public ActionResult Create([Bind(Include = "Id,nombre")] Sintomas sintomas) { if (ModelState.IsValid) { db.Sintomas.Add(sintomas); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(sintomas)); }
//Se conecata a la base de datos para insertar un nuevo síntoma private void AgregarSintomaButton_TouchUpInside(object sender, EventArgs e) { iOSConnection iOSConnection = new iOSConnection(); var connection = iOSConnection.DBiOSConnection(); DBConnection dbConnection = new DBConnection(connection); Sintomas sintoma = new Sintomas() { Nombre = nombreSintomaTextField.Text }; dbConnection.CreateSintoma(sintoma); }
// GET: Sintomas/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Sintomas sintomas = db.Sintomas.Find(id); if (sintomas == null) { return(HttpNotFound()); } return(View(sintomas)); }
public void modificar(Sintomas sintoma) { AccesoaDatos datos = new AccesoaDatos(); try { datos.SetearQuery("UPDATE Sintomas SET Nombre = @Nombre WHERE ID = @ID"); datos.agregarParametros("@Nombre", sintoma.Nombre); datos.agregarParametros("@ID", sintoma.ID); datos.EjecutarAccion(); } catch (Exception ex) { throw ex; } finally { datos.CerrarConexion(); } }
/// <summary> /// THIS METHOD TO DO THE INSERT THE SYMPTOMS /// </summary> /// <param name="model"></param> public void InsertSintoms(Sintomas model) { try { OpenConnection(); string str = string.Format(@"INSERT INTO Sintomas VALUES(@Codsintomas,@Sintomas)"); using (cmd = new SqlCommand(str, conn)) { cmd.Parameters.AddWithValue("@Codsintomas", model.CodSintomas); cmd.Parameters.AddWithValue("@Sintomas", model.Sintoma); cmd.ExecuteNonQuery(); } } catch (Exception ex) { throw new Exception("Error to the Insert a new symptoms" + ex.Message); } finally { ClosedConnection(); } }
//public void FilterPlants() //{ // try // { // var drp = new DropboxGenericos(); // ddlPlanta.DataSource = drp.FilterPlant(); // ddlPlanta.DataTextField = "Planta"; // ddlPlanta.DataValueField = "PlantaId"; // ddlPlanta.DataBind(); // ListItem item = new ListItem("SELECT PLANT", "VALUES", true); item.Selected = true; // ddlPlanta.Items.Add(item); // } // catch (Exception ex) // { // lblMsg.Text = "Erro ao listar a planta" + ex.Message; // } //} /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ddlCodFalhas_TextChanged(object sender, EventArgs e) { try { var cod = ddlCodFalhas.SelectedItem.Text; DropboxGenericos drl = new DropboxGenericos(); Sintomas model = drl.GetSymptoms(cod); if (model != null) { txtSintomas.Text = model.Sintoma; lblMsg.Text = string.Empty; txtCN.Enabled = true; } else { lblMsg.Text = "Nenhum sintomas encontrado"; lblMsg.ForeColor = Color.Red; } } catch (Exception ex) { lblMsg.Text = "Erro ao mostrar o Sintomas " + ex.Message; } }
private void Sintomasbtn(object sender, EventArgs e) { Detail = new Sintomas(); }