public void Update(ICacheService cacheService, Account selectedAccount, WorkPeriod currentWorkPeriod)
        {
            var accountType = cacheService.GetAccountTypeById(selectedAccount.AccountTypeId);
            var transactions = Dao.Query(GetCurrentRange(accountType.DefaultFilterType, x => x.AccountId == selectedAccount.Id, currentWorkPeriod)).OrderBy(x => x.Date);
            Transactions = transactions.Select(x => new AccountDetailData(x, selectedAccount)).ToList();
            if (accountType.DefaultFilterType > 0)
            {
                var pastDebit = Dao.Sum(x => x.Debit, GetPastRange(accountType.DefaultFilterType, x => x.AccountId == selectedAccount.Id, currentWorkPeriod));
                var pastCredit = Dao.Sum(x => x.Credit, GetPastRange(accountType.DefaultFilterType, x => x.AccountId == selectedAccount.Id, currentWorkPeriod));
                var pastExchange = Dao.Sum(x => x.Exchange, GetPastRange(accountType.DefaultFilterType, x => x.AccountId == selectedAccount.Id, currentWorkPeriod));
                if (pastCredit > 0 || pastDebit > 0)
                {
                    Summaries.Add(new AccountSummaryData(Resources.Total, Transactions.Sum(x => x.Debit), Transactions.Sum(x => x.Credit)));
                    var detailValue =
                        new AccountDetailData(
                        new AccountTransactionValue
                        {
                            Name = Resources.PastTransactions,
                            Credit = pastCredit,
                            Debit = pastDebit,
                            Exchange = pastExchange
                        }, selectedAccount) { IsBold = true };
                    Transactions.Insert(0, detailValue);
                }
            }

            Summaries.Add(new AccountSummaryData(Resources.GrandTotal, Transactions.Sum(x => x.Debit), Transactions.Sum(x => x.Credit)));

            for (var i = 0; i < Transactions.Count; i++)
            {
                Transactions[i].Balance = (Transactions[i].Debit - Transactions[i].Credit);
                if (i > 0) (Transactions[i].Balance) += (Transactions[i - 1].Balance);
            }
        }
Example #2
0
 public AccountBalances(IApplicationState applicationState, ICacheService cacheService, IAccountDao accountDao)
 {
     _applicationState = applicationState;
     _cacheService = cacheService;
     _accountDao = accountDao;
     Balances = new Dictionary<int, decimal>();
 }
 public WarehouseInventoryViewModel(IInventoryService inventoryService, ICacheService cacheService, IApplicationState applicationState)
 {
     _inventoryService = inventoryService;
     _cacheService = cacheService;
     _applicationState = applicationState;
     WarehouseButtonSelectedCommand = new CaptionCommand<Warehouse>("", OnWarehouseSelected);
 }
Example #4
0
 public IndexerManagerService(IContainer c, IConfigurationService config, Logger l, ICacheService cache)
 {
     container = c;
     configService = config;
     logger = l;
     cacheService = cache;
 }
Example #5
0
 public PrinterMapViewModel(PrinterMap model, IMenuService menuService, IPrinterDao printerDao, ICacheService cacheService)
 {
     Model = model;
     _menuService = menuService;
     _printerDao = printerDao;
     _cacheService = cacheService;
 }
 public PackagesController(
     IPackageService packageService,
     IUploadFileService uploadFileService,
     IUserService userService,
     IMessageService messageService,
     ISearchService searchService,
     IAutomaticallyCuratePackageCommand autoCuratedPackageCmd,
     INuGetExeDownloaderService nugetExeDownloaderService,
     IPackageFileService packageFileService,
     IEntitiesContext entitiesContext,
     IAppConfiguration config,
     IIndexingService indexingService,
     ICacheService cacheService)
 {
     _packageService = packageService;
     _uploadFileService = uploadFileService;
     _userService = userService;
     _messageService = messageService;
     _searchService = searchService;
     _autoCuratedPackageCmd = autoCuratedPackageCmd;
     _nugetExeDownloaderService = nugetExeDownloaderService;
     _packageFileService = packageFileService;
     _entitiesContext = entitiesContext;
     _config = config;
     _indexingService = indexingService;
     _cacheService = cacheService;
 }
 public DepartmentSelectorView(IApplicationStateSetter applicationStateSetter, IApplicationState applicationState,
     IUserService userService, ICacheService cacheService)
 {
     InitializeComponent();
     _applicationStateSetter = applicationStateSetter;
     DataContext = new DepartmentSelectorViewModel(applicationState, _applicationStateSetter, userService, cacheService);
 }
