コード例 #1
0
    } // Create

    public ProjectOrganisation Update(Organisation org) {
      ProjectOrganisationData pod = POD(org.Id);
      pod.Details.CopyFrom(org.organisation());
      Commit(pod);

      return Get(pod.Details.Id);
    } // Update
コード例 #2
0
    } // DeleteLocations

    public IList<Location> FetchLocations(Guid orgId) {
      ProjectOrganisationData pod = POD(orgId);

      if (pod.Locations != null)
        return pod.Locations.Select(l => new Location(l)).OrderBy(loc => loc.Name).ToList();

      return new List<Location>();
    } // FetchLocations
コード例 #3
0
    } // DeleteReferralAgency

    public IList<ReferralAgency> FetchReferralAgencies(Guid orgId) {
      ProjectOrganisationData pod = POD(orgId);

      if (pod.ReferralAgencies != null) 
        return pod.ReferralAgencies.Select(rad => new ReferralAgency(rad)).OrderBy(rad => rad.Name).ToList();

      return new List<ReferralAgency>();
    } // FetchReferralAgency
コード例 #4
0
      public OrganisationClients(Guid orgId, DbSet<ClientData> clients) {
        ProjectOrganisationData pod = ProjectOrganisationRepository.findOrg(orgId);
        locations_ = pod.Locations.Select(loc => loc.Id).ToArray();
        index_ = 0;
        
        clients_ = clients;

        enumerator_ = nextEnumerator();
      } // OrganisationClients
コード例 #5
0
    } // DeleteStaffMember

    public IList<StaffMember> FetchStaffMembers(Guid orgId) {
      ProjectOrganisationData pod = POD(orgId);

      if (pod.Staff != null) {
        using (var authRepo = new AuthRepository()) {
          return pod.Staff.Select(sm => new StaffMember(sm, authRepo.UserRoles(sm.UserName))).OrderBy(sm => sm.Name).ToList();
        }
      } // if ...
      return new List<StaffMember>();
    } // FetchStaffMembers
コード例 #6
0
    } // AddProjectQuestion

    public IList<Project> FetchProjects(Guid orgId) {
      ProjectOrganisationData pod = POD(orgId);

      var projects = new List<Project>();
      if (pod.Projects != null)
        foreach (var proj in pod.Projects)
          projects.Add(new Project(proj));

      return projects.OrderBy(p => p.Name).ToList();
    } // FetchProjects
コード例 #7
0
    } // AllOrganisations

    public ProjectOrganisation Create(Organisation org) {
      ProjectOrganisationData pod = new ProjectOrganisationData();
      pod.Application = ApplicationName;
      pod.Details = org.organisation();
      pod.Id = Guid.NewGuid();
      pod.Details.Id = Guid.NewGuid();
      pod.Details.Address.Id = Guid.NewGuid();

      context.ProjectOrganisations.Add(pod);
      Commit();

      return Get(pod.Details.Id);
    } // Create
コード例 #8
0
    } // POD

    private ProjectOrganisationData POD(Expression<Func<ProjectOrganisationData, bool>> where) {
      ProjectOrganisationData pod = 
        context.ProjectOrganisations.
                Where(p => p.Application == ApplicationName).
                Where(where).
                Include(p => p.Details).
                Include(p => p.Details.Address).
                Include(p => p.Projects).
                Include(p => p.Projects.Select(pj => pj.Address)).
                Include(p => p.Projects.Select(pj => pj.Questions)).
                Include(p => p.Locations).
                Include(p => p.Locations.Select(loc => loc.Address)).
                Include(p => p.ReferralAgencies).
                Include(p => p.ReferralAgencies.Select(ra => ra.Address)).
                Include(p => p.Staff).
                SingleOrDefault();
      if (pod != null && pod.Projects != null) 
        pod.Projects.Sort(ProjectCompareByName);
      return pod;
    } // POD