private void btnModificarSala_Click(object sender, EventArgs e) { if (mgSala.CurrentRow.Cells[0].Value == null) { MetroMessageBox.Show(this, "Seleccione una sala", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { if (verificarCampoSala()) { SalaComponent salaComponent = new SalaComponent(); Sala sala = new Sala(); sala.Id = int.Parse(mgSala.CurrentRow.Cells[0].Value.ToString()); sala.capacidad = int.Parse(txtCapacidad.Text); sala.nombre = txtNombre.Text; sala.tiempo = chTiempo.Checked; sala.tipoSala = txtTipo.Text; salaComponent.Update(sala); llenarGrillaSala(); } } }
void llenarGrillaTipoSala() { SalaComponent tipoSalaComponent = new SalaComponent(); List <Sala> tipoSalas = new List <Sala>(); tipoSalas = tipoSalaComponent.ReadTipoSala(); txtTipo.DataSource = tipoSalas; txtTipo.DisplayMember = "tipoSala"; txtTipo.ValueMember = "id"; }
public void Actualizar(SalaRequest request) { try { var bc = new SalaComponent(); bc.Edit(request.Sala); } catch (Exception ex) { var httpError = new HttpResponseMessage() { StatusCode = (HttpStatusCode)422, ReasonPhrase = ex.Message }; throw new HttpResponseException(httpError); } }
void llenarGrillaSala() { int n = 0; mgSala.Rows.Clear(); SalaComponent SalaComponent = new SalaComponent(); foreach (var item in SalaComponent.Read()) { n = mgSala.Rows.Add(); mgSala.Rows[n].Cells[0].Value = item.Id; mgSala.Rows[n].Cells[1].Value = item.nombre; mgSala.Rows[n].Cells[2].Value = item.tipoSala; mgSala.Rows[n].Cells[3].Value = item.capacidad; mgSala.Rows[n].Cells[4].Value = item.tiempo; } }
public void Eliminar(SalaRequest request) { try { var bc = new SalaComponent(); //var sala = bc.Find(id); bc.Remove(request.Sala); } catch (Exception ex) { var httpError = new HttpResponseMessage() { StatusCode = (HttpStatusCode)422, ReasonPhrase = ex.Message }; throw new HttpResponseException(httpError); } }
public SalaResponse Agregar(SalaRequest request) { try { var response = new SalaResponse(); var bc = new SalaComponent(); response.Result = bc.Add(request.Sala); return(response); } catch (Exception ex) { var httpError = new HttpResponseMessage() { StatusCode = (HttpStatusCode)422, ReasonPhrase = ex.Message }; throw new HttpResponseException(httpError); } }
public ListarTodosSalaResponse ListarTodos() { try { var response = new ListarTodosSalaResponse(); var bc = new SalaComponent(); response.Result = bc.ToList(); return(response); } catch (Exception ex) { var httpError = new HttpResponseMessage() { StatusCode = (HttpStatusCode)422, ReasonPhrase = ex.Message }; throw new HttpResponseException(httpError); } }
public SalaResponse LeerPorId(int id) { try { var response = new SalaResponse(); var bc = new SalaComponent(); response.Result = bc.Find(id); return(response); } catch (Exception ex) { var httpError = new HttpResponseMessage() { StatusCode = (HttpStatusCode)422, ReasonPhrase = ex.Message }; throw new HttpResponseException(httpError); } }
private void metroButton5_Click(object sender, EventArgs e) { if (txtBuscarSala.Text == "") { } else { int n = 0; mgSala.Rows.Clear(); SalaComponent SalaComponent = new SalaComponent(); foreach (var item in SalaComponent.buscar(txtBuscarSala.Text)) { n = mgSala.Rows.Add(); mgSala.Rows[n].Cells[0].Value = item.Id; mgSala.Rows[n].Cells[1].Value = item.nombre; mgSala.Rows[n].Cells[2].Value = item.tipoSala; mgSala.Rows[n].Cells[3].Value = item.capacidad; mgSala.Rows[n].Cells[4].Value = item.tiempo; } } }
private void btnAltaSala_Click(object sender, EventArgs e) { if (verificarCampoSala()) { SalaComponent salaComponent = new SalaComponent(); Sala sala = new Sala(); sala.capacidad = int.Parse(txtCapacidad.Text); sala.nombre = txtNombre.Text; sala.tiempo = chTiempo.Checked; sala.tipoSala = txtTipo.Text; if (salaComponent.Create(sala) == null) { ValidadoresComponent.ErrorAltaModificacado("sala", this); } else { llenarGrillaSala(); } } #endregion }
public void Edit(Sala sala) { var bc = new SalaComponent(); bc.Edit(sala); }
public Sala Add(Sala sala) { var bc = new SalaComponent(); return(bc.Add(sala)); }
public Sala Eliminar(int id) { var bc = new SalaComponent(); return(bc.Eliminar(id)); }
public bool Delete(int iD) { SalaComponent Salacomponent = new SalaComponent(); return(Salacomponent.Delete(iD)); }
public List <Sala> ToList() { var bc = new SalaComponent(); return(bc.ToList()); }
public void Update(Sala objeto) { var bc = new SalaComponent(); bc.Update(objeto); }
public Sala ReadBy(int id) { var bc = new SalaComponent(); return(bc.ReadBy(id)); }
public List <Sala> Read() { var bc = new SalaComponent(); return(bc.Read()); }
public void Delete(int id) { var bc = new SalaComponent(); bc.Delete(id); }
public Sala Create(Sala objeto) { var bc = new SalaComponent(); return(bc.Create(objeto)); }
public Sala Agregar(Sala sala) { var bc = new SalaComponent(); return(bc.Agregar(sala)); }
public Sala Find(int?id) { var bc = new SalaComponent(); return(bc.Find(id)); }
public void Remove(Sala sala) { var bc = new SalaComponent(); bc.Remove(sala); }
public Sala GetByID(int iD) { SalaComponent Salacomponent = new SalaComponent(); return(Salacomponent.GetByID(iD)); }
public Sala Create(Sala sala) { SalaComponent Salacomponent = new SalaComponent(); return(Salacomponent.Agregar(sala)); }
public Sala Editar(Sala sala) { var bc = new SalaComponent(); return(bc.Editar(sala)); }
public bool Edit(Sala sala) { SalaComponent Salacomponent = new SalaComponent(); return(Salacomponent.Edit(sala)); }
public List <Sala> ListarTodos() { var bc = new SalaComponent(); return(bc.ListarTodos()); }
public List <Sala> ListarTodos() { SalaComponent Salacomponent = new SalaComponent(); return(Salacomponent.ListarTodos()); }
public Sala BuscarPorId(int id) { var bc = new SalaComponent(); return(bc.BuscarPorId(id)); }