public bool DeleteFuncionario(Terminos termino) { bool completed = false; OleDbConnection connection = new OleDbConnection(connectionString); OleDbCommand cmd = connection.CreateCommand(); cmd.Connection = connection; try { connection.Open(); cmd.CommandText = "DELETE FROM Terminos WHERE IdTermino = @IdTermino"; cmd.Parameters.AddWithValue("@IdTermino", termino.IdTermino); cmd.ExecuteNonQuery(); completed = true; } catch (OleDbException ex) { string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name; ErrorUtilities.SetNewErrorMessage(ex, methodName + " Exception,TerminosModel", "BusquedaLatinos"); } catch (Exception ex) { string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name; ErrorUtilities.SetNewErrorMessage(ex, methodName + " Exception,TerminosModel", "BusquedaLatinos"); } finally { cmd.Dispose(); connection.Close(); } return(completed); }
public IHttpActionResult PostTerminos(Terminos terminos) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Terminos.Add(terminos); try { db.SaveChanges(); } catch (DbUpdateException) { if (TerminosExists(terminos.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = terminos.Id }, terminos)); }
private void LstTerminos_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { selectedTermino = LstTerminos.SelectedItem as Terminos; if (selectedTermino != null) { if (selectedTermino.Iuses == null) { new TerminosModel().GetTesisRelacionadas(selectedTermino); if (selectedTermino.Iuses != null && selectedTermino.Iuses.Count > 0) { selectedTermino.Tesis = new TesisModel().GetDetalleTesisRel(selectedTermino.Iuses); LblTotalRelaciones.Content = String.Format("{0} tesis relacionadas", selectedTermino.Tesis.Count()); } else { LblTotalRelaciones.Content = "No hay tesis relacionadas con este término"; } } else if (selectedTermino.Tesis != null && selectedTermino.Tesis.Count > 0) { LblTotalRelaciones.Content = String.Format("{0} tesis relacionadas", selectedTermino.Tesis.Count()); } else { LblTotalRelaciones.Content = "No hay tesis relacionadas con este término"; } GTesis.DataContext = selectedTermino.Tesis; TxtDefinicion.Text = selectedTermino.Definicion; TxtBiblio.Text = selectedTermino.Bibliografia; } }
public IHttpActionResult PutTerminos(int id, Terminos terminos) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != terminos.Id) { return(BadRequest()); } db.Entry(terminos).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TerminosExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
private void LinkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { var Terminos = new Terminos(); Terminos.Shown += (o, args) => { this.Enabled = false; }; Terminos.FormClosed += (o, args) => { this.Enabled = true; }; Terminos.Show(); }
/// <summary> /// Muestra el detalle de tesis con la posibilidad de navegar a traves de un listado /// </summary> /// <param name="listaTesis">Lista de Tesis mostrada en la ventana principal</param> /// <param name="posActual">Posición de la tesis seleccionada dentro del listado mostrado</param> public UnaTesisWin(ObservableCollection <TesisDto> listaTesis, int posActual, Terminos terminoSeleccionado) { InitializeComponent(); this.PosActual = posActual; this.ListaTesis = listaTesis; this.terminoSeleccionado = terminoSeleccionado; controller = new UnaTesisWinController(this, listaTesis[posActual]); }
public IHttpActionResult GetTerminos(int id) { Terminos terminos = db.Terminos.Find(id); if (terminos == null) { return(NotFound()); } return(Ok(terminos)); }
/// <summary> /// Permite imprimir el terminos seleccionado /// </summary> /// <param name="imprimir"></param> public void ImprimeSelección(Terminos termino) { oWord = new Microsoft.Office.Interop.Word.Application(); oDoc = oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing); this.PrintTerminos(new ObservableCollection <Terminos>() { termino }); oWord.Visible = true; }
public IHttpActionResult DeleteTerminos(int id) { Terminos terminos = db.Terminos.Find(id); if (terminos == null) { return(NotFound()); } db.Terminos.Remove(terminos); db.SaveChanges(); return(Ok(terminos)); }
public bool InsertaTermino(Terminos termino) { OleDbConnection connection = new OleDbConnection(connectionString); bool insertCompleted = false; termino.IdTermino = DataBaseUtilities.GetNextIdForUse("Terminos", "IdTermino", connection); try { connection.Open(); string sqlQuery = "INSERT INTO Terminos(IdTermino,Termino,TerminoStr,Definicion,Bibliografia)" + "VALUES (@IdTermino,@Termino,@TerminoStr,@Definicion,@Bibliografia)"; OleDbCommand cmd = new OleDbCommand(sqlQuery, connection); cmd.Parameters.AddWithValue("@IdTermino", termino.IdTermino); cmd.Parameters.AddWithValue("@Termino", termino.Termino); cmd.Parameters.AddWithValue("@TerminoStr", termino.TerminoStr); cmd.Parameters.AddWithValue("@Definicion", termino.Definicion); cmd.Parameters.AddWithValue("@Bibliografia", termino.Bibliografia); cmd.ExecuteNonQuery(); cmd.Dispose(); insertCompleted = true; } catch (OleDbException ex) { string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name; ErrorUtilities.SetNewErrorMessage(ex, methodName + " Exception,TerminosModel", "BusquedaLatinos"); } catch (Exception ex) { string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name; ErrorUtilities.SetNewErrorMessage(ex, methodName + " Exception,TerminosModel", "BusquedaLatinos"); } finally { connection.Close(); } return(insertCompleted); }
public void GetTesisRelacionadas(Terminos termino) { string sOleDb; OleDbCommand cmd; OleDbDataReader reader; OleDbConnection connection = new OleDbConnection(connectionString); try { connection.Open(); sOleDb = "SELECT IUS FROM RelTesis WHERE IdTermino = @IdTermino AND Pertinencia = 1 ORDER BY IUS"; cmd = new OleDbCommand(sOleDb, connection); cmd.Parameters.AddWithValue("@IdTermino", termino.IdTermino); reader = cmd.ExecuteReader(); if (termino.Iuses == null) { termino.Iuses = new List <int>(); } while (reader.Read()) { termino.Iuses.Add(Convert.ToInt32(reader["IUS"])); } } catch (OleDbException ex) { string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name; ErrorUtilities.SetNewErrorMessage(ex, methodName + " Exception,TerminosModel", "BusquedaLatinos"); } catch (Exception ex) { string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name; ErrorUtilities.SetNewErrorMessage(ex, methodName + " Exception,TerminosModel", "BusquedaLatinos"); } finally { connection.Close(); } }
public bool InsertaRelacion(Terminos termino, int ius) { OleDbConnection connection = new OleDbConnection(connectionString); bool insertCompleted = false; try { connection.Open(); string sqlQuery = "INSERT INTO RelTesis(IdTermino,Ius,Pertinencia)" + "VALUES (@IdTermino,@Ius,1)"; OleDbCommand cmd = new OleDbCommand(sqlQuery, connection); cmd.Parameters.AddWithValue("@IdTermino", termino.IdTermino); cmd.Parameters.AddWithValue("@Ius", ius); cmd.ExecuteNonQuery(); cmd.Dispose(); insertCompleted = true; } catch (OleDbException ex) { string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name; ErrorUtilities.SetNewErrorMessage(ex, methodName + " Exception,TerminosModel", "BusquedaLatinos"); } catch (Exception ex) { string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name; ErrorUtilities.SetNewErrorMessage(ex, methodName + " Exception,TerminosModel", "BusquedaLatinos"); } finally { connection.Close(); } return(insertCompleted); }
public bool UpdatePertinencia(Terminos termino, int ius, bool esPertinente) { OleDbConnection connection = new OleDbConnection(connectionString); OleDbDataAdapter dataAdapter; OleDbCommand cmd = connection.CreateCommand(); cmd.Connection = connection; bool insertCompleted = false; try { connection.Open(); DataSet dataSet = new DataSet(); DataRow dr; const string sqlQuery = "SELECT * FROM RelTesis WHERE IdTermino = @IdTermino AND Ius = @Ius"; dataAdapter = new OleDbDataAdapter(); dataAdapter.SelectCommand = new OleDbCommand(sqlQuery, connection); dataAdapter.SelectCommand.Parameters.AddWithValue("@IdTermino", termino.IdTermino); dataAdapter.SelectCommand.Parameters.AddWithValue("@Ius", ius); dataAdapter.Fill(dataSet, "RelTesis"); dr = dataSet.Tables["RelTesis"].Rows[0]; dr.BeginEdit(); dr["Pertinencia"] = (esPertinente) ? 1 : 0; dr.EndEdit(); dataAdapter.UpdateCommand = connection.CreateCommand(); dataAdapter.UpdateCommand.CommandText = "UPDATE RelTesis SET Pertinencia = @Pertinencia WHERE IdTermino = @IdTermino AND Ius = @Ius"; dataAdapter.UpdateCommand.Parameters.Add("@Pertinencia", OleDbType.Numeric, 0, "Pertinencia"); dataAdapter.UpdateCommand.Parameters.Add("@IdTermino", OleDbType.Numeric, 0, "IdTermino"); dataAdapter.UpdateCommand.Parameters.Add("@Ius", OleDbType.Numeric, 0, "Ius"); dataAdapter.Update(dataSet, "RelTesis"); dataSet.Dispose(); dataAdapter.Dispose(); insertCompleted = true; } catch (OleDbException ex) { string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name; ErrorUtilities.SetNewErrorMessage(ex, methodName + " Exception,TerminosModel", "BusquedaLatinos"); } catch (Exception ex) { string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name; ErrorUtilities.SetNewErrorMessage(ex, methodName + " Exception,TerminosModel", "BusquedaLatinos"); } finally { connection.Close(); } return(insertCompleted); }
public bool UpdateTermino(Terminos termino) { OleDbConnection connection = new OleDbConnection(connectionString); OleDbDataAdapter dataAdapter; OleDbCommand cmd = connection.CreateCommand(); cmd.Connection = connection; bool insertCompleted = false; try { connection.Open(); DataSet dataSet = new DataSet(); DataRow dr; const string sqlQuery = "SELECT * FROM Terminos WHERE IdTermino = @IdTermino"; dataAdapter = new OleDbDataAdapter(); dataAdapter.SelectCommand = new OleDbCommand(sqlQuery, connection); dataAdapter.SelectCommand.Parameters.AddWithValue("@IdTermino", termino.IdTermino); dataAdapter.Fill(dataSet, "Terminos"); dr = dataSet.Tables["Terminos"].Rows[0]; dr.BeginEdit(); dr["Termino"] = termino.Termino; dr["TerminoStr"] = termino.TerminoStr; dr["Definicion"] = termino.Definicion; dr["Bibliografia"] = termino.Bibliografia; dr.EndEdit(); dataAdapter.UpdateCommand = connection.CreateCommand(); dataAdapter.UpdateCommand.CommandText = "UPDATE Terminos SET Termino = @Termino, TerminoStr = @TerminoStr, Definicion = @Definicion, Bibliografia = @Bibliografia WHERE IdTermino = @IdTermino"; dataAdapter.UpdateCommand.Parameters.Add("@Termino", OleDbType.VarChar, 0, "Termino"); dataAdapter.UpdateCommand.Parameters.Add("@TerminoStr", OleDbType.VarChar, 0, "TerminoStr"); dataAdapter.UpdateCommand.Parameters.Add("@Definicion", OleDbType.VarChar, 0, "Definicion"); dataAdapter.UpdateCommand.Parameters.Add("@Bibliografia", OleDbType.VarChar, 0, "Bibliografia"); dataAdapter.UpdateCommand.Parameters.Add("@IdTermino", OleDbType.Numeric, 0, "IdTermino"); dataAdapter.Update(dataSet, "Terminos"); dataSet.Dispose(); dataAdapter.Dispose(); insertCompleted = true; } catch (OleDbException ex) { string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name; ErrorUtilities.SetNewErrorMessage(ex, methodName + " Exception,TerminosModel", "BusquedaLatinos"); } catch (Exception ex) { string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name; ErrorUtilities.SetNewErrorMessage(ex, methodName + " Exception,TerminosModel", "BusquedaLatinos"); } finally { connection.Close(); } return(insertCompleted); }
public TerminoWin(Terminos termino) { InitializeComponent(); this.termino = termino; this.isUpdate = true; }
public TerminoWin() { InitializeComponent(); termino = new Terminos(); }