Ejemplo n.º 1
0
        public IEnumerable <ProjectViewStatusDetail> GetChangedProjectViewStatusDetail(string userId, bool includeFinanceStatus)
        {
            var viewStatusQuery = ProjectViewStatuses.Where(q => q.UserId == userId);

            if (includeFinanceStatus)
            {
                viewStatusQuery = viewStatusQuery.Where(q => q.Status > 0 || q.FinanceStatus > 0);
            }
            else
            {
                viewStatusQuery = viewStatusQuery.Where(q => q.Status > 0);
            }
            var query = viewStatusQuery.Join(Projects, vs => vs.ProjectId, p => p.Id, (vs, p) => new ProjectViewStatusDetail
            {
                Id            = vs.Id,
                ProjectId     = vs.ProjectId,
                ProjectName   = p.Name,
                ProjectStatus = p.Status,
                UserId        = vs.UserId,
                Status        = vs.Status,
                FinanceStatus = vs.FinanceStatus,
                UpdateTime    = vs.UpdateTime
            }).OrderByDescending(q => q.UpdateTime);

            return(query.ToArray());
        }
Ejemplo n.º 2
0
        public void UpdateProjectViewStatusRead(string projectId, string userId)
        {
            var pvs = ProjectViewStatuses.FirstOrDefault(q => q.ProjectId == projectId && q.UserId == userId);

            if (pvs == null)
            {
                pvs = new ProjectViewStatus()
                {
                    Id            = Guid.NewGuid().ToString(),
                    UserId        = userId,
                    ProjectId     = projectId,
                    Status        = 0,
                    FinanceStatus = 0
                };
                ProjectViewStatuses.Add(pvs);
                SaveChanges();
            }
            else
            {
                pvs.Status        = 0;
                pvs.FinanceStatus = 0;
                UpdateEntity(pvs);
                SaveChanges();
            }
        }
Ejemplo n.º 3
0
 public IEnumerable <ProjectViewStatus> GetProjectViewStatus(string[] projectIds, string userId)
 {
     return(ProjectViewStatuses.Where(q => projectIds.Contains(q.ProjectId) && q.UserId == userId).ToArray());
 }