Example #8
0
 public ExecutePrintJob(ITicketService ticketService, IApplicationState applicationState, ICacheService cacheService, IPrinterService printerService)
 {
     _ticketService = ticketService;
     _applicationState = applicationState;
     _cacheService = cacheService;
     _printerService = printerService;
 }
        public OutputCacheFilter(
            ICacheManager cacheManager,
            IOutputCacheStorageProvider cacheStorageProvider,
            ITagCache tagCache,
            IDisplayedContentItemHandler displayedContentItemHandler,
            IWorkContextAccessor workContextAccessor,
            IThemeManager themeManager,
            IClock clock,
            ICacheService cacheService,
            ISignals signals,
            ShellSettings shellSettings) {

            _cacheManager = cacheManager;
            _cacheStorageProvider = cacheStorageProvider;
            _tagCache = tagCache;
            _displayedContentItemHandler = displayedContentItemHandler;
            _workContextAccessor = workContextAccessor;
            _themeManager = themeManager;
            _clock = clock;
            _cacheService = cacheService;
            _signals = signals;
            _shellSettings = shellSettings;

            Logger = NullLogger.Instance;
        }
 public TicketTotalsViewModel(ICacheService cacheService, AccountBalances accountBalances)
 {
     _cacheService = cacheService;
     _accountBalances = accountBalances;
     ResetCache();
     _model = Ticket.Empty;
 }
Example #11
0
 public AdminService(ICacheService cacheService
     , ICatalogService catalogService)
 {
     this.CacheService = cacheService;
     this.CatalogService = catalogService;
     this.EmailerService = DependencyResolver.Current.GetService<IEmailerService>();
 }
Example #12
0
        public BasicReportModule(IRegionManager regionManager, BasicReportView basicReportView,
            IWorkPeriodService workPeriodService, IPrinterService printerService, ICacheService cacheService,
            IInventoryService inventoryService, IUserService userService, IAutomationService automationService,
            IApplicationState applicationState, ILogService logService, ISettingService settingService)
            : base(regionManager, AppScreens.ReportView)
        {
            ReportContext.PrinterService = printerService;
            ReportContext.WorkPeriodService = workPeriodService;
            ReportContext.InventoryService = inventoryService;
            ReportContext.UserService = userService;
            ReportContext.ApplicationState = applicationState;
            ReportContext.CacheService = cacheService;
            ReportContext.LogService = logService;
            ReportContext.SettingService = settingService;

            _userService = userService;

            _regionManager = regionManager;
            _basicReportView = basicReportView;
            SetNavigationCommand(Resources.Reports, Resources.Common, "Images/Ppt.png", 60);

            PermissionRegistry.RegisterPermission(PermissionNames.OpenReports, PermissionCategories.Navigation, Resources.CanDisplayReports);
            PermissionRegistry.RegisterPermission(PermissionNames.ChangeReportDate, PermissionCategories.Report, Resources.CanChangeReportFilter);

            //todo refactor
            automationService.RegisterParameterSource("ReportName", () => ReportContext.Reports.Select(x => x.Header));

        }
Example #13
0
 public TagController(ILoggingService loggingService, IUnitOfWorkManager unitOfWorkManager, IMembershipService membershipService, ILocalizationService localizationService, IRoleService roleService, ISettingsService settingsService, ITopicTagService topicTagService, ICategoryService categoryService, ICacheService cacheService)
     : base(loggingService, unitOfWorkManager, membershipService, localizationService, roleService, settingsService)
 {
     _topicTagService = topicTagService;
     _categoryService = categoryService;
     _cacheService = cacheService;
 }
        public MenuItemSelectorViewModel(IApplicationState applicationState, IApplicationStateSetter applicationStateSetter, IMenuService menuService,
            ISettingService settingService, ICacheService cacheService)
        {
            _applicationState = applicationState;
            _applicationStateSetter = applicationStateSetter;
            _menuService = menuService;
            _settingService = settingService;
            _cacheService = cacheService;

            CategoryCommand = new DelegateCommand<ScreenMenuCategory>(OnCategoryCommandExecute);
            MenuItemCommand = new DelegateCommand<ScreenMenuItem>(OnMenuItemCommandExecute);
            TypeValueCommand = new DelegateCommand<string>(OnTypeValueExecute);
            FindLocationCommand = new DelegateCommand<string>(OnFindLocationExecute, CanFindLocation);
            FindMenuItemCommand = new DelegateCommand<string>(OnFindMenuItemCommand);
            FindTicketCommand = new DelegateCommand<string>(OnFindTicketExecute, CanFindTicket);
            IncPageNumberCommand = new CaptionCommand<string>(Localization.Properties.Resources.NextPage + " >>", OnIncPageNumber, CanIncPageNumber);
            DecPageNumberCommand = new CaptionCommand<string>("<< " + Localization.Properties.Resources.PreviousPage, OnDecPageNumber, CanDecPageNumber);
            SubCategoryCommand = new CaptionCommand<ScreenSubCategoryButton>(".", OnSubCategoryCommand);

            EventServiceFactory.EventService.GetEvent<GenericEvent<Department>>().Subscribe(OnDepartmentChanged);
            EventServiceFactory.EventService.GetEvent<GenericEvent<EventAggregator>>().Subscribe(OnNumeratorReset);
            NumeratorValue = "";

            SubCategories = new ObservableCollection<ScreenSubCategoryButton>();
        }
        public PaymentEditorViewModel(IApplicationState applicationState, ICacheService cacheService, IExpressionService expressionService,
            TicketTotalsViewModel paymentTotals, PaymentEditor paymentEditor, NumberPadViewModel numberPadViewModel,
            OrderSelectorViewModel orderSelectorViewModel, ITicketService ticketService,
            ForeignCurrencyButtonsViewModel foreignCurrencyButtonsViewModel, PaymentButtonsViewModel paymentButtonsViewModel,
            CommandButtonsViewModel commandButtonsViewModel, TenderedValueViewModel tenderedValueViewModel,
            ReturningAmountViewModel returningAmountViewModel, ChangeTemplatesViewModel changeTemplatesViewModel, AccountBalances accountBalances)
        {
            _applicationState = applicationState;
            _cacheService = cacheService;
            _expressionService = expressionService;
            _paymentTotals = paymentTotals;
            _paymentEditor = paymentEditor;
            _numberPadViewModel = numberPadViewModel;
            _orderSelectorViewModel = orderSelectorViewModel;
            _ticketService = ticketService;
            _foreignCurrencyButtonsViewModel = foreignCurrencyButtonsViewModel;
            _commandButtonsViewModel = commandButtonsViewModel;
            _tenderedValueViewModel = tenderedValueViewModel;
            _returningAmountViewModel = returningAmountViewModel;
            _changeTemplatesViewModel = changeTemplatesViewModel;
            _accountBalances = accountBalances;

            _makePaymentCommand = new CaptionCommand<PaymentType>("", OnMakePayment, CanMakePayment);
            _selectChangePaymentTypeCommand = new CaptionCommand<PaymentData>("", OnSelectChangePaymentType);

            ClosePaymentScreenCommand = new CaptionCommand<string>(Resources.Close, OnClosePaymentScreen, CanClosePaymentScreen);
            paymentButtonsViewModel.SetButtonCommands(_makePaymentCommand, null, ClosePaymentScreenCommand);
        }
 public BatchDocumentCreatorViewModel(IAccountService accountService, ICacheService cacheService)
 {
     Accounts = new ObservableCollection<AccountRowViewModel>();
     _accountService = accountService;
     _cacheService = cacheService;
     CreateDocuments = new CaptionCommand<string>(string.Format(Resources.Create_f, "").Trim(), OnCreateDocuments, CanCreateDocument);
 }
