public void CallRedistributeQuantity(IList <string> styleIdList) { var settings = new SettingsService(_dbFactory); var quantityManager = new QuantityManager(_log, _time); var qtyDistributionService = new QuantityDistributionService(_dbFactory, quantityManager, _log, _time, QuantityDistributionHelper.GetDistributionMarkets(), DistributeMode.None); using (var db = _dbFactory.GetRWDb()) { db.DisableValidation(); if (!styleIdList.Any()) { qtyDistributionService.Redistribute(db); } else { var style = db.Styles.GetAllActiveAsDto().Where(st => styleIdList.Contains(st.StyleID)).ToList(); var styleIds = style.Select(st => st.Id).ToList(); qtyDistributionService.RedistributeForStyle(db, styleIds); } } }
protected override void RunCallback() { var dbFactory = new DbFactory(); var time = new TimeService(dbFactory); var settings = new SettingsService(dbFactory); var quantityManager = new QuantityManager(GetLogger(), time); using (var db = dbFactory.GetRWDb()) { var service = new QuantityDistributionService(dbFactory, quantityManager, GetLogger(), time, QuantityDistributionHelper.GetDistributionMarkets(), DistributeMode.None); service.Redistribute(db); settings.SetQuantityDistributeDate(time.GetAppNowTime()); } }