public async Task OnImplantInstalled(int model, string implantlifestyle, string autodoclifestyle) { var factorId = GetFactorId(ScoringFactorEnum.implant_install); var scoring = GetScoringByModelId(model); if (!BillingHelper.LifestyleIsDefined(implantlifestyle) || !BillingHelper.LifestyleIsDefined(autodoclifestyle)) { return; } var lifestyle = BillingHelper.GetLifestyle(implantlifestyle); await RaiseScoringEvent(scoring.Id, factorId, (context) => { var ls = (int)lifestyle; var value = context.Set <ScoringEventLifestyle>().AsNoTracking().FirstOrDefault(s => s.ScoringFactorId == factorId && s.EventNumber == ls); return(value?.Value ?? 1); }); factorId = GetFactorId(ScoringFactorEnum.where_implant_install); lifestyle = BillingHelper.GetLifestyle(autodoclifestyle); await RaiseScoringEvent(scoring.Id, factorId, (context) => { var ls = (int)lifestyle; var value = context.Set <ScoringEventLifestyle>().AsNoTracking().FirstOrDefault(s => s.ScoringFactorId == factorId && s.EventNumber == ls); return(value?.Value ?? 1); }); }
public async Task OnPillConsumed(int model, string pillLifestyle) { var factorId = GetFactorId(ScoringFactorEnum.pill_use); if (!BillingHelper.LifestyleIsDefined(pillLifestyle)) { return; } var lifestyle = BillingHelper.GetLifestyle(pillLifestyle); var scoring = GetScoringByModelId(model); await RaiseScoringEvent(scoring.Id, factorId, (context) => { var ls = (int)lifestyle; var value = context.Set <ScoringEventLifestyle>().AsNoTracking().FirstOrDefault(s => s.ScoringFactorId == factorId && s.EventNumber == ls); return(value?.Value ?? 1); }); }