Example #17
0
 /// <summary>
 /// Constructor
 /// </summary>
 public ActivityService(IBadgeService badgeService, ILoggingService loggingService, IMVCForumContext context, ICacheService cacheService)
 {
     _badgeService = badgeService;
     _loggingService = loggingService;
     _cacheService = cacheService;
     _context = context as MVCForumContext;
 }
Example #18
0
        public PosViewModel(IRegionManager regionManager, IApplicationState applicationState, IApplicationStateSetter applicationStateSetter,
            ITicketService ticketService, IUserService userService, ICacheService cacheService, TicketListViewModel ticketListViewModel,
            TicketTagListViewModel ticketTagListViewModel, MenuItemSelectorViewModel menuItemSelectorViewModel, MenuItemSelectorView menuItemSelectorView,
            TicketViewModel ticketViewModel, TicketOrdersViewModel ticketOrdersViewModel,TicketEntityListViewModel ticketEntityListViewModel)
        {
            _ticketService = ticketService;
            _userService = userService;
            _cacheService = cacheService;
            _applicationState = applicationState;
            _applicationStateSetter = applicationStateSetter;
            _regionManager = regionManager;
            _menuItemSelectorView = menuItemSelectorView;
            _ticketViewModel = ticketViewModel;
            _ticketOrdersViewModel = ticketOrdersViewModel;
            _menuItemSelectorViewModel = menuItemSelectorViewModel;
            _ticketListViewModel = ticketListViewModel;
            _ticketTagListViewModel = ticketTagListViewModel;
            _ticketEntityListViewModel = ticketEntityListViewModel;

            EventServiceFactory.EventService.GetEvent<GenericEvent<Ticket>>().Subscribe(OnTicketEventReceived);
            EventServiceFactory.EventService.GetEvent<GenericEvent<SelectedOrdersData>>().Subscribe(OnSelectedOrdersChanged);
            EventServiceFactory.EventService.GetEvent<GenericEvent<EventAggregator>>().Subscribe(OnTicketEvent);
            EventServiceFactory.EventService.GetEvent<GenericEvent<ScreenMenuItemData>>().Subscribe(OnMenuItemSelected);
            EventServiceFactory.EventService.GetEvent<GenericIdEvent>().Subscribe(OnTicketIdPublished);
            EventServiceFactory.EventService.GetEvent<GenericEvent<EntityOperationRequest<Entity>>>().Subscribe(OnEntitySelectedForTicket);
            EventServiceFactory.EventService.GetEvent<GenericEvent<TicketTagGroup>>().Subscribe(OnTicketTagSelected);
            EventServiceFactory.EventService.GetEvent<GenericEvent<TicketStateData>>().Subscribe(OnTicketStateSelected);
            EventServiceFactory.EventService.GetEvent<GenericEvent<Department>>().Subscribe(OnDepartmentChanged);
        }
