/** * Busca el primer registro que coincida con los datos enviados * @param Historial obj * @return Retorna el mismo objeto pero con los datos consultados */ public Historial buscarPrimeroHistorial(Historial obj) { List <Historial> lista = null; try { HistorialDao dao = new HistorialDao(); conn = conexion.conectar(); lista = dao.searchMatching(conn, obj); if (lista != null && lista.Count > 0) { obj = (Historial)lista[0]; } else { obj.ID_HISTORIAL = -1; } } catch (Exception e) { obj.ID_HISTORIAL = -1; } finally { if (conn != null && conn.State == System.Data.ConnectionState.Open) { conn.Close(); } } return(obj); }
/** * Inserta nuevo registro en la tabla * @param Historial obj * @return Retorna el mismo objeto pero con la llave primaria configurada */ public Historial crearHistorial(Historial obj) { List <Historial> lista = null; Historial obj_new = new Historial(); try { HistorialDao dao = new HistorialDao(); conn = conexion.conectar(); int id = Funciones.obtenerId(conn, "HISTORIAL"); obj.ID_HISTORIAL = id; dao.create(conn, obj); //verificar existencia obj_new.ID_HISTORIAL = obj.ID_HISTORIAL; lista = dao.searchMatching(conn, obj_new); if (lista != null && lista.Count > 0) { obj_new = (Historial)lista[0]; } else { obj_new.ID_HISTORIAL = -1; } } catch (Exception e) { obj_new.ID_HISTORIAL = -1; } finally { if (conn != null && conn.State == System.Data.ConnectionState.Open) { conn.Close(); } } return(obj_new); }
/** * Busca los registros que coincidan con los datos enviados * @param Historial obj * @return Retorna la lista de los registros que coinciden */ public Historial[] buscarHistorial(Historial obj, int pagina, int numRegPagina) { Historial[] result = null; List <Historial> lista = null; if (pagina > 0 && numRegPagina > 0) { pagina--; int limInf = 0; int limSup = 0; limInf = pagina * numRegPagina + 1; limSup = (pagina + 1) * numRegPagina; try { HistorialDao dao = new HistorialDao(); conn = conexion.conectar(); lista = dao.searchMatching(conn, obj, limInf, limSup); if (lista != null && lista.Count > 0) { result = lista.ToArray(); } } catch (Exception e) { result = null; } finally { if (conn != null && conn.State == System.Data.ConnectionState.Open) { conn.Close(); } } } return(result); }
public ActionResult Agregar(ProductoViewModels model) { try { if (ModelState.IsValid) { using (vital1Entities db = new vital1Entities()) { var ohistorial = new Historial(); ohistorial.Hist_Cant = model.Hist_Cant; ohistorial.Prod_Id = model.Prod_Id; ohistorial.Hist_Fecha = DateTime.Now; var oProducto = db.Producto.Find(model.Prod_Id); oProducto.Prod_Desk = model.Prod_Desk; oProducto.Prod_Cant = (model.Prod_Cant + model.Hist_Cant); db.Historial.Add(ohistorial); db.Entry(oProducto).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } return(Redirect("~/Producto/")); } return(View(model)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public void UpdateHistorial(Historial historial) { //using (var db = _contexto) //{ Historial histo = _contexto.Historiales.FirstOrDefault(a => a.Id == historial.Id); if (histo != null) { if (historial.NickUsuario != null) { histo.NickUsuario = historial.NickUsuario; } if (historial.Fecha != null) { histo.Fecha = historial.Fecha; } if (historial.Cantidad != 0) { histo.Cantidad = historial.Cantidad; } if (historial.FactorConversion != 0) { histo.FactorConversion = historial.FactorConversion; } if (historial.Resutado != 0) { histo.Resutado = historial.Resutado; } _contexto.SaveChanges(); } //} }
public async Task <IActionResult> Crear([FromBody] Historial item) { try { var r = await this.Repositorio.Historial.AddAsync(item); await this.Repositorio.CompleteAsync(); var obj = new { ok = true, Historial = r }; return(Created("", obj)); } catch (Exception ex) { return(BadRequest(new { ok = false, mensaje = "Se produjo un error al crear el registro", errors = new { mensaje = ex.Message } })); } }
private void contenedor_Load(object sender, EventArgs e) { Conexion.DSN = "prueba2"; MdiClient Chld; inv_ini = null; // rep_movs = null; np = null; cat = null; fm = null; mar = null; rstck = null; bod = null; fl = null; gr = null; dm = null; dbp = null; fmu = null; mem = null; mov = null; devc = null; doc = null; exbod = null; fac = null; kar = null; his = null; crearu = null; app = null; edi = null; camb = null; modap = null; desh = null; asper = null; edper = null; elper = null; repcom = null; foreach (Control crtl in this.Controls) { try { Chld = (MdiClient)crtl; Chld.BackColor = this.BackColor; } catch (InvalidCastException exe) { } } if (inv_ini == null) { inv_ini = new FormInventarioInicio(); inv_ini.MdiParent = this; inv_ini.FormClosed += new FormClosedEventHandler(FormInventarioInicio_FormCLosed); inv_ini.Show(); } }
public bool Update(Historial model) { try { var originalModel = _PacienteDbContext.Historial.Single(x => x.HistorialID == model.HistorialID ); originalModel.Nombre = model.Nombre; originalModel.Apellidos = model.Apellidos; originalModel.Cedula = model.Cedula; originalModel.Edad = model.Edad; originalModel.sexo = model.sexo; originalModel.Seguro = model.Seguro; originalModel.Ocupacion = model.Ocupacion; originalModel.Telefono = model.Telefono; originalModel.Celular = model.Celular; originalModel.Direccion = model.Direccion; originalModel.Sintomas = model.Sintomas; originalModel.Antecedentes = model.Antecedentes; _PacienteDbContext.Update(originalModel); _PacienteDbContext.SaveChanges(); } catch (Exception) { return(false); } return(true); }
public async Task <IActionResult> PutHistorial(int id, Historial historial) { if (id != historial.Id) { return(BadRequest()); } _context.Entry(historial).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HistorialExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Fecha,Carro_ID,Personal_ID")] Historial historial) { if (id != historial.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(historial); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HistorialExists(historial.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Carro_ID"] = new SelectList(_context.Carro, "ID", "ID", historial.Carro_ID); ViewData["Personal_ID"] = new SelectList(_context.Personal, "ID", "ID", historial.Personal_ID); return(View(historial)); }
public string bet(int id, string color, int betnumber, int cash, int userid) { string result = ""; try { var status = context.Ruleta.FirstOrDefault(b => b.IdApuesta == id); Historial historial = new Historial();//var historial = context.Historial; if (status.Estado == true && status.IdUsuario == userid && cash <= 10000 && betnumber >= 0 && betnumber <= 36) { historial.Color = color; historial.NumeroApostado = betnumber; historial.MontoApuesta = cash; historial.IdApuesta = id; status.Color = color; status.NumeroApostado = betnumber; status.MontoApuesta = cash; context.Add(historial); context.SaveChanges(); result = "Apuesta Realizada"; } else { result = "Apuesta denegada"; } return(result); } catch (NullReferenceException) { return("Denegado"); } }
private void enviarDatos(object sender, EventArgs e) { if (vista.TablaBuscar.SelectedRows.Count > 0) { Historial historial = vista.Owner as Historial; historial.txtCodigoHistorial.Text = vista.TablaBuscar.CurrentRow.Cells["id_Registro"].Value.ToString(); historial.txtCodigoPaciente.Text = vista.TablaBuscar.CurrentRow.Cells["Id_Paciente"].Value.ToString(); historial.txtPaciente.Text = vista.TablaBuscar.CurrentRow.Cells["Paciente"].Value.ToString(); historial.txtCodigoDoctor.Text = vista.TablaBuscar.CurrentRow.Cells["Id_Doctor"].Value.ToString(); historial.txtDoctor.Text = vista.TablaBuscar.CurrentRow.Cells["Doctor"].Value.ToString(); historial.txtEspecializacion.Text = vista.TablaBuscar.CurrentRow.Cells["Especializacion"].Value.ToString(); historial.txtCodigoVisita.Text = vista.TablaBuscar.CurrentRow.Cells["id_Visita"].Value.ToString(); historial.txtSintomas.Text = vista.TablaBuscar.CurrentRow.Cells["Sintomas"].Value.ToString(); historial.txtDiagnostico.Text = vista.TablaBuscar.CurrentRow.Cells["Diagnostico"].Value.ToString(); historial.txtTratamiento.Text = vista.TablaBuscar.CurrentRow.Cells["Tratamiento"].Value.ToString(); historial.txtCodigoPaciente.Enabled = false; historial.txtPaciente.Enabled = false; historial.txtCodigoDoctor.Enabled = false; historial.txtDoctor.Enabled = false; historial.txtEspecializacion.Enabled = false; historial.txtCodigoVisita.Enabled = false; vista.Close(); } else { MessageBox.Show("Seleccione una Fila"); } }
public async Task <IActionResult> Edit(int id, [Bind("Id,IdPedido,Total,IdUsuario,Fecha,Usuario")] Historial historial) { if (id != historial.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(historial); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HistorialExists(historial.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(historial)); }
public static bool updateHistorial(Historial historial, bool esFinalizar = false) { using (var connection = new SqlConnection(_stringConnection)) { connection.Open(); using (var command = new SqlCommand()) { command.Connection = connection; if (esFinalizar) { command.CommandText = "UPDATE Historial SET habitacion = @habitacion, montoTotal = @montoTotal, fechaFinal = @fechaFinal WHERE id = @id"; command.Parameters.AddWithValue("@fechaFinal", historial.FechaFinal); } else { command.CommandText = "UPDATE Historial SET habitacion = @habitacion, montoTotal = @montoTotal, fechaFinal = null WHERE id = @id"; } command.Parameters.AddWithValue("@habitacion", historial.Habiacion); command.Parameters.AddWithValue("@montoTotal", historial.MontoTotal); command.Parameters.AddWithValue("@id", historial.ID); command.CommandType = CommandType.Text; var rows = command.ExecuteNonQuery(); if (rows > 0) { return(true); } return(false); } } }
public static Historial getHistorial(int cliente, int habitacion) { using (var connection = new SqlConnection(_stringConnection)) { connection.Open(); using (var command = new SqlCommand()) { command.Connection = connection; command.CommandText = "SELECT * FROM Historial WHERE cliente = @cliente AND habitacion = @habitacion"; command.Parameters.AddWithValue("@cliente", cliente); command.Parameters.AddWithValue("@habitacion", habitacion); command.CommandType = CommandType.Text; var reader = command.ExecuteReader(); Historial historial = null; if (reader.HasRows) { reader.Read(); historial = new Historial(); historial.ID = reader.GetInt32(0); historial.Cliente = reader.GetInt32(1); historial.Personal = reader.GetInt32(2); historial.Habiacion = cliente = reader.GetInt32(3); historial.PagoDia = (float)reader.GetSqlMoney(4).ToDouble(); historial.MontoTotal = (float)reader.GetSqlMoney(5).ToDouble(); historial.FechaInicio = reader.GetDateTime(6); try { historial.FechaFinal = reader.GetDateTime(7); } catch { } } return(historial); } } }
public static bool InsertHistorial(Historial historial) { using (var connection = new SqlConnection(_stringConnection)) { connection.Open(); using (var command = new SqlCommand()) { command.Connection = connection; command.CommandText = "INSERT INTO Historial VALUES(@cliente,@personal,@habitacion,@pagoDia,@montoTotal,@fechaInicio,null)"; command.Parameters.AddWithValue("@cliente", historial.Cliente); command.Parameters.AddWithValue("@personal", historial.Personal); command.Parameters.AddWithValue("@habitacion", historial.Habiacion); command.Parameters.AddWithValue("@pagoDia", historial.PagoDia); command.Parameters.AddWithValue("@montoTotal", historial.MontoTotal); command.Parameters.AddWithValue("@fechaInicio", historial.FechaInicio); command.CommandType = CommandType.Text; var rows = command.ExecuteNonQuery(); if (rows > 0) { return(true); } return(false); } } }
public async Task <ActionResult <Historial> > PostHistorial(Historial historial) { _context.Historial.Add(historial); await _context.SaveChangesAsync(); return(CreatedAtAction("GetHistorial", new { id = historial.Id }, historial)); }
/// <summary> /// Carga la lista de historiales /// </summary> /// <returns>la lista de historiales</returns> public List <Historial> CargarTodo() { try { List <Historial> historiales = new List <Historial>(); Historial hist; doc.Load(rutaXML); XmlNodeList listaHistoriales = doc.SelectNodes("Historial/historial"); XmlNode unHistorial; for (int i = 0; i < listaHistoriales.Count; i++) { hist = new Historial(); unHistorial = listaHistoriales.Item(i); hist.CedDocente = unHistorial.SelectSingleNode("cedDocente").InnerText; hist.Ausencia = Int32.Parse(unHistorial.SelectSingleNode("ausencia").InnerText); hist.Tardia = Int32.Parse(unHistorial.SelectSingleNode("tardia").InnerText); hist.Anticipada = Int32.Parse(unHistorial.SelectSingleNode("anticipada").InnerText); historiales.Add(hist); } return(historiales); } catch (Exception ex) { throw new Exception("Error al cargar historiales."); } }
public async Task <IActionResult> DeleteConfirmed(int id) { DateTime Today = DateTime.Now; var pedido = await _context.Pedido.FindAsync(id); _context.Pedido.Remove(pedido); var monto = _context.Producto.ToList(); var montoAUX = monto.Where(a => a.Pedidofk == id); var montoFIN = montoAUX.Sum(b => b.Precio); var nombreUser = HttpContext.Session.GetString("username"); Historial hist = new Historial { IdPedido = id, Total = montoFIN, IdUsuario = pedido.IdUsuario, Fecha = Today, Usuario = nombreUser }; _context.Historial.Add(hist); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }
async public void buscar() { txtNumeroHistorial.Text = ""; txtNombreDoctor.Text = ""; txtDocumentoPaciente.Text = ""; txtCodigoEnfermedad.Text = ""; int buscado = Convert.ToInt32(txtNumeroHistorialBuscar.Text); Object buscado2 = buscado; //Object valor; //DocumentReference reference = db.Collection("Paciente").Document(buscado); //DocumentSnapshot snap = await reference.GetSnapshotAsync(); Query dato = db.Collection("Historial_Clinico").WhereEqualTo("numero_historia", buscado2); QuerySnapshot snap = await dato.GetSnapshotAsync(); // DocumentSnapshot pacientes; foreach (DocumentSnapshot historiales_clinicos in snap) { Historial historial = historiales_clinicos.ConvertTo <Historial>(); txtNumeroHistorial.Text = Convert.ToString(historial.numero_historia); txtNombreDoctor.Text = historial.nombre_doctor; txtDocumentoPaciente.Text = historial.documento_paciente; txtCodigoEnfermedad.Text = Convert.ToString(historial.codigo_enfermedad); MessageBox.Show("Historial encontrado"); } }
public IHttpActionResult PutHistorial(int id, Historial historial) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != historial.Id) { return(BadRequest()); } db.Entry(historial).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!HistorialExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public static List <Historial> getHistorial(string idDocumento) { List <Historial> historial = new List <Historial>(); try { //string query = "select?q=IdOriginal%3A" + idDocumento; string query = "select?q=IdOriginal%3A" + idDocumento + "%20AND%20Estado%3A0"; string response = getHistorialQuery(query); if (response == "") { throw new Exception(); } var expConverter = new ExpandoObjectConverter(); dynamic obj = JsonConvert.DeserializeObject <ExpandoObject>(response, expConverter); foreach (var d in obj.response.docs) { Historial h = new Historial(); h.id = d.id; h.Tipo = Convert.ToInt32(d.Tipo); h.IdOriginal = d.IdOriginal; h.IdReferencia = d.IdReferencia; h.Texto = d.Texto; historial.Add(h); } } catch (Exception ex) { historial = null; } return(historial); }
public void delete(SqlConnection conn, Historial valueObject) { SqlCommand stmt = null; String sql = ""; try { sql = "DELETE FROM HISTORIAL WHERE (ID_HISTORIAL = @ID_HISTORIAL )"; stmt = new SqlCommand(sql, conn); stmt.Parameters.AddWithValue("@ID_HISTORIAL", valueObject.ID_HISTORIAL); int rowcount = databaseUpdate(stmt); if (rowcount == 0) { throw new Exception("Object could not be deleted! (PrimaryKey not found)"); } if (rowcount > 1) { throw new Exception("PrimaryKey Error when updating DB! (Many objects were deleted!)"); } } finally { if (stmt != null) { stmt.Dispose(); } } }
public async Task <IActionResult> Edit(int id, [Bind("Id,Sintomas,Medicamento,Instrucciones,Examen")] Historial historial) { if (id != historial.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(historial); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HistorialExists(historial.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(historial)); }
public IActionResult Put(int id, [FromBody] Historial model) { model.HistorialID = id; return(Json( _HistorialService.Update(model) )); }
private void txtBuscar_TextChanged(object sender, EventArgs e) { if (cmbCampo.SelectedIndex == 0) { //buscar por todos los campos de la tabla Historial LH = new Historial(); string buscar = '%' + txtBuscar.Text + '%'; dgvHistorialPrestamo.DataSource = LH.FiltrarHistorialTC(buscar); } else { try { //buscar por un campo especifico de la tabla Historial LH = new Historial(); string buscar = '%' + txtBuscar.Text + '%'; string value = cmbCampo.SelectedValue.ToString(); dgvHistorialPrestamo.DataSource = LH.FiltrarHistorial(value, buscar); } catch (Exception ex) { MessageBox.Show("Ocurrio un error : " + ex + "", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void button9_Click(object sender, EventArgs e) { Historial ver_historial = new Historial(); ver_historial.setear_usuario(textBox1.Text.Trim()); ver_historial.Show(); }
public IHttpActionResult PutCARDS(Peticion pet) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } CARDS cARDS = decard.CARDS.Find(pet.Doc); System.Diagnostics.Debug.WriteLine("aaaaaaaaaaa", cARDS); System.Diagnostics.Debug.WriteLine(cARDS.Pass.ToString()); System.Diagnostics.Debug.WriteLine(pet.Pass.ToString()); System.Diagnostics.Debug.WriteLine(cARDS.Avaliable); System.Diagnostics.Debug.WriteLine(pet.Value); System.Diagnostics.Debug.WriteLine(cARDS.Pass.Trim(' ').Equals(pet.Pass.Trim(' '))); System.Diagnostics.Debug.WriteLine(cARDS.Avaliable >= pet.Value); Respuesta response = new Respuesta(); if (cARDS.Pass.Trim(' ').Equals(pet.Pass.Trim(' ')) && cARDS.Avaliable >= pet.Value) { cARDS.Avaliable = cARDS.Avaliable - pet.Value; decard.Entry(cARDS).State = EntityState.Modified; System.Diagnostics.Debug.WriteLine("aaaaaaaaaaa"); DateTime thisDay = DateTime.Today; Historial history = new Historial(); history.Id = 0; history.Doc = pet.Doc; System.Diagnostics.Debug.WriteLine("aaaaaaaaaaa"); history.Fecha = thisDay.ToString(); history.Pass = pet.Pass.Trim(' '); System.Diagnostics.Debug.WriteLine("aaaaaaaaaaa"); history.Value = pet.Value; System.Diagnostics.Debug.WriteLine("aaaaaaaaaaa1"); db.Historial.Add(history); db.SaveChanges(); System.Diagnostics.Debug.WriteLine("aaaaaaaaaaa2"); response.NumAprobacion = history.Id; response.FechaAprobacion = thisDay.ToString(); System.Diagnostics.Debug.WriteLine("aaaaaaaaaaa3"); } else { response.NumAprobacion = 0; DateTime thisDayMal = DateTime.Today; response.FechaAprobacion = thisDayMal.ToString(); return(Ok(response)); } decard.SaveChanges(); return(Ok(response)); }
public Historial[] buscarPaginacionHistorial(Historial obj, int pag, int numReg) { if (autenticacion != null && autenticacion.esValido()) { return(gestionHistorial.buscarHistorial(obj, pag, numReg)); } return(null); }
public Historial[] buscarHistorial(Historial obj) { if (autenticacion != null && autenticacion.esValido()) { return(gestionHistorial.buscarHistorial(obj)); } return(null); }
private void Form1_Load(object sender, EventArgs e) { this.zedC.IsShowPointValues = true; this.zedC.GraphPane.XAxis.Scale.MinGrace = 0; this.zedC.GraphPane.XAxis.Scale.MaxGrace = 0; this.zedC.GraphPane.XAxis.Title.Text = "Eje real"; this.zedC.GraphPane.XAxis.Title.IsTitleAtCross = false; this.zedC.GraphPane.XAxis.Title.IsVisible = true; this.zedC.GraphPane.YAxis.Title.Text = " Eje imaginario"; this.zedC.GraphPane.YAxis.Title.IsTitleAtCross = false; this.zedC.GraphPane.YAxis.Title.IsVisible = true; this.zedC.GraphPane.XAxis.IsVisible = true; this.zedC.GraphPane.XAxis.MajorGrid.IsVisible = true; this.zedC.GraphPane.XAxis.MajorGrid.IsZeroLine = false; this.zedC.GraphPane.YAxis.IsVisible = true; this.zedC.GraphPane.YAxis.MajorGrid.IsVisible = true; this.zedC.GraphPane.YAxis.MajorGrid.IsZeroLine = false; this.zedC.GraphPane.YAxis.Scale.IsSkipCrossLabel = true; this.zedC.GraphPane.Title.IsVisible = false; this.zedC.GraphPane.Chart.Border.IsVisible = false; this.zedC.GraphPane.Border.IsVisible = false; this.zedC.GraphPane.Legend.IsVisible = true; this.zedC.GraphPane.Legend.IsShowLegendSymbols = true; this.zedC.GraphPane.Legend.Border.IsVisible = false; polos = new PointPairList(); ceros = new PointPairList(); h = new Historial(); cargarGrilla(); frmPrimerOrdenProporcional = new FrmDiagramaDeBloques(polos, ceros, rl); //Se muestra la pantalla de introduccion pasoActual = 0; manejadorBotones(); btnCompara.Enabled = false; btnGuardar.Enabled = false; //Provisorio limpiar(); //this.ingresoDatos(); }