public void BizAction(long inputData) { var punch = _updatedbAccess.GetPunch(inputData); if (punch == null) { AddError("Could not find the punch. Someone entering illegal ids?"); return; } var activity = _activityDbAccess.GetActivityToPunches(punch.ActivityId); if (activity == null) { AddError("activity not valid!!!", "Activity"); return; } var punchType = _dbAccessPunchType.GetPunchTypeToWorkPackages(punch.PunchTypeId); if (punchType == null) { AddError("Invalied punch Type!!!", "Activity"); return; } var wokPackage = punchType.WorkPackages.FirstOrDefault(s => s.WorkPackageId == activity.WorkPackageId); if (wokPackage == null) { AddError("Not defiened precentage for wokpackage's punch type!!!", "Activity"); return; } float precentage = 0; if (activity.Punchs.Where(s => s.PunchTypeId == punch.PunchTypeId).Count() == 1) { precentage = activity.Progress - wokPackage.Precentage; activity.UpdateActivityProgress(precentage); } }
public void BizAction(long inputData) { var item = _updatedbAccess.GetPunch(inputData); if (item == null) { AddError("Could not find the punch. Someone entering illegal ids?"); return; } if (item.ClearDate.HasValue) { AddError("punch is clear and not alowed for delete!!!"); return; } _dbAccess.Delete(item); Message = $"work package is Delete: {item.ToString()}."; }