Example #19
0
 public SnippetsController(ILoggingService loggingService, IUnitOfWorkManager unitOfWorkManager, IMembershipService membershipService, 
     ILocalizationService localizationService, IRoleService roleService, ISettingsService settingsService,
     IMembershipUserPointsService membershipUserPointsService, ICacheService cacheService)
     : base(loggingService, unitOfWorkManager, membershipService, localizationService, roleService, settingsService, cacheService)
 {
     _membershipUserPointsService = membershipUserPointsService;
 }
 public CategoriesController(
     ICacheService cacheService,
     ICategoriesService categoriesService)
 {
     this.categoriesService = categoriesService;
     this.Cache = cacheService;
 }
 public TicketEntityListViewModel(ICacheService cacheService)
 {
     _cacheService = cacheService;
     SelectionCommand = new DelegateCommand<Entity>(OnSelectEntity);
     CloseCommand = new CaptionCommand<string>(Resources.Close, OnClose);
     EntityList = new ObservableCollection<Entity>();
 }
Example #22
0
 public RecentsController(IPost postRepository, ISettings settingsRepository, ICacheService cacheService)
     : base(settingsRepository)
 {
     _postRepository = postRepository;
     _cacheService = cacheService;
     ExpectedMasterName = string.Empty;
 }
 public ReturningAmountViewModel(ICacheService cacheService, IApplicationState applicationState,
      PaymentEditor paymentEditor)
 {
     _cacheService = cacheService;
     _applicationState = applicationState;
     _paymentEditor = paymentEditor;
 }
        public TicketListerWidgetViewModel(Widget model, IApplicationState applicationState, ITicketServiceBase ticketService,
            IPrinterService printerService, ICacheService cacheService, IAutomationDao automationDao)
            : base(model, applicationState)
        {
            _applicationState = applicationState;
            _ticketService = ticketService;
            _printerService = printerService;
            _cacheService = cacheService;
            _automationDao = automationDao;
            ItemSelectionCommand = new DelegateCommand<TicketViewData>(OnItemSelection);

            EventServiceFactory.EventService.GetEvent<GenericEvent<Message>>().Subscribe(
            x =>
            {
                if (_applicationState.ActiveAppScreen == AppScreens.EntityView
                    && x.Topic == EventTopicNames.MessageReceivedEvent
                    && x.Value.Command == Messages.TicketRefreshMessage)
                {
                    Refresh();
                }
            });

            EventServiceFactory.EventService.GetEvent<GenericEvent<WidgetEventData>>().Subscribe(
            x =>
            {
                if (x.Value.WidgetName == Name)
                {
                    State = x.Value.Value;
                }
            });
        }
Example #25
0
 public TorznabController(IIndexerManagerService i, Logger l, IServerService s, ICacheService c)
 {
     indexerService = i;
     logger = l;
     serverService = s;
     cacheService = c;
 }
 public void Init()
 {
     this.cacheService = new HttpCacheService();
     this.productsService = ObjectFactory.GetProductService();
     this.articlesService = ObjectFactory.GetArticleService();
     this.controller = new HomeController(this.cacheService, this.productsService, this.articlesService);
 }
 public ReturningAmountViewModel(ICacheService cacheService, IAutomationService automationService,
      PaymentEditor paymentEditor)
 {
     _cacheService = cacheService;
     _automationService = automationService;
     _paymentEditor = paymentEditor;
 }
Example #28
0
 public ChangeTicketEntity(ITicketService ticketService, IApplicationState applicationState, ICacheService cacheService, IEntityService entityService)
 {
     _ticketService = ticketService;
     _applicationState = applicationState;
     _cacheService = cacheService;
     _entityService = entityService;
 }
Example #29
0
 public SubentroWCFService(IVersamentiCondominiService versamentiCondominiService, INotaPredefinitaService notaPredefinitaService, IPersonaService personaService, ICacheService cacheService)
 {
     _versamentiCondominiService = versamentiCondominiService;
     _notaPredefinitaService = notaPredefinitaService;
     _personaService = personaService;
     _cacheService = cacheService;
 }
 public AbstractHttpDataService(string baseUrl, string username, string password, ICacheService cacheService)
 {
   this.BaseUrl = baseUrl;
   this.UserName = username;
   this.Password = password;
   this.CacheService = cacheService;
 }
Example #31
0
 public MusicSearchEngine(ICurrentUser identity, IRequestServiceMain service, ILidarrApi lidarrApi, IMapper mapper,
                          ILogger <MusicSearchEngine> logger, IRuleEvaluator r, OmbiUserManager um, ICacheService mem, ISettingsService <OmbiSettings> s, IRepository <RequestSubscription> sub,
                          ISettingsService <LidarrSettings> lidarrSettings)
     : base(identity, service, r, um, mem, s, sub)
 {
     _lidarrApi      = lidarrApi;
     _lidarrSettings = lidarrSettings;
     Mapper          = mapper;
     Logger          = logger;
 }
