示例#1
0
 public SearchService(IServerApiService apiService, ServerCallback callback, INPerson person, IReadOnlyDictionary <int, INType> types)
 {
     callback.RegisterCallbackSearchListener(this);
     _apiService = apiService;
     _person     = person;
     _types      = types;
 }
 public DataBaseService(IStoredSettingsBase storedSettingsBase, IServerApiService serverApiService)
 {
     TryCreateTables();
     this.storedSettingsBase = storedSettingsBase;
     this.serverApiService   = serverApiService;
     roadListTask            = new TaskCompletionSource <IList <TollRoad> >();
 }
示例#3
0
        public async Task <List <OfferDetail> > GetOfferDetails()
        {
            if (_globalSettingsService.UseCache)
            {
                // get OfferDetails from cache if no internet
                if (Connectivity.NetworkAccess == NetworkAccess.None || Connectivity.NetworkAccess == NetworkAccess.ConstrainedInternet)
                {
                    return(Barrel.Current.Get <List <OfferDetail> >(key: _baseUrl));
                }


                // get OfferDetails from cache if cache is not expire
                if (!Barrel.Current.IsExpired(key: _baseUrl))
                {
                    return(Barrel.Current.Get <List <OfferDetail> >(key: _baseUrl));
                }
            }

            // get OfferDetails form api
            try
            {
                serverApiService = RestService.For <IServerApiService>(_baseUrl);
                var response = await serverApiService.GetJobInfo();

                Barrel.Current.Add(key: _baseUrl, data: response, expireIn: TimeSpan.FromMinutes(_globalSettingsService.CacheExpiry));
                return(response);
            }
            catch (Exception)
            {
                return(null);

                throw;
            }
        }
示例#4
0
        public RegistrationViewModel()
        {
            storedSettingsService = Mvx.Resolve <IStoredSettingsService>();
            serverApiService      = Mvx.Resolve <IServerApiService>();

            backToLoginViewCommand = new MvxCommand(() => { ShowViewModel <LoginViewModel>(); });
            registrationCommand    = new MvxCommand(() => ServerCommandWrapper(() => Registration()));
            validateCommand        = new MvxCommand(() => ComparePhoneCode());
        }
        public RegistrationViewModel(IStoredSettingsService storedSettingsService, IServerApiService serverApiService)
        {
            this.storedSettingsService = storedSettingsService;
            this.serverApiService      = serverApiService;

            backToLoginViewCommand = new MvxCommand(() => { ShowViewModel <LoginViewModel>(); });
            registrationCommand    = new MvxCommand(() => ServerCommandWrapperAsync(() => RegistrationAsync()));
            validateCommand        = new MvxCommand(() => ComparePhoneCodeAsync());
        }
示例#6
0
 internal static IEnumerable <INType> GetUserTypes(IServerApiService repository)
 {
     return(repository
            .GetTypes()
            .Where(x => x.Value.Kind == TypeKind.User &&
                   !x.Value.IsTaskType() &&
                   !x.Value.IsWorkflowStageType() &&
                   !x.Value.IsWorkflowType())
            .Select(x => x.Value));
 }
示例#7
0
 internal static IEnumerable <INType> GetUserTypes(IServerApiService repository)
 {
     return(repository
            .GetTypes()
            .Where(x => (x.Value.Kind == TypeKind.User &&
                         !x.Value.IsTaskType() &&
                         !x.Value.IsWorkflowStageType() &&
                         !x.Value.IsWorkflowType()) ||
                   x.Value.Name == SystemTypes.PROJECT_FILE ||
                   x.Value.Name == SystemTypes.PROJECT_FOLDER)
            .Select(x => x.Value));
 }
示例#8
0
        public static IQueryBuilder CreateFilesQueryBuilder(IServerApiService repository)
        {
            var userTypes = repository
                            .GetTypes()
                            .Where(x => x.Value.Kind == TypeKind.User)
                            .Select(x => x.Key)
                            .ToArray();

            var builder = new QueryBuilderImpl();

            builder.Must(ObjectFields.TypeId.BeAnyOf(userTypes));
            return(builder);
        }
