Example #1
0
 public bool ValidarDuplicidad(FiestaEventoEntity obj)
 {
     FiestaEventoEntity objCons = servicioFiestaEvento.ListarTodos().Where(tx => tx.CodigoFiesta == obj.CodigoFiesta
                                                                       && tx.CodigoTipoEvento == obj.CodigoTipoEvento).ToList().FirstOrDefault();
     if (objCons != null)
     {
         return false;
     }
     return true;
 }
Example #2
0
 private void dgvEventoFiesta_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 0)
     {
         int codigoTipoEvento = Convert.ToInt16(dgvEventoFiesta.Rows[e.RowIndex].Cells["codigoTipo"].Value.ToString());
         int codigoFiesta = objFiesta.Codigo;
         FiestaEventoEntity obj = new FiestaEventoEntity();
         obj.CodigoFiesta = codigoFiesta;
         obj.CodigoTipoEvento = codigoTipoEvento;
         if (!objFiestaEventoBL.Eliminar(obj))
         {
             MessageBox.Show("Ha ocurrido un error", "Aviso");
         }
         Enlazar();
     }
 }
Example #3
0
 private void btnAgregar_Click(object sender, EventArgs e)
 {
     int codigoEvento = Convert.ToInt16(cboTipoEvento.SelectedValue.ToString());
     int codigoFiesta = objFiesta.Codigo;
     DateTime fecha = DateTime.Now;
     FiestaEventoEntity objFiestaEvento = new FiestaEventoEntity();
     objFiestaEvento.CodigoFiesta = codigoFiesta;
     objFiestaEvento.CodigoTipoEvento = codigoEvento;
     objFiestaEvento.FechaCreacion = fecha;
     if (objFiestaEventoBL.ValidarDuplicidad(objFiestaEvento))
     {
         if (!objFiestaEventoBL.Agregar(objFiestaEvento))
         {
             MessageBox.Show("Ha ocurrido un error", "Aviso");
         }
         Enlazar();
     }
     else
     {
         MessageBox.Show("El tipo indicado ya fue agregado", "Aviso");
     }
 }
Example #4
0
        public List<FiestaEventoEntity> ListarPorFiesta(int codigo)
        {
            List<FiestaEventoEntity> listaEventoFiesta = servicioFiestaEvento.ListarTodos()
                                     .Where(tx => tx.CodigoFiesta == codigo).ToList();
            List<TipoEventoEntity> listaEvento = servicioEvento.ListarTodos();

            var query = from ef in listaEventoFiesta
                        join evento in listaEvento
                        on ef.CodigoTipoEvento equals evento.Codigo
                        select new {Codigo = ef.CodigoTipoEvento,Nombre=evento.Nombre,FechaCreacion = ef.FechaCreacion};

            List<FiestaEventoEntity> lCompuesta = new List<FiestaEventoEntity>();
            foreach (var resultado in query)
            {
                FiestaEventoEntity aux = new FiestaEventoEntity();
                aux.NombreEvento = resultado.Nombre;
                aux.CodigoTipoEvento = resultado.Codigo;
                aux.FechaCreacion = resultado.FechaCreacion;
                lCompuesta.Add(aux);
            }

            return lCompuesta;
        }
Example #5
0
 public bool Eliminar(FiestaEventoEntity obj)
 {
     return servicioFiestaEvento.Eliminar(obj);
 }
Example #6
0
 public bool Agregar(FiestaEventoEntity obj)
 {
     return servicioFiestaEvento.Agregar(obj);
 }