Example #32
0
        public bool Merge(ILogService log,
                          IUnitOfWork db,
                          ICacheService cacheService,
                          DateTime?when,
                          long?by,
                          out IList <MessageString> messages)
        {
            messages = new List <MessageString>();

            if (String.IsNullOrEmpty(InputMainStyleId))
            {
                messages.Add(MessageString.Error("MainStyleId", "Empty main styleId"));
                return(false);
            }

            if (String.IsNullOrEmpty(InputSecondStyleId))
            {
                messages.Add(MessageString.Error("SecondStyleId", "Empty second styleId"));
                return(false);
            }

            var results   = new List <MessageString>();
            var styleTo   = db.Styles.GetAll().FirstOrDefault(s => s.StyleID == InputMainStyleId && !s.Deleted);
            var styleFrom = db.Styles.GetAll().FirstOrDefault(s => s.StyleID == InputSecondStyleId && !s.Deleted);

            if (styleTo == null)
            {
                messages.Add(MessageString.Error("MainStyleId", "Not found main style"));
                return(false);
            }

            if (styleFrom == null)
            {
                messages.Add(MessageString.Error("MainStyleId", "Not found second style"));
                return(false);
            }

            //Move/update styleItems
            var styleItemToList   = db.StyleItems.GetAll().Where(si => si.StyleId == styleTo.Id).ToList();
            var styleItemFromList = db.StyleItems.GetAll().Where(si => si.StyleId == styleFrom.Id).ToList();

            foreach (var toMoveItem in styleItemFromList)
            {
                var toMoveListings         = db.Items.GetAll().Where(i => i.StyleItemId == toMoveItem.Id).ToList();
                var toMoveOrderItems       = db.OrderItems.GetAll().Where(b => b.StyleItemId == toMoveItem.Id || b.SourceStyleItemId == toMoveItem.Id).ToList();
                var toMoveSourceOrderItems = db.OrderItemSources.GetAll().Where(b => b.StyleItemId == toMoveItem.Id).ToList();

                var existStyleItem = styleItemToList.FirstOrDefault(si => si.SizeId == toMoveItem.SizeId);
                if (existStyleItem == null)
                {
                    toMoveItem.StyleId = styleTo.Id;

                    foreach (var toMoveListing in toMoveListings)
                    {
                        toMoveListing.StyleId = styleTo.Id;
                    }

                    toMoveOrderItems.ForEach(i =>
                    {
                        if (i.StyleId == styleFrom.Id)
                        {
                            i.StyleId     = styleTo.Id;
                            i.StyleString = styleTo.StyleID;
                        }
                        log.Info("Moved orderItem=" + i.Id);
                    });
                    toMoveSourceOrderItems.ForEach(i =>
                    {
                        i.StyleId     = styleTo.Id;
                        i.StyleString = styleTo.StyleID;
                        log.Info("Moved source orderItem=" + i.Id);
                    });

                    log.Info("Moved whole styleItem=" + toMoveItem.Size);
                }
                else
                {
                    if (!existStyleItem.Weight.HasValue)
                    {
                        existStyleItem.Weight = toMoveItem.Weight;
                    }
                    if (!existStyleItem.MinPrice.HasValue)
                    {
                        existStyleItem.MinPrice = toMoveItem.MinPrice;
                    }
                    if (!existStyleItem.MaxPrice.HasValue)
                    {
                        existStyleItem.MaxPrice = toMoveItem.MaxPrice;
                    }

                    var toMoveBarcodes = db.StyleItemBarcodes.GetAll().Where(b => b.StyleItemId == toMoveItem.Id).ToList();
                    foreach (var toMoveBarcode in toMoveBarcodes)
                    {
                        toMoveBarcode.StyleItemId = existStyleItem.Id;
                        log.Info("Moved barcode=" + toMoveBarcode.Barcode);
                    }

                    var toMoveSpecialCases = db.QuantityChanges.GetAll().Where(b => b.StyleItemId == toMoveItem.Id).ToList();
                    foreach (var toMoveSpecialCase in toMoveSpecialCases)
                    {
                        toMoveSpecialCase.StyleItemId = existStyleItem.Id;
                        toMoveSpecialCase.StyleId     = existStyleItem.StyleId;
                        log.Info("Moved special case, id=" + toMoveSpecialCase.Id + ", quantity=" + toMoveSpecialCase.Quantity);
                    }

                    //Move/update listings
                    foreach (var toMoveListing in toMoveListings)
                    {
                        toMoveListing.StyleId     = existStyleItem.StyleId;
                        toMoveListing.StyleItemId = existStyleItem.Id;
                        log.Info("Moved listing, id=" + toMoveListing.Id);
                    }

                    toMoveOrderItems.ForEach(i =>
                    {
                        if (i.StyleId == styleFrom.Id)
                        {
                            i.StyleId     = styleTo.Id;
                            i.StyleString = styleTo.StyleID;
                        }
                        if (i.StyleItemId == toMoveItem.Id)
                        {
                            i.StyleItemId = existStyleItem.Id;
                        }
                        if (i.SourceStyleItemId == toMoveItem.Id)
                        {
                            i.SourceStyleItemId = existStyleItem.Id;
                        }
                        log.Info("Moved orderItem=" + i.Id);
                    });
                    toMoveSourceOrderItems.ForEach(i =>
                    {
                        i.StyleId     = styleTo.Id;
                        i.StyleString = styleTo.StyleID;
                        i.StyleItemId = existStyleItem.Id;
                        log.Info("Moved source orderItem=" + i.Id);
                    });

                    //Move/update box items
                    var toMoveOpenBoxItems = db.OpenBoxItems
                                             .GetAll()
                                             .Where(b => b.StyleItemId == toMoveItem.Id)
                                             .ToList();

                    var toMoveSealedBoxItems = db.SealedBoxItems
                                               .GetAll()
                                               .Where(b => b.StyleItemId == toMoveItem.Id)
                                               .ToList();

                    foreach (var openBoxItem in toMoveOpenBoxItems)
                    {
                        openBoxItem.StyleItemId = existStyleItem.Id;
                    }

                    foreach (var sealedBoxItem in toMoveSealedBoxItems)
                    {
                        sealedBoxItem.StyleItemId = existStyleItem.Id;
                    }
                }
            }
            db.Commit();

            //Move locations
            var style1Locations = db.StyleLocations.GetAll().Where(l => l.StyleId == styleTo.Id).ToList();
            var style2Locations = db.StyleLocations.GetAll().Where(l => l.StyleId == styleFrom.Id).ToList();

            var existDefaultLocation = style1Locations.Any(l => l.IsDefault);

            foreach (var toMoveLocation in style2Locations)
            {
                var existLocation = style1Locations.FirstOrDefault(l => l.Isle == toMoveLocation.Isle &&
                                                                   l.Section == toMoveLocation.Section &&
                                                                   l.Shelf == toMoveLocation.Shelf);
                if (existLocation == null)
                {
                    toMoveLocation.StyleId = styleTo.Id;
                    if (existDefaultLocation)
                    {
                        toMoveLocation.IsDefault = false;
                    }

                    log.Info(String.Format("Moved location, isle={0}, section={1}, shelf={2}, isDefault={3}",
                                           toMoveLocation.Isle,
                                           toMoveLocation.Section,
                                           toMoveLocation.Shelf,
                                           toMoveLocation.IsDefault));
                }
            }
            db.Commit();


            //Move/update features
            var style1Features = db.StyleFeatureValues.GetAll().Where(f => f.StyleId == styleTo.Id).ToList();
            var style2Features = db.StyleFeatureValues.GetAll().Where(f => f.StyleId == styleFrom.Id).ToList();

            foreach (var toMoveFeature in style2Features)
            {
                var existFeature = style1Features.FirstOrDefault(f => f.FeatureId == toMoveFeature.FeatureId);
                if (existFeature == null)
                {
                    toMoveFeature.StyleId = styleTo.Id;
                }
            }
            db.Commit();


            //Boxes
            var style2SealedBoxes = db.SealedBoxes.GetAll().Where(b => b.StyleId == styleFrom.Id).ToList();

            foreach (var toMoveSealedBox in style2SealedBoxes)
            {
                toMoveSealedBox.StyleId = styleTo.Id;
                log.Info("Moved sealed box=" + toMoveSealedBox.Id);
            }

            var style2OpenBoxes = db.OpenBoxes.GetAll().Where(b => b.StyleId == styleFrom.Id).ToList();

            foreach (var toMoveOpenBox in style2OpenBoxes)
            {
                toMoveOpenBox.StyleId = styleTo.Id;
                log.Info("Moved open box=" + toMoveOpenBox.Id);
            }
            db.Commit();


            //Update caches
            cacheService.RequestStyleIdUpdates(db,
                                               new List <long>()
            {
                styleTo.Id,
                styleFrom.Id
            },
                                               UpdateCacheMode.IncludeChild,
                                               by);

            //Delete style
            styleFrom.Deleted    = true;
            styleFrom.UpdateDate = when;
            styleFrom.UpdatedBy  = by;
            db.Commit();

            return(true);
        }
 internal Libraries(IListService listService, ICacheService cacheService)
 {
     this.listService  = listService;
     this.cacheService = cacheService;
 }
