Beispiel #1
0
        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();
                }
            }
        }
Beispiel #2
0
        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);
     }
 }
Beispiel #4
0
        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);
     }
 }
Beispiel #9
0
 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;
         }
     }
 }
Beispiel #10
0
        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
        }
Beispiel #11
0
        public void Edit(Sala sala)
        {
            var bc = new SalaComponent();

            bc.Edit(sala);
        }
Beispiel #12
0
        public Sala Add(Sala sala)
        {
            var bc = new SalaComponent();

            return(bc.Add(sala));
        }
Beispiel #13
0
        public Sala Eliminar(int id)
        {
            var bc = new SalaComponent();

            return(bc.Eliminar(id));
        }
Beispiel #14
0
        public bool Delete(int iD)
        {
            SalaComponent Salacomponent = new SalaComponent();

            return(Salacomponent.Delete(iD));
        }
Beispiel #15
0
        public List <Sala> ToList()
        {
            var bc = new SalaComponent();

            return(bc.ToList());
        }
Beispiel #16
0
        public void Update(Sala objeto)
        {
            var bc = new SalaComponent();

            bc.Update(objeto);
        }
Beispiel #17
0
        public Sala ReadBy(int id)
        {
            var bc = new SalaComponent();

            return(bc.ReadBy(id));
        }
Beispiel #18
0
        public List <Sala> Read()
        {
            var bc = new SalaComponent();

            return(bc.Read());
        }
Beispiel #19
0
        public void Delete(int id)
        {
            var bc = new SalaComponent();

            bc.Delete(id);
        }
Beispiel #20
0
        public Sala Create(Sala objeto)
        {
            var bc = new SalaComponent();

            return(bc.Create(objeto));
        }
Beispiel #21
0
        public Sala Agregar(Sala sala)
        {
            var bc = new SalaComponent();

            return(bc.Agregar(sala));
        }
Beispiel #22
0
        public Sala Find(int?id)
        {
            var bc = new SalaComponent();

            return(bc.Find(id));
        }
Beispiel #23
0
        public void Remove(Sala sala)
        {
            var bc = new SalaComponent();

            bc.Remove(sala);
        }
Beispiel #24
0
        public Sala GetByID(int iD)
        {
            SalaComponent Salacomponent = new SalaComponent();

            return(Salacomponent.GetByID(iD));
        }
Beispiel #25
0
        public Sala Create(Sala sala)
        {
            SalaComponent Salacomponent = new SalaComponent();

            return(Salacomponent.Agregar(sala));
        }
Beispiel #26
0
        public Sala Editar(Sala sala)
        {
            var bc = new SalaComponent();

            return(bc.Editar(sala));
        }
Beispiel #27
0
        public bool Edit(Sala sala)
        {
            SalaComponent Salacomponent = new SalaComponent();

            return(Salacomponent.Edit(sala));
        }
Beispiel #28
0
        public List <Sala> ListarTodos()
        {
            var bc = new SalaComponent();

            return(bc.ListarTodos());
        }
Beispiel #29
0
        public List <Sala> ListarTodos()
        {
            SalaComponent Salacomponent = new SalaComponent();

            return(Salacomponent.ListarTodos());
        }
Beispiel #30
0
        public Sala BuscarPorId(int id)
        {
            var bc = new SalaComponent();

            return(bc.BuscarPorId(id));
        }