public IHttpActionResult PutEVENTOS(int id, EVENTOS eVENTOS) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != eVENTOS.id) { return(BadRequest()); } db.Entry(eVENTOS).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EVENTOSExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
// - - - - - MODIFICA una entidad el la tabla public static string ModificaEntidad(EVENTOS entidad) { EVENTOS e = DBAccess.ORM.dbe.EVENTOS.Find(entidad.id); e = entidad; return(DBAccess.ORM.SaveChanges()); }
private void labelModificar_Click(object sender, EventArgs e) { EVENTOS evento = (EVENTOS)dataGridViewEventos.CurrentRow.DataBoundItem; DetallesEvento f = new DetallesEvento(evento); f.Show(); loadDataToGrid(); }
public EventsJsonReducido(EVENTOS evento) { this.id = evento.id; this.titulo = evento.titulo; this.intro = evento.intro; this.fechainicio = evento.fechainicio.ToString(); this.horainicio = evento.horainicio.ToString(); this.asist = 0; }
private void saveData() { CCAA ccaa = new CCAA(); evento = new EVENTOS(); evento.titulo = textBoxTitulo.Text; evento.descripcion = richTextBoxDescripcion.Text; if (checkBoxGlobal.Checked) { evento.ctrlglobal = 1; } else { evento.ctrlglobal = 0; } if (checkBoxActivado.Checked) { evento.estado = 1; } else { evento.estado = 0; } evento.intro = richTextBoxIntroduccion.Text; evento.notastransporte = richTextBoxTransporte.Text; evento.fechainicio = dateTimePickerInicio.Value.Date; evento.horainicio = TimeSpan.Parse(textBoxHoraInicio.Text); evento.fechafin = dateTimePickerFechaFin.Value.Date; evento.horafin = TimeSpan.Parse(textBoxHoraFin.Text); evento.ciudad = textBoxCiudad.Text; evento.codigopostal = textBoxCodigoPostal.Text; evento.email = textBoxEmail.Text; evento.idprovincia = (byte)comboBoxProvincia.SelectedValue; evento.idccaa = (byte)comboBoxComunidad.SelectedValue; if (pictureBoxImagenEvento.Image != null) { try { System.Drawing.Image image = System.Drawing.Image.FromFile(destino); evento.imagen = ImageToByteArraybyImageConverter(image); } catch (FileNotFoundException excep) { Console.WriteLine(excep.Message); } } evento.iddelegacion = (int)comboBoxDelegacion.SelectedValue; evento.telefono = textBoxTelefono.Text; evento.responsable = textBoxContacto.Text; if (Publica.idusuario != 0) { evento.iddsktuser = Publica.idusuario; } }
public IHttpActionResult GetEVENTOS(int id) { EVENTOS eVENTOS = db.EVENTOS.Find(id); if (eVENTOS == null) { return(NotFound()); } return(Ok(eVENTOS)); }
public IHttpActionResult PostEVENTOS(EVENTOS eVENTOS) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.EVENTOS.Add(eVENTOS); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = eVENTOS.id }, eVENTOS)); }
public IHttpActionResult DeleteEVENTOS(int id) { EVENTOS eVENTOS = db.EVENTOS.Find(id); if (eVENTOS == null) { return(NotFound()); } db.EVENTOS.Remove(eVENTOS); db.SaveChanges(); return(Ok(eVENTOS)); }
public DetallesEvento(EVENTOS eventos) { InitializeComponent(); loadListsDataToForm(); evento = eventos; MemoryStream ms = new MemoryStream(eventos.imagen); Image image = Image.FromStream(ms); pictureBoxImagenEvento.Image = image; textBoxTitulo.Text = eventos.titulo; if (eventos.ctrlglobal == 1) { checkBoxGlobal.Checked = true; } else { checkBoxGlobal.Checked = false; } if (eventos.estado == 1) { checkBoxActivado.Checked = true; } else { checkBoxActivado.Checked = false; } richTextBoxDescripcion.Text = eventos.descripcion; richTextBoxIntroduccion.Text = eventos.intro; richTextBoxTransporte.Text = eventos.notastransporte; dateTimePickerInicio.Value = (DateTime)eventos.fechainicio; textBoxHoraInicio.Text = eventos.horainicio.ToString(); dateTimePickerFechaFin.Value = (DateTime)eventos.fechafin; textBoxHoraFin.Text = eventos.horafin.ToString(); comboBoxDelegacion.SelectedValue = eventos.iddelegacion; textBoxCiudad.Text = eventos.ciudad; textBoxCodigoPostal.Text = eventos.codigopostal; comboBoxProvincia.SelectedValue = eventos.idprovincia; comboBoxComunidad.SelectedValue = eventos.idccaa; textBoxEmail.Text = eventos.email; textBoxTelefono.Text = eventos.telefono; textBoxContacto.Text = eventos.responsable; }
private void labelEliminar_Click(object sender, EventArgs e) { if (dataGridViewEventos.CurrentRow != null && dataGridViewEventos.CurrentRow.Index >= 0) { EVENTOS _entidad = (EVENTOS)dataGridViewEventos.CurrentRow.DataBoundItem; String mnsj = "¿Está seguro de eliminar definitivamente a " + _entidad.titulo + " ?"; DialogResult isOK = MessageBox.Show(mnsj, "Atención", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (isOK == DialogResult.OK) { mnsj = DBAccess.EventosORM.DeleteEntidad(_entidad); if (!mnsj.Equals("")) { MessageBox.Show(mnsj, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { loadDataToGrid(); } } } }
public EventsJson(EVENTOS evento) { this.id = evento.id; this.cidevento = evento.cidevento; this.estado = (int)evento.estado; this.titulo = evento.titulo; this.intro = evento.intro; this.descripcion = evento.descripcion; this.fechainicio = evento.fechainicio.ToString(); this.horainicio = evento.horainicio.ToString(); this.fechafin = evento.fechafin.ToString(); this.horafin = evento.horafin.ToString(); this.notasevento = evento.notasevento; this.notastransporte = evento.notastransporte; this.idccaa = (int)evento.idccaa; this.idprovincia = (int)evento.idprovincia; this.ciudad = evento.ciudad; this.coordgps = evento.coordgps; this.ctrlglobal = (int)evento.ctrlglobal; this.iddelegacion = (int)evento.iddelegacion; this.asist = 0; }
public DetallesEvento() { InitializeComponent(); loadListsDataToForm(); evento = new EVENTOS(); }
// - - - - - ELIMINA una entidad de la tabla public static string DeleteEntidad(EVENTOS entidad) { ORM.dbe.EVENTOS.Remove(entidad); return(DBAccess.ORM.SaveChanges()); }
// - - - - - INSERTA una entidad el la tabla public static string InsertaEntidad(EVENTOS entidad) { MessageBox.Show(entidad.titulo, "Faltan datos", MessageBoxButtons.OK, MessageBoxIcon.Error); ORM.dbe.EVENTOS.Add(entidad); return(DBAccess.ORM.SaveChanges()); }