Example #34
0
 public ResultsController(IIndexerManagerService indexerManagerService, IServerService ss, ICacheService c, Logger logger)
 {
     IndexerService = indexerManagerService;
     serverService  = ss;
     cacheService   = c;
     this.logger    = logger;
 }
Example #35
0
 public ProductController(IProductService service, IProductSkuService skuService, ICacheService cacheService
                          , IProductCategoryService productCategoryService
                          )
 {
     this._service                = service;
     this._skuService             = skuService;
     this._cacheService           = cacheService;
     this._productCategoryService = productCategoryService;
 }
Example #36
0
 public SettingsEditNameViewModel(IMTProtoService protoService, ICacheService cacheService, ITelegramEventAggregator aggregator)
     : base(protoService, cacheService, aggregator)
 {
     SendCommand = new RelayCommand(SendExecute);
 }
 public LineMessageService(ICacheService cacheService)
 {
     _cacheService = cacheService;
 }
Example #38
0
 public JobController(IOmbiAutomaticUpdater updater, ICacheService mem)
 {
     _updater  = updater;
     _memCache = mem;
 }
Example #39
0
 public ChatCreateStep2ViewModel(IProtoService protoService, ICacheService cacheService, IEventAggregator aggregator)
     : base(protoService, cacheService, aggregator)
 {
     _maximum = ProtoService.GetOption <OptionValueInteger>("supergroup_size_max").Value;
 }
        public DefaultPageService(IRepository repository, IRedirectService redirectService, IUrlService urlService,
                                  ISecurityService securityService, IAccessControlService accessControlService, ICacheService cacheService)
        {
            this.repository           = repository;
            this.redirectService      = redirectService;
            this.urlService           = urlService;
            this.securityService      = securityService;
            this.accessControlService = accessControlService;
            this.cacheService         = cacheService;

            temporaryPageCache = new Dictionary <string, IPage>();
        }
 public TypeArgumentListAssociationUpsertService(ICacheService <TypeArgumentListAssociation> cache, TDbContext database, ILogger <UpsertService <TDbContext, TypeArgumentListAssociation> > logger)
     : base(cache, database, logger, database.TypeArgumentListAssociations)
 {
     CacheKey = record => $"{nameof(SourceCode)}.{nameof(TypeArgumentListAssociation)}={record.TypeArgumentId}:{record.TypeArgumentListId}";
 }
