Пример #1
0
 public bool CambiarEstadoVisitaInterno(INGRESO_UBICACION Ingreso_Ubicacion, ADUANA_INGRESO Aduana_Ingreso, INCIDENTE Incidente = null)
 {
     try
     {
         using (TransactionScope transaccion = new TransactionScope(TransactionScopeOption.RequiresNew, new TransactionOptions()
         {
             IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted
         }))
         {
             Context.INGRESO_UBICACION.Add(Ingreso_Ubicacion);
             Context.ADUANA_INGRESO.Attach(Aduana_Ingreso);
             Context.Entry(Aduana_Ingreso).Property(x => x.INTERNO_NOTIFICADO).IsModified = true;
             if (Incidente != null)
             {
                 Context.INCIDENTE.Add(Incidente);
             }
             Context.SaveChanges();
             transaccion.Complete();
         }
         return(true);
     }
     catch (Exception ex)
     {
         throw new ApplicationException(ex.Message);
     }
 }
Пример #2
0
        public bool QuitarAsistencia(INGRESO_UBICACION ingreso_ubicacion, GRUPO_ASISTENCIA actividad)
        {
            try
            {
                using (TransactionScope transaccion = new TransactionScope(TransactionScopeOption.RequiresNew, new TransactionOptions()
                {
                    IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted
                }))
                {
                    var Ubicacion = Context.INGRESO_UBICACION.Where(w =>
                                                                    w.ID_CENTRO == ingreso_ubicacion.ID_CENTRO &&
                                                                    w.ID_ANIO == ingreso_ubicacion.ID_ANIO &&
                                                                    w.ID_IMPUTADO == ingreso_ubicacion.ID_IMPUTADO &&
                                                                    w.ID_INGRESO == ingreso_ubicacion.ID_INGRESO &&
                                                                    w.ID_CONSEC == ingreso_ubicacion.ID_CONSEC).FirstOrDefault();
                    if (Ubicacion != null)
                    {
                        Context.INGRESO_UBICACION.Remove(Ubicacion);
                        Context.GRUPO_ASISTENCIA.Attach(actividad);
                        Context.Entry(actividad).Property(w => w.ASISTENCIA).IsModified = true;
                        var FechaServer = GetFechaServerDate();
                        var participaciones_justificadas = GetData(g =>
                                                                   g.GRUPO_HORARIO.HORA_INICIO.Value.Year == FechaServer.Year &&
                                                                   g.GRUPO_HORARIO.HORA_INICIO.Value.Month == FechaServer.Month &&
                                                                   g.GRUPO_HORARIO.HORA_INICIO.Value.Day == FechaServer.Day &&
                                                                   g.GRUPO_HORARIO.HORA_INICIO.Value.Hour == FechaServer.Hour &&
                                                                   g.GRUPO_PARTICIPANTE.ING_ID_ANIO == ingreso_ubicacion.ID_ANIO &&
                                                                   g.GRUPO_PARTICIPANTE.ING_ID_CENTRO == ingreso_ubicacion.ID_CENTRO &&
                                                                   g.GRUPO_PARTICIPANTE.ING_ID_IMPUTADO == ingreso_ubicacion.ID_IMPUTADO &&
                                                                   g.GRUPO_PARTICIPANTE.ING_ID_INGRESO == ingreso_ubicacion.ID_INGRESO &&
                                                                   ((g.EMP_COORDINACION == 2 && g.EMP_APROBADO == 0) || (g.EMP_COORDINACION == 1 && g.EMP_APROBADO == null)) &&
                                                                   g.ESTATUS == 3).ToList();


                        foreach (var participacion_justificada in participaciones_justificadas)
                        {
                            participacion_justificada.ESTATUS = 1;
                            Context.GRUPO_ASISTENCIA.Attach(participacion_justificada);
                            Context.Entry(participacion_justificada).Property(x => x.ESTATUS).IsModified = true;
                        }
                        Context.SaveChanges();
                        transaccion.Complete();
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }
Пример #3
0
 public bool MarcarAsistencia(INGRESO_UBICACION ingreso_ubicacion, GRUPO_ASISTENCIA actividad, List <GRUPO_ASISTENCIA> actividades_no_elegidas)
 {
     try
     {
         using (TransactionScope transaccion = new TransactionScope(TransactionScopeOption.RequiresNew, new TransactionOptions()
         {
             IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted
         }))
         {
             ingreso_ubicacion.ID_CONSEC = new cIngresoUbicacion().ObtenerConsecutivo <int>((int)ingreso_ubicacion.ID_CENTRO, (int)ingreso_ubicacion.ID_ANIO, ingreso_ubicacion.ID_IMPUTADO, (int)ingreso_ubicacion.ID_INGRESO);
             Context.INGRESO_UBICACION.Add(ingreso_ubicacion);
             Context.GRUPO_ASISTENCIA.Attach(actividad);
             Context.Entry(actividad).Property(w => w.ASISTENCIA).IsModified = true;
             foreach (var participacion_no_elegida in actividades_no_elegidas)
             {
                 var participacion = Context.GRUPO_ASISTENCIA.Where(w =>
                                                                    w.ID_CENTRO == participacion_no_elegida.ID_CENTRO &&
                                                                    w.ID_TIPO_PROGRAMA == participacion_no_elegida.ID_TIPO_PROGRAMA &&
                                                                    w.ID_ACTIVIDAD == participacion_no_elegida.ID_ACTIVIDAD &&
                                                                    w.ID_GRUPO == participacion_no_elegida.ID_GRUPO &&
                                                                    w.ID_GRUPO_HORARIO == participacion_no_elegida.ID_GRUPO_HORARIO &&
                                                                    w.ID_CONSEC == participacion_no_elegida.ID_CONSEC).FirstOrDefault();
                 if (participacion != null)
                 {
                     participacion.ESTATUS = 3;
                     Context.Entry(participacion).State = EntityState.Modified;
                 }
             }
             Context.SaveChanges();
             transaccion.Complete();
             return(true);
         }
     }
     catch (Exception ex)
     {
         throw new ApplicationException(ex.Message);
     }
 }