예제 #1
0
        public void CalculateCosts()
        {
            lock (m_Lock)
            {
                IList <IResourceSchedule <int> > resourceSchedules = GraphCompilation?.ResourceSchedules;
                IList <ResourceDto> resources = ResourceSettingsDto.Resources;

                if (resourceSchedules == null || resources == null)
                {
                    return;
                }

                IList <ResourceSeriesDto> resourceSeriesSet = m_ProjectManager.CalculateResourceSeriesSet(resourceSchedules, resources, ResourceSettingsDto.DefaultUnitCost);
                ResourceSeriesSet.Clear();
                foreach (ResourceSeriesDto series in resourceSeriesSet)
                {
                    ResourceSeriesSet.Add(series);
                }

                ClearCosts();
                if (HasCompilationErrors)
                {
                    return;
                }

                CostsDto costs = m_ProjectManager.CalculateProjectCosts(resourceSeriesSet);
                DirectCost   = costs.DirectCost;
                IndirectCost = costs.IndirectCost;
                OtherCost    = costs.OtherCost;
                TotalCost    = costs.TotalCost;
            }
        }
 public void ClearCosts()
 {
     lock (m_Lock)
     {
         ResourceSeriesSet.Clear();
         DirectCost   = null;
         IndirectCost = null;
         OtherCost    = null;
         TotalCost    = null;
     }
 }