Esempio n. 1
0
 private static void RefreshProviderActions()
 {
     foreach (var action in TypeCache.GetMethodsWithAttribute <SearchActionsProviderAttribute>()
              .Select(methodInfo => {
         try
         {
             return(methodInfo.Invoke(null, null) as IEnumerable <object>);
         }
         catch (Exception ex)
         {
             Debug.LogWarning($"Cannot load register Search Actions method: {methodInfo.Name} ({ex.Message})");
             return(null);
         }
     }).Where(actionArray => actionArray != null)
              .SelectMany(actionArray => actionArray)
              .Where(action => action != null).Cast <SearchAction>())
     {
         var provider = Providers.Find(p => p.id == action.providerId);
         if (provider == null)
         {
             continue;
         }
         provider.actions.Add(action);
     }
     SearchSettings.SortActionsPriority();
 }
        public static UInt160[] GetRegisteredProviders()
        {
            List <UInt160> ret           = new();
            Iterator       providersList = Providers.Find(FindOptions.RemovePrefix | FindOptions.KeysOnly);

            while (providersList.Next())
            {
                ret.Add((UInt160)providersList.Value);
            }
            return(ret);
        }
Esempio n. 3
0
        // VERIFICA LA EXISTENCIA DE UN PROVEEDOR

        public Boolean IsExistProvider(int dni)
        {
            var resultado = Providers.Find(p => p.DNI == dni);

            if (resultado == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Esempio n. 4
0
 private static void RefreshProviderActions()
 {
     foreach (var action in TypeCache.GetMethodsWithAttribute <SearchActionsProviderAttribute>()
              .SelectMany(methodInfo => methodInfo.Invoke(null, null) as IEnumerable <object>)
              .Where(a => a != null).Cast <SearchAction>())
     {
         var provider = Providers.Find(p => p.id == action.providerId);
         if (provider == null)
         {
             continue;
         }
         provider.actions.Add(action);
     }
     SearchSettings.SortActionsPriority();
 }
 internal static void RefreshProviders()
 {
     ActionIdToProviders = new Dictionary <string, List <string> >();
     foreach (var action in Utils.GetAllMethodsWithAttribute <SearchActionsProviderAttribute>()
              .SelectMany(methodInfo => methodInfo.Invoke(null, null) as IEnumerable <object>)
              .Where(a => a != null).Cast <SearchAction>())
     {
         var provider = Providers.Find(p => p.name.id == action.providerId);
         if (provider == null || !provider.active)
         {
             continue;
         }
         provider.actions.Add(action);
         if (!ActionIdToProviders.TryGetValue(action.Id, out var providerIds))
         {
             providerIds = new List <string>();
             ActionIdToProviders[action.Id] = providerIds;
         }
         providerIds.Add(provider.name.id);
     }
 }
        public OspDataDTO GetOspData(int userId, int ospId)
        {
            // Период получения документов в ОСА (30 дней).
            DateTime startPeriod = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day).AddDays(-30);
            DateTime endPeriod   = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
            // Получить общие списки.
            ICollection <AccessDTO>    allAccesses = Accesses.GetAll();
            ICollection <UserDTO>      allUsers    = Users.GetAll();
            ICollection <CartridgeDTO> allCarts    = Cartridges.GetAll();
            ICollection <PrinterDTO>   allPrints   = Printers.GetAll();
            ICollection <OspDTO>       allOsps     = Osps.GetAll();
            // Получить данные по ОСП.
            ICollection <BalanceDTO>  balances     = Balance.Find(x => x.Osp.Id == ospId);
            ICollection <EmailDTO>    emails       = Emails.Find(x => x.Osp.Id == ospId);
            ICollection <ProviderDTO> providers    = Providers.Find(x => x.Osp.Id == ospId);
            ICollection <ReceiptDTO>  receipts     = Receipts.Find(u => u.Osp.Id == ospId && u.Date >= startPeriod && u.Date <= endPeriod);
            ICollection <ExpenseDTO>  expenses     = Expenses.Find(u => u.Osp.Id == ospId && u.Date >= startPeriod && u.Date <= endPeriod);
            ICollection <ExpenseDTO>  userExpenses = Expenses.Find(u => u.User.Id == userId && u.Osp.Id == ospId && u.Date >= startPeriod && u.Date <= endPeriod);
            // Создать объект данных для пользователя.
            var userDataDTO = new OspDataDTO()
            {
                Accesses     = new ObservableCollection <AccessDTO>(allAccesses),
                Osps         = new ObservableCollection <OspDTO>(allOsps),
                Cartridges   = new ObservableCollection <CartridgeDTO>(allCarts),
                Printers     = new ObservableCollection <PrinterDTO>(allPrints),
                Balance      = new ObservableCollection <BalanceDTO>(balances),
                Expenses     = new ObservableCollection <ExpenseDTO>(expenses),
                UserExpenses = new ObservableCollection <ExpenseDTO>(userExpenses),
                Providers    = new ObservableCollection <ProviderDTO>(providers),
                Receipts     = new ObservableCollection <ReceiptDTO>(receipts),
                Emails       = new ObservableCollection <EmailDTO>(emails),
                Users        = new ObservableCollection <UserDTO>(allUsers)
            };

            return(userDataDTO);
        }
Esempio n. 7
0
        //BUSCA UN PROVEEDOR POR SU DNI Y LO RETORNA

        public Provider GetProvider(int dni)
        {
            var resultado = Providers.Find(p => p.DNI == dni);

            return(resultado);
        }
Esempio n. 8
0
 /// <summary>
 /// Returns the data of a search provider given its ID.
 /// </summary>
 /// <param name="providerId">Unique ID of the provider</param>
 /// <returns>The matching provider</returns>
 public static SearchProvider GetProvider(string providerId)
 {
     return(Providers.Find(p => p.name.id == providerId));
 }