Example #42
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="showService">The show service</param>
        /// <param name="subtitlesService">The subtitles service</param>
        /// <param name="showTrailerService">The show trailer service</param>
        /// <param name="cacheService">The cache service</param>
        public ShowDetailsViewModel(IShowService showService, ISubtitlesService subtitlesService, IShowTrailerService showTrailerService, ICacheService cacheService)
        {
            _showTrailerService = showTrailerService;
            _showService        = showService;
            Show = new ShowJson();
            RegisterCommands();
            RegisterMessages();
            CancellationLoadingTrailerToken = new CancellationTokenSource();
            var downloadService = new DownloadShowService <EpisodeShowJson>(cacheService);

            DownloadShow = new DownloadShowViewModel(downloadService, subtitlesService, cacheService);
        }
Example #43
0
 public TransactionDocumentViewModel(IApplicationState applicationState, IInventoryService inventoryService, ICacheService cacheService)
 {
     _applicationState            = applicationState;
     _inventoryService            = inventoryService;
     _cacheService                = cacheService;
     AddTransactionItemCommand    = new CaptionCommand <string>(Resources.Add, OnAddTransactionItem, CanAddTransactionItem);
     DeleteTransactionItemCommand = new CaptionCommand <string>(Resources.Delete, OnDeleteTransactionItem, CanDeleteTransactionItem);
 }
Example #44
0
 public TypeArgumentListUpsertService(ICacheService <TypeArgumentList> cache, TDbContext database, ILogger <UpsertService <TDbContext, TypeArgumentList> > logger, IUpsertService <TDbContext, AsciiStringReference> strings)
     : base(cache, database, logger, database.TypeArgumentLists)
 {
     CacheKey = record => $"{nameof(TypeScript)}.{nameof(TypeArgumentList)}={record.ListIdentifierId}";
     _strings = strings ?? throw new ArgumentNullException(nameof(strings));
 }
Example #45
0
 public PaymentFormStep4ViewModel(IMTProtoService protoService, ICacheService cacheService, ITelegramEventAggregator aggregator)
     : base(protoService, cacheService, aggregator)
 {
 }
 public AuthorizationService(IHttpContextAccessor httpContextAccessor, ICacheService cacheService, IMedicalEditsService medicalEditsService)
 {
     _medicalEditsService = medicalEditsService;
     _httpContextAccessor = httpContextAccessor;
     _cacheService        = cacheService;
 }
Example #47
0
 public UserCreateViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator)
     : base(protoService, cacheService, settingsService, aggregator)
 {
     SendCommand = new RelayCommand(SendExecute, () => !string.IsNullOrEmpty(_firstName) && !string.IsNullOrEmpty(_phoneNumber));
 }
Example #48
0
 public BlogController(IBlogServices blogServices, ICacheService cacheService)
 {
     BlogServices = blogServices;
     CacheService = cacheService;
 }
 public ReportViewModel(IApiService apiService, ICacheService cacheService , IPlatformService platformService)
     : base(apiService, cacheService)
 {
     this.mPlatformService = platformService;
 }
 public ConstructorListUpsertService(ICacheService <ConstructorList> cache, TDbContext database, ILogger <UpsertService <TDbContext, ConstructorList> > logger, IUpsertService <TDbContext, AsciiStringReference> strings)
     : base(cache, database, logger, database.ConstructorLists)
 {
     CacheKey = record => $"{nameof(SourceCode)}.{nameof(Expression)}={record.ListIdentifierId}";
     _strings = strings ?? throw new ArgumentNullException(nameof(strings));
 }
Example #51
0
 /// <summary>
 /// 初始化一个<see cref="PackController"/>类型的新实例
 /// </summary>
 public PackController(ICacheService cacheService,
                       IFilterService filterService)
 {
     _cacheService  = cacheService;
     _filterService = filterService;
 }
Example #52
0
 public IndexerManagerService(IIndexerConfigurationService config, IProtectionService protectionService, WebClient webClient, Logger l, ICacheService cache, IProcessService processService, IConfigurationService globalConfigService, ServerConfig serverConfig)
 {
     configService            = config;
     this.protectionService   = protectionService;
     this.webClient           = webClient;
     this.processService      = processService;
     this.globalConfigService = globalConfigService;
     this.serverConfig        = serverConfig;
     logger       = l;
     cacheService = cache;
 }
