コード例 #1
0
 public VMEditingProject()
 {
     Media = new List<VMProjectMedium>();
     EditingCollaborators = new VMEditingCollaborators();
     Template = ProjectTemplate.Template_1;
     ContributionSetting = ContributionSetting.Open;
 }
コード例 #2
0
 public VMEditingProject()
 {
     Media = new List <VMProjectMedium>();
     EditingCollaborators = new VMEditingCollaborators();
     Template             = ProjectTemplate.Template_1;
     ContributionSetting  = ContributionSetting.Open;
 }
コード例 #3
0
        public VMEditingProject(Project p, IEnumerable<User> quickContacts, int currentUserId)
        {
            Title = p.Title;
            Description = p.Description;
            Media = new List<VMProjectMedium>();
            if (p.ProjectMedia != null && p.ProjectMedia.Count > 0)
            {
                foreach (ProjectMedium u in p.ProjectMedia)
                {
                    Media.Add(new VMProjectMedium(u));
                }
            }
            EditingCollaborators = new VMEditingCollaborators(p.Contributions, quickContacts);
            Template = (ProjectTemplate)p.Template;
            ContributionSetting = (ContributionSetting)p.CollaborationSetting;

            Id = p.Id;
            _currentUserId = currentUserId;
            if (p.Contributions != null && p.Contributions.FirstOrDefault(c => c.UserId == _currentUserId) != null)
            {
                PersonalContribution = new VMContribution(p.Contributions.FirstOrDefault(c => c.UserId == _currentUserId));
            }
            else
            {
                PersonalContribution = new VMContribution();
            }
            ProjectEditorIds = new List<int>();
            ProjectMasterIds = new List<int>();
            if (p.ProjectPermissions != null && p.ProjectPermissions.Count > 0)
            {
                foreach (ProjectPermission pm in p.ProjectPermissions)
                {
                    if (pm.IsProjectEditor)
                    {
                        ProjectEditorIds.Add(pm.UserId);
                    }
                    if (pm.IsProjectMaster)
                    {
                        ProjectMasterIds.Add(pm.UserId);
                    }
                }
            }
        }
コード例 #4
0
        public VMEditingProject(Project p, IEnumerable <User> quickContacts, int currentUserId)
        {
            Title       = p.Title;
            Description = p.Description;
            Media       = new List <VMProjectMedium>();
            if (p.ProjectMedia != null && p.ProjectMedia.Count > 0)
            {
                foreach (ProjectMedium u in p.ProjectMedia)
                {
                    Media.Add(new VMProjectMedium(u));
                }
            }
            EditingCollaborators = new VMEditingCollaborators(p.Contributions, quickContacts);
            Template             = (ProjectTemplate)p.Template;
            ContributionSetting  = (ContributionSetting)p.CollaborationSetting;

            Id             = p.Id;
            _currentUserId = currentUserId;
            if (p.Contributions != null && p.Contributions.FirstOrDefault(c => c.UserId == _currentUserId) != null)
            {
                PersonalContribution = new VMContribution(p.Contributions.FirstOrDefault(c => c.UserId == _currentUserId));
            }
            else
            {
                PersonalContribution = new VMContribution();
            }
            ProjectEditorIds = new List <int>();
            ProjectMasterIds = new List <int>();
            if (p.ProjectPermissions != null && p.ProjectPermissions.Count > 0)
            {
                foreach (ProjectPermission pm in p.ProjectPermissions)
                {
                    if (pm.IsProjectEditor)
                    {
                        ProjectEditorIds.Add(pm.UserId);
                    }
                    if (pm.IsProjectMaster)
                    {
                        ProjectMasterIds.Add(pm.UserId);
                    }
                }
            }
        }