Ejemplo n.º 1
0
        public IQueryable<Task> GetTasksByUser(UserProfile user)
        {
            IQueryable<Task> query = context.Tasks.Where(t => t.ParentTaskId == null && t.Users.Any(U => U.UserId == user.UserId));

            foreach (Task task in query.ToList())
            {
                task.ChildTask = context.Tasks.Where(t => t.ParentTaskId == task.TaskID).ToList();
                task.CreatedByUser = context.UserProfiles.Where(t => t.UserId == task.CreatedBy).FirstOrDefault();
                task.ProjectStatus = context.ProjectStatuses.Where(t => t.ProjectStatusID==null||t.ProjectStatusID == task.ProjectStatusID).FirstOrDefault();
                task.LoggedTime = context.TimeLogs.Where(t => t.TaskID == task.TaskID).ToList(); //List of time log against task Added by Mahedee @18-03-14
                task.ActualTaskHour = task.LoggedTime.Sum(x => x.TaskHour); //Sum of entry hour as actual hour. Added by Mahedee @18-03-14
            }
            return query;
        }
Ejemplo n.º 2
0
        private string GenerateMailBody(UserProfile user)
        {
            string overdueTask = string.Empty;
            string todaysTask = string.Empty;
            string dueTommorrowTask = string.Empty;
            string futureTask = string.Empty;
            string messageBody = string.Empty;
            IQueryable<Task> taskList = unitofWork.TaskRepository.GetTasksByUser(user);

            messageBody = "<b>Dear &nbsp;" + user.FirstName + "</b>,<br>" + "<b>You have the following tasks:</b><br>";
            foreach (Task task in taskList)
            {
                if (task.EndDate < DateTime.Today) // overdue task   
                {
                    overdueTask += "<li>" + task.Title + "</li>";
                }
                else if (task.StartDate == DateTime.Today) // todays task
                {
                    todaysTask += "<li>" + task.Title + "</li>";
                }
                else if (task.EndDate == DateTime.Today.AddDays(1)) //due tomorrow task
                {
                    dueTommorrowTask += "<li>" + task.Title + "</li>";
                }
                else if (task.StartDate > DateTime.Today) //Future task
                {
                    futureTask += "<li>" + task.Title + "</li>";
                }
            }

            if (overdueTask != string.Empty)
            {
                messageBody += "<b>Overdue tasks:</b> <br>" + overdueTask;
            }
            if (todaysTask != string.Empty)
            {
                messageBody += "<b>Today's tasks:</b> <br>" + todaysTask;
            }
            if (dueTommorrowTask != string.Empty)
            {
                messageBody += "<b>Due Tommorrow's tasks:</b> <br>" + dueTommorrowTask;
            }
            if (futureTask != string.Empty)
            {
                messageBody += "<b>Future tasks:</b> <br>" + futureTask;
            }

            return messageBody;
        }
Ejemplo n.º 3
0
 public void Update(UserProfile user)
 {
     context.Entry(user).State = System.Data.Entity.EntityState.Modified;
 }
Ejemplo n.º 4
0
        public void Insert(UserProfile user)
        {

            context.UserProfiles.Add(user);

        }
Ejemplo n.º 5
0
 public IQueryable<Task> ByProjectIncluding(long projectID, UserProfile user, params Expression<Func<Task, object>>[] includeProperties)
 {
     IQueryable<Task> query = context.Tasks.Where(t => t.ProjectID == projectID && t.ParentTaskId == null && t.Users.Any(U=>U.UserId==user.UserId));
     
     foreach (var includeProperty in includeProperties)
     {
         query = query.Include(includeProperty);
     }
     foreach (Task task in query.ToList())
     {
         task.ChildTask = context.Tasks.Where(t => t.ParentTaskId == task.TaskID).ToList();
     }
     return query;
 }
Ejemplo n.º 6
0
 public List<Notification> UserUnreadNotification(UserProfile user)
 {
   return  context.Notifications.Where(n=>n.UserID==user.UserId && n.IsNoticed==false).ToList();
 }
Ejemplo n.º 7
0
 public void LoadAssignedProjects(UserProfile user)
 {
   List<Project> projectList= unitOfWork.ProjectRepository.GetAssignedProjectByUser(user);
   ViewBag.AssignedProjects = projectList;
 }
Ejemplo n.º 8
0
        public void LoadUnreadNotifications(UserProfile user)
        {

        }
Ejemplo n.º 9
0
        public ActionResult EditProfile(UserProfileViewModel model)
        {
            UserProfile user = new UserProfile();
            user = unitOfWork.UserRepository.GetUserByUserID((int)Membership.GetUser(WebSecurity.CurrentUserName).ProviderUserKey);
            user.FirstName = model.FirstName;
            user.LastName = model.LastName;

            unitOfWork.UserRepository.Update(user);
            unitOfWork.Save();
            ViewBag.Flag = "1";

            //  MembershipUser user2= Membership.GetUser(user.UserName);


            return View(model);
        }
Ejemplo n.º 10
0
        public ActionResult EditProfile()
        {
            // UserProfileViewModel userModel = new UserProfileViewModel();
            UserProfile user = new UserProfile();
            UserProfileViewModel userModel = new UserProfileViewModel();
            user = unitOfWork.UserRepository.GetUserByUserID((int)Membership.GetUser(WebSecurity.CurrentUserName).ProviderUserKey);
            userModel.Email = user.Email;
            userModel.FirstName = user.FirstName;
            userModel.LastName = user.LastName;

            return View(userModel);
        }