private void ProcessCheckBoxes(ProjectCost projectCost, ProjectType projectType, TextBox[] targets, TextBox[] actuals, int[] months) { for (var index = 0; index < months.Length; index++) { var cost = projectCost.GetCostEntry(projectType, CostType.Target, months[index]); targets[index].Text = cost.ToString(); } for (var index = 0; index < months.Length; index++) { var cost = projectCost.GetCostEntry(projectType, CostType.Actual, months[index]); actuals[index].Text = cost.ToString(); } }
private void ProcessTotal(SharePointListItem sharepointListItem, ProjectCost projectCost, int[] months) { twelvtxtcavalue.Text = string.Format("{0:n0}", sharepointListItem.SavedOver12Months_CA); twelvtxtcrvalue.Text = string.Format("{0:n0}", sharepointListItem.SavedOver12Months_CR); twelvtxtrgvalue.Text = string.Format("{0:n0}", sharepointListItem.SavedOver12Months_RG); twelvtxtcivalue.Text = string.Format("{0:n0}", sharepointListItem.SavedOver12Months_CI); twelvtxttatalvalue.Text = string.Format("{0:n0}", sharepointListItem.SavedOver12Months_Total); yeartxtca.Text = string.Format("{0:n0}", sharepointListItem.SavedYearToDate_CA); yeartxtcr.Text = string.Format("{0:n0}", sharepointListItem.SavedYearToDate_CR); yeartxtrg.Text = string.Format("{0:n0}", sharepointListItem.SavedYearToDate_RG); yeartxtci.Text = string.Format("{0:n0}", sharepointListItem.SavedYearToDate_CI); yearlbltotalval.Text = string.Format("{0:n0}", sharepointListItem.SavedYearToDate_Total); esttxtca.Text = string.Format("{0:n0}", sharepointListItem.EstimatedSaving_CA); esttxtcr.Text = string.Format("{0:n0}", sharepointListItem.EstimatedSaving_CR); esttxtrg.Text = string.Format("{0:n0}", sharepointListItem.EstimatedSaving_RG); esttxtci.Text = string.Format("{0:n0}", sharepointListItem.EstimatedSaving_CI); estlbltotalval.Text = string.Format("{0:n0}", sharepointListItem.EstimatedSaving_Total); var targets = new[] { target1total, target2total, target3total, target4total, target5total, target6total, target7total, target8total, target9total, target10total, target11total, target12total }; this.ProcessFooter(targets, months, projectCost.GetTargetTotal); var actuals = new[] { actual1total, actual2total, actual3total, actual4total, actual5total, actual6total, actual7total, actual8total, actual9total, actual10total, actual11total, actual12total }; this.ProcessFooter(actuals, months, projectCost.GetActualTotal); }
private void ProcessCheckBoxes(ProjectCost projectCost, CheckBox checkBox, ProjectType projectType, TextBox[] targets, TextBox[] actuals, int[] months) { for (var index = 0; index < months.Length; index++) { projectCost.SetCostEntry(projectType, CostType.Target, months[index], this.GetProcessedCost(checkBox, targets[index].Text)); } for (var index = 0; index < months.Length; index++) { projectCost.SetCostEntry(projectType, CostType.Actual, months[index], this.GetProcessedCost(checkBox, actuals[index].Text)); } }
private ProjectCost ProcessCost(int[] months) { var period = int.Parse(ddlPeriod.SelectedValue); var projectCost = new ProjectCost(period); projectCost.CapExAmount = this.GetProcessedCost(txtcapExp.Text.Trim()); projectCost.ImplementationCost = this.GetProcessedCost(txtimplcost.Text.Trim()); hdntotal.Value = string.Format("{0:n0}", projectCost.TotalCost); this.ProcessCheckBoxes(projectCost, chkCostAvoidance, ProjectType.CostAvoidance, this.TargetTextBoxesForCA, this.ActualTextBoxesForCA, months); this.ProcessCheckBoxes(projectCost, chkCostReduction, ProjectType.CostReduction, this.TargetTextBoxesForCR, this.ActualTextBoxesForCR, months); this.ProcessCheckBoxes(projectCost, chkRevenueGrowth, ProjectType.RevenueGrowth, this.TargetTextBoxesForRG, this.ActualTextBoxesForRG, months); this.ProcessCheckBoxes(projectCost, chkCapacityIncrease, ProjectType.CapacityIncrease, this.TargetTextBoxesForCI, this.ActualTextBoxesForCI, months); var sharepointListItem = SharePointListItem.Convert(projectCost, int.Parse(lblmnth1.Text)); this.ProcessTotal(sharepointListItem, projectCost, months); return projectCost; }