示例#9
0
 public LoginViewModel(IStoredSettingsService storedSettingsService, IFacebookLoginService facebookLoginService, IGPlusLoginService gPlusLoginService,
                       IServerApiService serverApiService)
 {
     _storedSettingsService = storedSettingsService;
     _facebookLoginService  = facebookLoginService;
     _gPlusLoginService     = gPlusLoginService;
     _serverApiService      = serverApiService;
     _emailLoginCommand     = new MvxCommand(() => ServerCommandWrapperAsync(() => LoginTaskAsync(EmailLoginData)));
     _facebookLoginCommand  = new MvxCommand(() => ServerCommandWrapperAsync(async() => await LoginTaskAsync(await _facebookLoginService.GetPersonDataAsync())));
     _gPlusLoginCommand     = new MvxCommand(() => ServerCommandWrapperAsync(async() => await LoginTaskAsync(await _gPlusLoginService.GetPersonDataAsync())));
     _registrationCommand   = new MvxCommand(() => { ShowViewModel <RegistrationViewModel>(); });
     _forgotPasswordCommand = new MvxCommand(() => { });
 }
示例#10
0
 public GeoDataService(IDistanceChecker distanceChecker, IDataBaseService dataBaseStorage, IServerApiService serverApiService, IStoredSettingsService storedSettingsService)
 {
     try
     {
         _distanceChecker       = distanceChecker;
         _dataBaseStorage       = dataBaseStorage;
         _serverApiService      = serverApiService;
         _storedSettingsService = storedSettingsService;
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Message:{0}\n StackTrace:{1}", ex.Message, ex.StackTrace);
     }
 }
示例#11
0
        protected int[] GetPositions(IServerApiService repository, IEnumerable <int> personIds)
        {
            var positions = new List <int>();

            foreach (var personId in personIds)
            {
                var person = repository.GetPerson(personId);
                if (person != null)
                {
                    positions.AddRange(person.Positions);
                }
            }
            return(positions.ToArray());
        }
 public GeoDataService()
 {
     try
     {
         _distanceChecker       = Mvx.Resolve <IDistanceChecker>();
         _dataBaseStorage       = Mvx.Resolve <IDataBaseService>();
         _serverApiService      = Mvx.Resolve <IServerApiService>();
         _storedSettingsService = Mvx.Resolve <IStoredSettingsService>();
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Message:{0}\n StackTrace:{1}", ex.Message, ex.StackTrace);
     }
 }
示例#13
0
        public static IQueryBuilder CreateObjectQueryBuilder(IServerApiService repository, ObjectState[] objectStates)
        {
            var userTypes = repository
                            .GetTypes()
                            .Where(x => x.Value.Kind == TypeKind.User &&
                                   !x.Value.IsTaskType() &&
                                   !x.Value.IsWorkflowStageType() &&
                                   !x.Value.IsWorkflowType())
                            .Select(x => x.Value.Id)
                            .ToArray();

            var builder = new QueryBuilderImpl();

            builder.Must(ObjectFields.ObjectState.BeAnyOf(objectStates.ToArray()));
            builder.Must(ObjectFields.TypeId.BeAnyOf(userTypes));
            return(builder);
        }
示例#14
0
        public VehicleViewModel(IStoredSettingsService storedSettingsService, IServerApiService serverApiService, IUserInteraction userInteraction)
        {
            this.storedSettingsService = storedSettingsService;
            this.serverApiService      = serverApiService;
            this.userInteraction       = userInteraction;

            GoBakToVehicleListCommnad = new MvxCommand(() => ShowViewModel <VehiclesDataViewModel>());
            AddVehicleCommnad         = new MvxCommand(async() => await AddVehicleAsync());
            CancelAddingCommnad       = new MvxCommand(async() =>
            {
                var result = await userInteraction.ConfirmAsync("Are you sure you want to cancel?", "Warning", "Yes", "No");
                if (result)
                {
                    ShowViewModel <VehiclesDataViewModel>();
                }
            });
        }
