コード例 #1
0
        /// <summary>
        /// Builds the resource string.
        /// </summary>
        /// <param name="reesourceSummaryCollection">The reesource summary collection.</param>
        /// <returns>Formatted String</returns>
        private static string BuildResourceString(ResourceSummaryCollection reesourceSummaryCollection)
        {
            string resourceString       = string.Empty;
            bool   firstTime            = true;
            string resourceFormatString = " '{0}'";

            foreach (ResourceSummary resourceSummary in reesourceSummaryCollection)
            {
                if (!firstTime)
                {
                    resourceString += "," + string.Format(resourceFormatString, resourceSummary.Identity.Name);
                }
                else
                {
                    resourceString = string.Format(resourceFormatString, resourceSummary.Identity.Name);
                }

                firstTime = false;
            }
            return(resourceString);
        }
コード例 #2
0
        /// <summary>
        /// Gets the assigned to where clause.
        /// </summary>
        /// <param name="sessionId">The session identifier.</param>
        /// <param name="fieldFilter">The field filter.</param>
        /// <returns>
        /// Assigned to WhereClause
        /// </returns>
        private static string GetAssignedToWhereClause(string sessionId, FieldFilter fieldFilter, BurnRetrievalOptions retrievalOptions)
        {
            string assignedToClause = " ";
            ResourceSummaryCollection reesourceSummaryCollection = null;

            if (fieldFilter.AssignedTo != null && !string.IsNullOrEmpty(fieldFilter.AssignedTo.Name))
            {
                if (fieldFilter.AssignedTo.Name.Contains("Team"))
                {
                    // Get Group Members
                    ResourceService  resourceService      = new ResourceService();
                    ResourceIdentity groupresourceIdenity = new ResourceIdentity()
                    {
                        Id = fieldFilter.AssignedTo.Id, Name = fieldFilter.AssignedTo.Name
                    };
                    reesourceSummaryCollection = resourceService.GetMembersOfGroup(sessionId, groupresourceIdenity, false);
                    if (reesourceSummaryCollection != null && reesourceSummaryCollection.Count > 0)
                    {
                        assignedToClause = assignedToClause + string.Format("({0})", BuildResourceString(reesourceSummaryCollection));
                    }
                }
                else
                {
                    // Individual resource we can use directly as below.
                    assignedToClause = assignedToClause + string.Format("('{0}')", fieldFilter.AssignedTo.Name);

                    reesourceSummaryCollection = new ResourceSummaryCollection();
                    ResourceSummary resourceSummary = new ResourceSummary();
                    resourceSummary.Identity      = new ResourceIdentity();
                    resourceSummary.Identity.Name = fieldFilter.AssignedTo.Name;
                    reesourceSummaryCollection.Add(resourceSummary);
                }

                PopulateTeamMembers(retrievalOptions, reesourceSummaryCollection);
            }

            return(assignedToClause);
        }
コード例 #3
0
        private static void PopulateTeamMembers(BurnRetrievalOptions retrievalOptions, ResourceSummaryCollection reesourceSummaryCollection)
        {
            if (retrievalOptions.Team.Members == null)
            {
                retrievalOptions.Team.Members = new List <global::DataModel.Resource>();
            }

            foreach (ResourceSummary resourceSummary in reesourceSummaryCollection)
            {
                global::DataModel.Resource resource = new global::DataModel.Resource();
                resource.Name = resourceSummary.Identity.Name;
                retrievalOptions.Team.Members.Add(resource);
            }
        }