public ActionResult GetProjectUnitValue(List <UnitValueParam> args) { StatisticLogic logic = new StatisticLogic(); if (args == null || args.Count == 0) { return(null); } int length = args.Count; UnitValueParam param = null; List <SumHourModel> results = new List <SumHourModel>(); for (int i = 0; i < length; i++) { param = args[i]; if (param.IsParent) { List <Guid> subProjectIds = logic.GetSubProjectIdsById(param.ProjectId); int len = subProjectIds.Count; SumHourModel pshm = new SumHourModel(); pshm.ProjectName = param.ProjectName; pshm.TotalHour = 0; pshm.TotalValue = 0; for (int j = 0; j < len; j++) { SumHourModel cshm = logic.GetTotalValueById(subProjectIds[j]); if (cshm != null) { pshm.TotalHour += cshm.TotalHour; pshm.TotalValue += cshm.TotalValue; } } results.Add(pshm); } else { SumHourModel shm = logic.GetTotalValueById(param.ProjectId); if (shm == null) { shm = new SumHourModel(); shm.ProjectName = param.ProjectName; shm.TotalHour = 0; shm.TotalValue = 0; } results.Add(shm); } } return(Json(new { Result = results })); }