示例#15
0
        public RemoteService(HttpPilotClient client)
        {
            _client = client;
            _client.SetConnectionLostListener(this);
            _serverCallback = new ServerCallback();
            _fileArchiveApi = client.GetFileArchiveApi();

            var searchFactory          = new SearchServiceFactory(_serverCallback);
            var localArchiveRootFolder = DirectoryProvider.GetTempPath();
            var fileStorageProvider    = new FileStorageProvider(localArchiveRootFolder);
            var changsetUploader       = new ChangesetUploader(_fileArchiveApi, fileStorageProvider, null);
            var messageApi             = client.GetMessagesApi(new NullableMessagesCallback());
            var serverApi = client.GetServerApi(_serverCallback);
            var dbInfo    = serverApi.OpenDatabase();
            var backend   = new Backend(serverApi, dbInfo, messageApi, changsetUploader);

            _serverApi = new ServerApiService(serverApi, dbInfo, searchFactory, backend);
            _serverCallback.RegisterCallbackListener((IRemoteServiceListener)_serverApi);
            IsActive = true;
        }
        public PayHistoryViewModel()
        {
            serverApiService      = Mvx.Resolve <IServerApiService>();
            storedSettingsService = Mvx.Resolve <IStoredSettingsService>();

            GetPayDateFrom = new DateTime(2016, 10, 5);
            GetPayDateTo   = DateTime.Now;

            backHomeCommand         = new MvxCommand(() => { ShowViewModel <HomeViewModel>(); });
            backToPayHistoryCommand = new MvxCommand(() => { ShowViewModel <PayHistoryViewModel>(); });

            openCalendarFromCommand = new MvxCommand(async() =>
            {
                GetPayDateFrom = await Mvx.Resolve <ICalendarDialog>().ShowDialog(GetPayDateFrom);
                await LoadHistory();
            });
            openCalendarToCommand = new MvxCommand(async() =>
            {
                GetPayDateTo = await Mvx.Resolve <ICalendarDialog>().ShowDialog(GetPayDateTo);
                await LoadHistory();
            });

            downloadHistoryCommand = new MvxCommand(() => ServerCommandWrapper(() => DownloadPdf()));
        }
 public InvariantCultureNextTaskSearchExpressionContext(IServerApiService context, ITaskTypesService taskTypesService)
     : base(context, taskTypesService)
 {
 }
示例#18
0
 public ProfileSettingService(IStoredSettingsService storedSettingsService, IServerApiService serverApiService)
 {
     this.storedSettingsService = storedSettingsService;
     this.serverApiService      = serverApiService;
 }
示例#19
0
        public SourcePObject(INObject source, INMetadata metadata, IReadOnlyDictionary <int, INPerson> people, IServerApiService serverApi) : base(source, metadata, people)
        {
            Title    = "Source files";
            Children = source.Dto.GetStorageChildren(serverApi).ToList();
            SourceId = source.Id;
            //Id = Guid.Empty;

            var type = metadata.Types.FirstOrDefault(t => t.Name == SystemTypes.PROJECT_FOLDER);

            Type = new PType(type);
        }
示例#20
0
 protected SearchExpressionContextBase(IServerApiService context)
 {
     _context = context;
 }
示例#21
0
 public static IQueryBuilder CreateObjectQueryBuilder(IServerApiService repository)
 {
     return(CreateObjectQueryBuilder(repository, new[] { ObjectState.Alive, ObjectState.Frozen }));
 }
示例#22
0
 public ISearchService GetSearchService(IServerApiService apiService, INPerson person, IReadOnlyDictionary <int, INType> types)
 {
     return(new SearchService(apiService, _callback, person, types));
 }
