IEnumerator GetOverallReport() { string overallReportUrl = baseUrl + "player/getOverallReport"; UnityWebRequest overallReportRequest = UnityWebRequest.Get(overallReportUrl); yield return(overallReportRequest.SendWebRequest()); if (overallReportRequest.isNetworkError || overallReportRequest.isHttpError) { Debug.Log(overallReportRequest.error); yield break; } else { Debug.Log("Get overall report successfully"); } JSONNode overallReportData = JSON.Parse(overallReportRequest.downloadHandler.text); double overallAccuracy = overallReportData["overall_accuracy"] == "NaN" ? 0.0 : (double)overallReportData["overall_accuracy"]; double sweAccuracy = overallReportData["overall_SE_accuracy"] == "NaN" ? 0.0 : (double)overallReportData["overall_SE_accuracy"]; double saAccuracy = overallReportData["overall_SA_accuracy"] == "NaN" ? 0.0 : (double)overallReportData["overall_SA_accuracy"]; double pmAccuracy = overallReportData["overall_PM_accuracy"] == "NaN" ? 0.0 : (double)overallReportData["overall_PM_accuracy"]; double qaAccuracy = overallReportData["overall_QA_accuracy"] == "NaN" ? 0.0 : (double)overallReportData["overall_QA_accuracy"]; string onlineTime = overallReportData["total_game_time"]; overallReport = new OverallReport { overallAccuracy = overallAccuracy, sweAccuracy = sweAccuracy, saAccuracy = saAccuracy, pmAccuracy = pmAccuracy, qaAccuracy = qaAccuracy, onlineTime = onlineTime }; SetTable(); }
public override string ToString() { StringBuilder output = new StringBuilder(); if (Source == null && string.IsNullOrEmpty(Target.Trim('/'))) { output.Append("Overall:"); } else { if (Source != null) { output.Append(Source); output.Append("->"); } output.Append(Target); output.Append(':'); } if (OverallReport != null) { output.Append(OverallReport.ToString()); } return(output.ToString()); }
public ActionResult getOverallReportData(OverallModel data) { var context = new RRRoadwaysDBContext(); int vehicleNumber = Convert.ToInt32(data.VehicleNumber); OverallReport reportdata = new OverallReport(); List <FixedExpanse> expanseList = new List <FixedExpanse>(); reportdata.Claim = context.VehicleClaim.Where(c => c.ClaimDate.Value.Date >= data.StartDate.Date) .Where(c => c.ClaimDate.Value.Date <= data.EndDate.Date) .Where(c => data.VehicleNumber != "-1" ? c.VehicleId == vehicleNumber : 1 == 1).ToList().Sum(x => x.Amount); reportdata.Maintenance = context.Maintenance.Where(c => c.MaintenanceDate.Value.Date >= data.StartDate.Date) .Where(c => c.MaintenanceDate.Value.Date <= data.EndDate.Date) .Where(c => data.VehicleNumber != "-1" ? c.VehicleId == vehicleNumber : 1 == 1).ToList().Sum(x => x.Amount); expanseList = context.FixedExpanse.Where(c => c.EntryDate.Value.Date >= data.StartDate.Date) .Where(c => c.EntryDate.Value.Date <= data.EndDate.Date) .Where(c => data.VehicleNumber != "-1" ? c.VehicleId == vehicleNumber : 1 == 1).ToList(); reportdata.FixedExpanse = 0; if (expanseList.Count > 0) { foreach (var item in expanseList) { reportdata.FixedExpanse += (item.StaffSalary + item.StaffBhatta + item.DriverRoomRent + item.Donation + item.FormanSalary + item.ExtraDriversSalary + item.ExtraExpense); } } reportdata.Installment = context.Installment.Where(c => c.EntryDate.Value.Date >= data.StartDate.Date) .Where(c => c.EntryDate.Value.Date <= data.EndDate.Date) .Where(c => data.VehicleNumber != "-1" ? c.VehicleId == vehicleNumber : 1 == 1).ToList().Sum(x => x.Amount); reportdata.Profit = 0; Decimal?totalAmdan = context.Voucher.Where(c => c.CreatedDate.Value.Date >= data.StartDate.Date) .Where(c => c.CreatedDate.Value.Date <= data.EndDate.Date) .Where(c => data.VehicleNumber != "-1" ? c.VehicleNumber == vehicleNumber : 1 == 1).ToList().Sum(x => x.DownAmount + x.UpAmount); Decimal?OilAmount = context.Voucher.Where(c => c.CreatedDate.Value.Date >= data.StartDate.Date) .Where(c => c.CreatedDate.Value.Date <= data.EndDate.Date) .Where(c => data.VehicleNumber != "-1" ? c.VehicleNumber == vehicleNumber : 1 == 1).ToList().Sum(x => x.OilAmount); Decimal?totalDieselAndOil = 0; Decimal?totalOil = 0; var totalDieselAndOilList = context.Voucher.Join(context.VoucherDieselDetails, vou => vou.Id, vou_die => vou_die.VoucherId, (vou, vou_die) => new { Date = vou.CreatedDate, VehicleNo = vou.VehicleNumber, voucherId = vou.Id, OilAmount = vou.OilAmount, Litre = vou_die.Litre, Rate = vou_die.Rate, Amount = vou_die.Amount, }).Where(c => c.Date.Value.Date >= data.StartDate.Date) .Where(c => c.Date.Value.Date <= data.EndDate.Date) .Where(c => data.VehicleNumber != "-1" ? c.VehicleNo == vehicleNumber : 1 == 1).ToList(); if (totalDieselAndOilList.Count > 0) { //int tempId = 0; foreach (var item in totalDieselAndOilList) { totalDieselAndOil += ((item.Litre * item.Rate) + item.Amount); //if (tempId == 0 || tempId != item.voucherId) { // tempId = item.voucherId; // totalDieselAndOil += item.OilAmount == null ? 0 : item.OilAmount; //} } } totalDieselAndOil += OilAmount; Decimal?totalOtherExpanse = context.Voucher.Join(context.VoucherOthersExpenses, vou => vou.Id, vou_other => vou_other.VoucherId, (vou, vou_other) => new { Date = vou.CreatedDate, VehicleNo = vou.VehicleNumber, OtherAmount = vou_other.Amount, }).Where(c => c.Date.Value.Date >= data.StartDate.Date) .Where(c => c.Date.Value.Date <= data.EndDate.Date) .Where(c => data.VehicleNumber != "-1" ? c.VehicleNo == vehicleNumber : 1 == 1).ToList().Sum(x => x.OtherAmount); reportdata.Profit = (totalAmdan - (totalDieselAndOil + totalOtherExpanse)); reportdata.TotalRemaining = (reportdata.Profit - reportdata.Claim - reportdata.Maintenance - reportdata.FixedExpanse - reportdata.Installment); return(Json(new { data = reportdata }, new Newtonsoft.Json.JsonSerializerSettings())); }
public OverallReport CreateOverallReport() { var report = new OverallReport(); if (_userAccountActionsRepository .GetAllUserAccountActions().Any(accountAction => accountAction.ActionType == UserAccountActionType.AccountCreated) == true) { report.CreatedUserAccounts = _userAccountActionsRepository.GetAllUserAccountActions() .Where(accountAction => accountAction.ActionType == UserAccountActionType.AccountCreated).ToList() .Count; } if (_userAccountActionsRepository .GetAllUserAccountActions() .Any(accountAction => accountAction.ActionType == UserAccountActionType.SuccessfulLogonAttempt) == true) { report.TotalLogonCount = _userAccountActionsRepository.GetAllUserAccountActions() .Where(accountAction => accountAction.ActionType == UserAccountActionType.SuccessfulLogonAttempt) .ToList().Count; } if (_productActionsRepository .GetAllProductActions().Any(productAction => productAction.Action == ActionType.AddedNewProduct) == true) { report.AddedProducts = _productActionsRepository.GetAllProductActions() .Where(productAction => productAction.Action == ActionType.AddedNewProduct).ToList().Count; } if (_productActionsRepository.GetAllProductActions() .Where(productAction => productAction.Action == ActionType.RemovedProduct).ToList().Any() == true) { report.RemovedProducts = _productActionsRepository.GetAllProductActions() .Where(productAction => productAction.Action == ActionType.RemovedProduct).ToList().Count; } if (_planActionsRepository.GetAllDietPlanActions() .ToList().Any() == true) { report.AddedPlans = _planActionsRepository.GetAllDietPlanActions() .ToList().Count; } report.ProductsAddedToFav = _productActionsRepository .GetAllProductActions() .Count(productAction => productAction.Action == ActionType.ProductAddedToFavorites); report.ProductsRemovedFromFav = _productActionsRepository .GetAllProductActions() .Count(productAction => productAction.Action == ActionType.ProductRemovedFromFavorites); report.ProductsAddedToPlans = _planActionsRepository .GetAllProductInPlanActions() .Count(productInPlanAction => productInPlanAction.Action == ActionType.AddedProductToExistingDailyPlan); report.SearchesDone = _productActionsRepository .GetAllSearchValueActions().Count() + _productActionsRepository .GetAllSearchStringActions().Count(); if (_productActionsRepository .GetAllSearchStringActions().Any()) { report.TopStringSearch = _productActionsRepository.GetAllSearchStringActions() .GroupBy(x => x.SearchString) .Select(x => new { SearchString = x.Key, TimesAppeared = x.Count() }).ToList() .OrderByDescending(x => x.TimesAppeared).First().SearchString; } if (_productActionsRepository .GetAllSearchValueActions() .Any(action => action.SearchType == SearchActionType.SearchByCalories) == true) { report.AvgCaloriesSearch = Math.Round(_productActionsRepository.GetAllSearchValueActions() .Where(action => action.SearchType == SearchActionType.SearchByCalories).ToList() .Average(value => value.SearchValue), 2); } if (_productActionsRepository .GetAllSearchValueActions() .Any(action => action.SearchType == SearchActionType.SearchByCarbohydrates) == true) { report.AvgCarbohydratesSearch = Math.Round(_productActionsRepository.GetAllSearchValueActions() .Where(action => action.SearchType == SearchActionType.SearchByCarbohydrates).ToList() .Average(value => value.SearchValue), 2); } if (_productActionsRepository .GetAllSearchValueActions() .Any(action => action.SearchType == SearchActionType.SearchByFat) == true) { report.AvgFatSearch = Math.Round(_productActionsRepository.GetAllSearchValueActions() .Where(action => action.SearchType == SearchActionType.SearchByFat).ToList() .Average(value => value.SearchValue), 2); } if (_productActionsRepository .GetAllSearchValueActions() .Any(action => action.SearchType == SearchActionType.SearchByProtein) == true) { report.AvgProteinsSearch = Math.Round(_productActionsRepository.GetAllSearchValueActions() .Where(action => action.SearchType == SearchActionType.SearchByProtein).ToList() .Average(value => value.SearchValue), 2); } if (_productActionsRepository .GetAllProductActions() .Any(action => action.Action == ActionType.ProductAddedToFavorites) == true) { report.TopFavId = _productActionsRepository.GetAllProductActions() .Where(action => action.Action == ActionType.ProductAddedToFavorites) .GroupBy(action => action.ProductName) .Select(x => new { ProductName = x.Key, TimesAppeared = x.Count() }).ToList() .OrderByDescending(x => x.TimesAppeared).First().ProductName; } if (_planActionsRepository .GetAllBmiActions().Any() == true) { report.AvgUserBmi = Math.Round(_planActionsRepository.GetAllBmiActions() .ToList().Average(bmi => bmi.Bmi), 2); } if (_planActionsRepository .GetAllDietPlanActions() .Any(action => action.Action == ActionType.AddedDietPlan) == true) { report.AvgPlanLength = Math.Round(_planActionsRepository.GetAllDietPlanActions() .Where(action => action.Action == ActionType.AddedDietPlan).ToList() .Average(action => action.Length), 2); } if (_planActionsRepository .GetAllDietPlanActions() .Any(action => action.Action == ActionType.AddedDietPlan) == true) { report.AvgPlanCalories = Math.Round(_planActionsRepository.GetAllDietPlanActions() .Where(action => action.Action == ActionType.AddedDietPlan).ToList() .Average(action => action.CaloriesPerDay), 2); } return(report); }