public void SetCostEntry(ProjectType projectType, CostType costTye, int month, long cost) { var projectCostEntry = new ProjectCostEntry(); projectCostEntry.ProjectType = projectType; projectCostEntry.CostType = costTye; projectCostEntry.Month = month; projectCostEntry.Cost = cost; this.SetCostEntry(projectCostEntry); }
/// <summary> /// Gets the actual or target cost entry for the given project type and the month. /// </summary> /// <param name="projectType">Type of project.</param> /// <param name="costType">The actual or target cost indicator.</param> /// <param name="month">Month for the calculation.</param> /// <returns>The cost value.</returns> public long GetCostEntry(ProjectType projectType, CostType costType, int month) { var key = ProjectCostEntry.ToString(projectType, costType, month); if (this.costEntries.ContainsKey(key)) { return(this.costEntries[key].Cost); } return(0); }
/// <summary> /// Gets the total saving for the 12 months to be realized. /// </summary> /// <param name="projectType">The type of project.</param> /// <param name="monthToStart">The month to start with.</param> /// <returns>The total cost.</returns> public long GetSavedOver12Months(ProjectType projectType, int monthToStart) { var startDate = new DateTime(DateTime.Now.Year, monthToStart, 1); var cost = this.GetSavedYearToDate(projectType, monthToStart); for (var index = this.Period; index < 12; index++) { var month = startDate.AddMonths(index).Month; var keyToSearch = ProjectCostEntry.ToString(projectType, CostType.Target, month); cost += this.GetTotal(keyToSearch); } return(cost); }
/// <summary> /// Sets the actual or target cost entry for the given project type and the month. /// </summary> /// <param name="projectCostEntry">Instance of the <see cref="ProjectCostEntry" /> structure.</param> public void SetCostEntry(ProjectCostEntry projectCostEntry) { var key = projectCostEntry.ToString(); this.costEntries[key] = projectCostEntry; }
/// <summary> /// Gets the total for actual cost for all the project types for the given month. /// </summary> /// <param name="month">The month for which the total cost needs to be calculated.</param> /// <returns>The cost value.</returns> public long GetActualTotal(int month) { var keyToSearch = ProjectCostEntry.ToString(CostType.Actual, month); return(this.GetTotal(keyToSearch)); }