Example #1
0
        public ActionResult Listado()
        {
            var modelo  = new EventosModel();
            var eventos = modelo.ListadoEventos();

            return(View(eventos));
        }
Example #2
0
 public ActionResult Create(EventosModel evento)
 {
     if (ModelState.IsValid)
     {
         HttpResponseMessage response = GlobalSettings.WebApiClient.PostAsJsonAsync("Eventos", evento).Result;
         if (response.IsSuccessStatusCode)
         {
             var          result      = response.Content.ReadAsStringAsync().Result;
             EventosModel eventResult = JsonConvert.DeserializeObject <EventosModel>(result);
             foreach (var item in evento.ParticipanteEvento)
             {
                 if (!String.IsNullOrEmpty(item.Participante) && !item.Participante.Equals(""))
                 {
                     ParticipanteEventoModel pem = new ParticipanteEventoModel();
                     pem.EventoID     = eventResult.EventoID;
                     pem.Participante = item.Participante;
                     HttpResponseMessage responseParticipante = GlobalSettings.WebApiClient.PostAsJsonAsync("ParticipanteEventos", pem).Result;
                 }
             }
         }
         TempData["SuccessMessage"] = "Evento Guardado";
         return(RedirectToAction("Index"));
     }
     return(PartialView("Create", evento));
 }
Example #3
0
        private void BtnEliminar_Click(object sender, RoutedEventArgs e)
        {
            foreach (Personal empleado in empleados)
            {
                List <Eventos> eventosDel = new List <Eventos>();
                foreach (Eventos evento in empleado.MyEventos)
                {
                    if (evento.IsSelected)
                    {
                        eventosDel.Add(evento);
                    }
                }

                EventosModel model = new EventosModel();

                int count = 0;
                while (count < eventosDel.Count)
                {
                    empleado.DeleteSelectedEvent(eventosDel[count]);
                    model.DeleteEvento(eventosDel[count]);
                    count++;
                }

                model = null;
            }
        }
Example #4
0
        public ActionResult Ver(int id)
        {
            var modelo = new EventosModel();

            var evento = modelo.GetEventoPorId(id);

            return(View(evento));
        }
Example #5
0
        public EventosModel EmptyEvento()
        {
            EventosModel ev = new EventosModel {
                ParticipanteEvento = new List <ParticipanteEventoModel>()
            };

            for (int i = 0; i < 5; i++)
            {
                ParticipanteEventoModel pt = new ParticipanteEventoModel {
                    EventoID = 0, Participante = ""
                };
                ev.ParticipanteEvento.Add(pt);
            }
            return(ev);
        }
        public void RealizaConsulta(int uid)
        {
            if (BtnInasistencia.IsChecked == true && RadJustifica.IsChecked == true)
            {
                if (RcbJustificantes.SelectedIndex != -1)
                {
                    idEvento = (Int32)RcbJustificantes.SelectedValue;
                }
                else
                {
                    MessageBox.Show("Seleccione un tipo de incidente", "Atención:", MessageBoxButton.OK, MessageBoxImage.Warning);
                    return;
                }
            }

            EventosModel modelEventos = new EventosModel();

            switch (uid)
            {
            //Por año
            case 100:
                empleados = modelEventos.GetEventosConsulta(uid, idEvento, Convert.ToInt32(RcbYear.Text));
                break;

            //Por mes
            case 101:
                empleados = modelEventos.GetEventosConsulta(uid, idEvento, Convert.ToInt32(RcbMes.SelectedValue));
                break;

            //Por día
            case 102:
                empleados = modelEventos.GetEventosConsulta(uid, idEvento, RdpDia.SelectedDate);
                break;

            //Por periodo
            case 103:
                empleados = modelEventos.GetEventosConsulta(uid, idEvento, new DateTime[] { RdpDesde.SelectedDate.Value, RdpHasta.SelectedDate.Value });
                break;

            //Por servidor público
            case 104:
                empleados = modelEventos.GetEventosConsulta(uid, idEvento, Convert.ToInt32(RcbEmpleado.SelectedValue));
                break;
            }

            RgvEventos.ItemsSource = empleados;
        }
Example #7
0
        private void BtnAceptar_Click(object sender, RoutedEventArgs e)
        {
            if (idEvento == 0)
            {
                RadWindow.Alert("Seleccione el tipo de evento presentado");
                return;
            }

            Eventos evento = new Eventos();

            evento.IdEmpleado    = Convert.ToInt32(RcbEmpleados.SelectedValue);
            evento.IdEvento      = idEvento;
            evento.StartDate     = RdpDesde.SelectedDate.Value;
            evento.EndDate       = (idEvento == 1) ? RdpHasta.SelectedDate.Value : evento.StartDate;
            evento.IdIncidente   = (idEvento == 1) ? Convert.ToInt32(RcbJustificantes.SelectedValue) : 0;
            evento.Observaciones = (idEvento == 1) ? TxtObservaciones.Text : " ";

            if (idEvento == 1 && RadJustifica.IsChecked == true && evento.IdIncidente == 0)
            {
                MessageBox.Show("Selecciona el motivo de justificación de esta inasistencia", "Atención:", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }

            bool isEventRegisterOk = false;

            if (evento.StartDate == evento.EndDate)
            {
                isEventRegisterOk = new EventosModel().SetEventoAislado(evento);
            }
            else
            {
                new EventosModel().SetEventoPeriodico(evento);
                isEventRegisterOk = true;
            }

            if (isEventRegisterOk)
            {
                this.Close();
            }
        }
Example #8
0
        public ActionResult Create()
        {
            EventosModel emp = EmptyEvento();

            return(PartialView("Create", emp));
        }
 public Consulta()
 {
     InitializeComponent();
     this.modelEventos = new EventosModel();
     this.empleados    = new List <Empleados>();
 }