public NomenklaturaDto(Nomenklatura nomenklatura, bool main) : base(nomenklatura?.Specialisation, false) { if (nomenklatura == null) { return; } if (main) { this.Id = nomenklatura.Id; this.Name = nomenklatura.Name; } this.BasePrice = nomenklatura.BasePrice; this.NomenklaturaId = nomenklatura.Id; this.NomenklaturaName = nomenklatura.Name; this.LifeStyleId = nomenklatura.Lifestyle; this.LifeStyle = BillingHelper.GetLifestyle(nomenklatura.Lifestyle).ToString(); this.Code = nomenklatura.Code; this.Description = nomenklatura.Description; if (string.IsNullOrEmpty(nomenklatura.PictureUrl)) { this.PictureUrl = nomenklatura?.Specialisation?.ProductType?.PictureUrl ?? ""; } else { this.PictureUrl = nomenklatura.PictureUrl; } this.BaseCount = nomenklatura.BaseCount; }
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); }); }
public ShopDto(int modelId, ShopWallet shop) : base(modelId, shop) { if (shop == null) { return; } Lifestyle = new LifestyleDto { Id = shop.LifeStyle, Name = BillingHelper.GetLifestyle(shop.LifeStyle).ToString() }; if (shop.Specialisations == null) { Specialisations = new List <int>(); } else { Specialisations = shop.Specialisations.Select(s => s.SpecialisationId).ToList(); } if (shop.TrustedUsers == null) { TrustedUsers = new List <int>(); } else { TrustedUsers = shop.TrustedUsers.Select(s => s.Model).ToList(); } if (shop.Wallet == null) { return; } Balance = shop.Wallet.Balance; Comment = shop.Comment; Location = shop.Location; }