Example #53
0
 public ServicesController(ILoggingService loggingService, IUnitOfWorkManager unitOfWorkManager, IMembershipService membershipService, ISettingsService settingsService, ICacheService cacheService, ILocalizationService localizationService)
     : base(loggingService, unitOfWorkManager, membershipService, settingsService, cacheService, localizationService)
 {
 }
Example #54
0
 public VoteController(ILoggingService loggingService, IMembershipService membershipService,
                       ILocalizationService localizationService, IRoleService roleService, IPostService postService,
                       IVoteService voteService, ISettingsService settingsService, ITopicService topicService,
                       IMembershipUserPointsService membershipUserPointsService, ICacheService cacheService,
                       IMvcForumContext context)
     : base(loggingService, membershipService, localizationService, roleService,
            settingsService, cacheService, context)
 {
     _postService  = postService;
     _voteService  = voteService;
     _topicService = topicService;
     _membershipUserPointsService = membershipUserPointsService;
 }
 public SettingsPasswordConfirmViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator)
     : base(protoService, cacheService, settingsService, aggregator)
 {
     ResendCommand = new RelayCommand(ResendExecute);
     SendCommand   = new RelayCommand(SendExecute);
 }
Example #56
0
 public PaymentFormStep3ViewModel(IMTProtoService protoService, ICacheService cacheService, ITelegramEventAggregator aggregator)
     : base(protoService, cacheService, aggregator)
 {
     SendCommand = new RelayCommand(SendExecute, () => !IsLoading);
 }
Example #57
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="context"> </param>
 /// <param name="cacheService"></param>
 public SettingsService(IMVCForumContext context, ICacheService cacheService)
 {
     _cacheService = cacheService;
     _context      = context as MVCForumContext;
 }
Example #58
0
 public CollectionService(IAlbumRepository albumRepository, IArtistRepository artistRepository, ITrackRepository trackRepository, IGenreRepository genreRepository, IFolderRepository folderRepository, ICacheService cacheService, IPlaybackService playbackService)
 {
     this.albumRepository  = albumRepository;
     this.artistRepository = artistRepository;
     this.trackRepository  = trackRepository;
     this.genreRepository  = genreRepository;
     this.folderRepository = folderRepository;
     this.cacheService     = cacheService;
     this.playbackService  = playbackService;
     this.markedFolders    = new List <Folder>();
 }
Example #59
0
 public CurrencyService(ICacheService cacheService, IExchangeClient exchangeClient)
 {
     _cacheService   = cacheService;
     _exchangeClient = exchangeClient;
 }
        protected SyncResult SyncAllNewOrders(CancellationToken?token,
                                              ILogService log,
                                              IMarketApi api,
                                              MarketType market,

                                              Func <ILogService, IMarketApi, ISyncInformer, string, IList <ListingOrderDTO> > getOrderItemsFromMarketFunc,

                                              ISyncInformer syncInfo,
                                              IList <IShipmentApi> rateProviders,
                                              IQuantityManager quantityManager,
                                              ISettingsService settings,
                                              IEmailService emailService,
                                              IOrderValidatorService validatorService,
                                              ICacheService cacheService,

                                              ICompanyAddressService companyAddress,
                                              DateTime syncMissedFrom,
                                              ITime time)
        {
            try
            {
                log.Info("Get missed orders, syncMissedFrom=" + syncMissedFrom);
                var statusList = new List <string> {
                    OrderStatusEnumEx.Canceled,
                    OrderStatusEnumEx.Shipped,
                    OrderStatusEnumEx.Unshipped,
                    OrderStatusEnumEx.Pending
                };                               //NOTE: On API level there status will be converted on eBay status
                var allOrders = api.GetOrders(log, syncMissedFrom, statusList).ToList();

                if (allOrders.Any())
                {
                    log.Info("Orders count=" + allOrders.Count);

                    var result = ProcessNewOrdersPack(token,
                                                      log,
                                                      api,

                                                      getOrderItemsFromMarketFunc,

                                                      rateProviders,
                                                      validatorService,
                                                      syncInfo,
                                                      settings,
                                                      quantityManager,
                                                      emailService,
                                                      cacheService,

                                                      companyAddress,
                                                      allOrders,
                                                      time);

                    if (!result.IsSuccess)
                    {
                        syncInfo.AddWarning("", "The orders pack processing has failed");
                        log.Info("The orders pack processing has failed");
                        return(new SyncResult()
                        {
                            IsSuccess = false
                        });
                    }

                    return(result);
                }

                return(new SyncResult()
                {
                    IsSuccess = true,
                    ProcessedOrders = new List <SyncResultOrderInfo>()
                });
            }
            catch (Exception ex)
            {
                syncInfo.AddError(null, "Error when storing new unshipped orders", ex);
                log.Error("Error when storing new unshipped orders", ex);
                return(new SyncResult()
                {
                    IsSuccess = false
                });
            }
        }