public bool SeEditoArea(int idArea, int IdTarea) //consulta si el area se edito
        {
            bool ret = true;

            if (IdTarea > 0)
            {
                var modelTarea = new tareas();
                try
                {
                    using (var ctx = new inventarioContext())
                    {
                        //enlaces = ctx.enlaces.ToList();
                        modelTarea = ctx.tareas
                                     .Where(x => x.IdTarea == IdTarea)
                                     .SingleOrDefault();
                    }
                    if (modelTarea.IdArea == idArea)
                    {
                        ret = false;
                    }
                    else
                    {
                        ret = true;
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }

            return(ret);
        }
Beispiel #2
0
        public int ObtenerCorrelativo() //obtiene numero correlativo de acuerdo al año
        {
            // List<tareas> tareas = new List<tareas>();
            tareas   tareas1     = new tareas();
            DateTime hoy         = DateTime.Now;
            int      correlativo = 0;

            try
            {
                using (var ctx = new inventarioContext())
                {
                    //para retornar solo de la tabla alumno
                    // alumno = ctx.Alumno.Where(x => x.id == id)
                    //                   .SingleOrDefault();
                    //para retornar la relacion
                    //tareas = ctx.tareas.Where(x => x.FechaAsignacion.Value.Year == hoy.Year)
                    //                   .OrderByDescending(x => x.Nro)
                    //                   .ToList();
                    tareas1 = ctx.tareas.Where(x => x.FechaAsignacion.Value.Year == hoy.Year)
                              .OrderByDescending(x => x.Nro)
                              .FirstOrDefault();

                    correlativo = 0;
                }
            }
            catch (Exception e)
            {
                throw;
            }
            if (tareas1 != null)
            {
                if (tareas1.Nro == null)
                {
                    correlativo = 0;
                }
                else
                {
                    correlativo = (int)tareas1.Nro;
                }
            }
            else
            {
                correlativo = 0;
            }
            return(correlativo + 1);
        }
Beispiel #3
0
        public tareas Obtener(int id)
        {
            tareas tarea = new tareas();

            try
            {
                using (var ctx = new inventarioContext())
                {
                    tarea = ctx.tareas.Include(x => x.areas)
                            .Include(x => x.prioridades)
                            .Include(x => x.tipoTareas)
                            .Include(x => x.estadoTarea)
                            .Include("tareaResponsable.responsable.usuariosSistema")
                            .Where(x => x.IdTarea == id)
                            .SingleOrDefault();
                }
            }
            catch (Exception e)
            {
                throw;
            }
            return(tarea);
        }