示例#23
0
 public ServerCommandCallService(IServerApiService serverApiService, string processorName = null)
 {
     _serverApiService = serverApiService;
     _commandName      = CommandNameParser.GetCommandName(typeof(T).Name, processorName);
 }
 public PaymentProcessing(IStoredSettingsService storedSettingsService, IServerApiService serverApiService)
 {
     this.storedSettingsService = storedSettingsService;
     this.serverApiService      = serverApiService;
 }
示例#25
0
 public IServerApiService GetApiService()
 {
     serverApiService = RestService.For <IServerApiService>(_baseUrl);
     return(serverApiService);
 }
示例#26
0
 public IXpsServiceApi GetExternalXpsServiceApi(IServerApiService serverApi)
 {
     return(new XpsServiceSafe(serverApi));
 }
        private void AddObjectsToArchive(IServerApiService apiService, IEnumerable<PObject> objects, ZipArchive archive, string currentPath, string actor)
        {
            var stack = new Stack<PObject>();
            foreach (var child in objects)
            {
                stack.Push(child);
            }

            while (stack.Any())
            {
                var pObject = stack.Pop();
                if (pObject.Children.Any())
                {
                    var childrenIds = pObject.Children.Select(c => c.ObjectId).ToArray();
                    var children = apiService.GetObjects(childrenIds);
                    foreach (var child in children)
                    {
                        stack.Push(child);
                    }
                }

                if (pObject.Type.HasFiles)
                {
                    INFile dFile = null;
                    string entryName;
                    if (pObject.Type.Name == SystemTypes.PROJECT_FILE)
                    {
                        dFile = pObject.ActualFileSnapshot.Files.FirstOrDefault(f => !FileExtensionHelper.IsSystemFile(f.Name));
                        if (dFile == null)
                            continue;

                        entryName = dFile.Name;
                    }
                    else
                    {
                        dFile = pObject.ActualFileSnapshot.Files.FirstOrDefault(f => FileExtensionHelper.IsXpsAlike(f.Name) || FileExtensionHelper.IsPdfAlike(f.Name));
                        if (dFile == null)
                            continue;

                        entryName = $"{pObject.Title}{Path.GetExtension(dFile.Name)}";
                    }

                    var fileBody = InternalDownloadFile(pObject, actor);
                    if (archive.Entries.Any(x => x.Name == entryName))
                        entryName += " Conflicted";

                    var zipEntry = archive.CreateEntry(Path.Combine(currentPath, entryName), CompressionLevel.NoCompression);

                    //Get the stream of the attachment
                    using (var originalFileStream = new MemoryStream(fileBody))
                    using (var zipEntryStream = zipEntry.Open())
                    {
                        //Copy the attachment stream to the zip entry stream
                        originalFileStream.CopyTo(zipEntryStream);
                    }
                }
                //else
                //{
                //    var directoryPath = Path.Combine(currentPath, dir.Title);
                //    if (archive.Entries.Any(x => x.Name == dir.Title))
                //        directoryPath += " Conflicted";

                //    var entry = archive.GetEntry(currentPath);
                //    entry?.Archive?.CreateEntry(directoryPath);
                //}
            }
        }
示例#28
0
 public XpsServiceSafe(IServerApiService serverApi)
 {
     _xpsServiceApi = serverApi.GetServerCommandProxy <IXpsServiceApi>(XpsServerConstants.XpsServiceName);
 }
 public SynchronisationService(IServerApiService serverApiService, IStoredSettingsService storedSettingsService, IPaymentProcessing paymentProcessing)
 {
     this.serverApiService      = serverApiService;
     this.storedSettingsService = storedSettingsService;
     this.paymentProcessing     = paymentProcessing;
 }
 public NextTaskSearchExpressionContext(IServerApiService context, ITaskTypesService taskTypesService) : base(context)
 {
     _taskTypesService = taskTypesService;
 }