Esempio n. 1
0
        private async Task SetAsWorkstationAccountAsync()
        {
            try
            {
                await EmployeeService.SetAsPrimaryAccountAsync(Account.Employee.Id, Account.Id);

                var employee = await EmployeeService.GetEmployeeByIdAsync(Account.Employee.Id);

                RemoteDeviceConnectionsService.StartUpdateHardwareVaultAccounts(await EmployeeService.GetEmployeeVaultIdsAsync(employee.Id));
                await Refresh.InvokeAsync(this);

                await ToastService.ShowToastAsync("Account setted as primary.", ToastType.Success);

                await SynchronizationService.UpdateEmployeeDetails(ExceptPageId, Account.EmployeeId);

                await ModalDialogService.CloseAsync();
            }
            catch (Exception ex)
            {
                await ModalDialogService.CloseAsync();

                Logger.LogError(ex.Message, ex);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);
            }
        }
        private async Task CreateAccountAsync()
        {
            try
            {
                await ButtonSpinner.SpinAsync(async() =>
                {
                    await SharedAccountService.CreateSharedAccountAsync(SharedAccount);
                    await ToastService.ShowToastAsync("Account created.", ToastType.Success);
                    await SynchronizationService.UpdateSharedAccounts(ExceptPageId);
                    await ModalDialogService.CloseAsync();
                });
            }
            catch (AlreadyExistException ex)
            {
                ValidationErrorMessage.DisplayError(nameof(SharedAccount.Name), ex.Message);
            }
            catch (IncorrectUrlException ex)
            {
                ValidationErrorMessage.DisplayError(nameof(SharedAccount.Urls), ex.Message);
            }
            catch (IncorrectOtpException ex)
            {
                ValidationErrorMessage.DisplayError(nameof(SharedAccount.OtpSecret), ex.Message);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CloseAsync();
            }
        }
Esempio n. 3
0
        public static async Task Main(string[] args)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
            var configuration = builder.Build();

            var sw = new Stopwatch();

            sw.Start();

            using (var mservice = new MongoRepository <Token>())
            {
                var tokens = mservice.GetAllAsync().Result;
                foreach (var token in tokens)
                {
                    if (string.IsNullOrEmpty(token.CmcName))
                    {
                        continue;
                    }
                    Console.WriteLine($"Getting the current price for token {token.Symbol}.");
                    try
                    {
                        Pricing.PriceService.GetPriceLastAsync(token.CmcName, token.Symbol).Wait();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine($"Error while getting the current price for token {token.Symbol}. {ex.Message}");
                    }
                }
                Console.WriteLine($"Getting current the current price for the main currency.");
                try
                {
                    Pricing.PriceService.GetPriceLastAsync(configuration["AppSettings:MainCurrencyName"].ToLower(), configuration["AppSettings:MainCurrencySymbol"]).Wait();
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"Error while getting the current price for the main currency. {ex.Message}");
                }
            }

            try
            {
                var synchronizationService = new SynchronizationService();
                await synchronizationService.GetNewBlockSyncRequests();
                await ProcessPendingBlockSyncRequests();

                await synchronizationService.SyncPendingTransactionReceipts();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                sw.Stop();
            }

            Console.WriteLine($"Finished in {sw.ElapsedMilliseconds} ms.");
        }
Esempio n. 4
0
 public ScheduleViewModel(SynchronizationService synchronizationService, Attendee attendee, ImageCache imageCache, SearchModel searchModel)
 {
     _synchronizationService = synchronizationService;
     _attendee = attendee;
     _imageCache = imageCache;
     _searchModel = searchModel;
 }
Esempio n. 5
0
 public ScheduleViewModel(SynchronizationService synchronizationService, Attendee attendee, ImageCache imageCache, SearchModel searchModel)
 {
     _synchronizationService = synchronizationService;
     _attendee    = attendee;
     _imageCache  = imageCache;
     _searchModel = searchModel;
 }
        private async Task AddSharedAccoountAsync()
        {
            try
            {
                var account = await EmployeeService.AddSharedAccountAsync(EmployeeId, SelectedSharedAccount.Id);

                var employee = await EmployeeService.GetEmployeeByIdAsync(account.EmployeeId);

                RemoteDeviceConnectionsService.StartUpdateHardwareVaultAccounts(employee.HardwareVaults.Select(x => x.Id).ToArray());
                await Refresh.InvokeAsync(this);

                await ToastService.ShowToastAsync("Account added and will be recorded when the device is connected to the server.", ToastType.Success);

                await SynchronizationService.UpdateEmployeeDetails(ExceptPageId, EmployeeId);

                await ModalDialogService.CloseAsync();
            }
            catch (Exception ex)
            {
                await ModalDialogService.CloseAsync();

                Logger.LogError(ex.Message, ex);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);
            }
        }
Esempio n. 7
0
        private async Task EditAccoountOtpAsync()
        {
            try
            {
                await ButtonSpinner.SpinAsync(async() =>
                {
                    var vaults = await SharedAccountService.EditSharedAccountOtpAsync(Account, AccountOtp);
                    RemoteDeviceConnectionsService.StartUpdateHardwareVaultAccounts(vaults);
                    await SynchronizationService.UpdateSharedAccounts(ExceptPageId);
                    await ToastService.ShowToastAsync("Account OTP updated.", ToastType.Success);
                    await ModalDialogService.CloseAsync();
                });
            }
            catch (IncorrectOtpException ex)
            {
                ValidationErrorMessage.DisplayError(nameof(SharedAccount.OtpSecret), ex.Message);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CancelAsync();
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Creates the instance.
        /// </summary>
        /// <param name="appSetting">The app setting.</param>
        /// <param name="oItemType">Type of the o item.</param>
        /// <returns></returns>
        public static RemoteProviderProxy CreateInstance(syncAppSetting appSetting, Outlook.OlItemType oItemType)
        {
            RemoteProviderProxy retVal = null;
            NetworkCredential cred = new NetworkCredential();
            cred.UserName = appSetting.ibnPortalLogin;
            cred.Password = appSetting.ibnPortalPassword;
            SynchronizationService syncService = new SynchronizationService();
            //enable session
            syncService.CookieContainer = new System.Net.CookieContainer();

            string syncServiceUrl = appSetting.ibnPortalUrl;
            if (!syncServiceUrl.Contains(OutlookAddin.Resources.System_IbnSyncWebServicePath))
            {
                Uri url = new Uri(syncServiceUrl);
                UriBuilder uriBuilder = new UriBuilder();
                uriBuilder.Scheme = Uri.UriSchemeHttp;
                uriBuilder.Port = url.Port;
                uriBuilder.Host = url.Host;
                uriBuilder.Path = url.AbsolutePath + OutlookAddin.Resources.System_IbnSyncWebServicePath;
                syncServiceUrl = uriBuilder.ToString();
            }

            syncService.Url = syncServiceUrl;
            //Authentificate
            syncService.SetCredentials(cred);
            //Set sync provider
            syncService.SetProviderTypeForSyncSession((OutlookAddin.SyncService.eSyncProviderType)oItemType);
            retVal = new RemoteProviderProxy(syncService);

            return retVal;
        }
        private async Task EditAccountPasswordAsync()
        {
            try
            {
                await ButtonSpinner.SpinAsync(async() =>
                {
                    using (TransactionScope transactionScope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
                    {
                        await EmployeeService.EditPersonalAccountPwdAsync(Account, _accountPassword);

                        if (_accountPassword.UpdateActiveDirectoryPassword)
                        {
                            await LdapService.SetUserPasswordAsync(Account.EmployeeId, _accountPassword.Password, LdapSettings);
                        }

                        transactionScope.Complete();
                    }

                    RemoteDeviceConnectionsService.StartUpdateHardwareVaultAccounts(await EmployeeService.GetEmployeeVaultIdsAsync(Account.EmployeeId));
                    await ToastService.ShowToastAsync("Account password updated.", ToastType.Success);
                    await SynchronizationService.UpdateEmployeeDetails(ExceptPageId, Account.EmployeeId);
                    await ModalDialogService.CloseAsync();
                });
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CloseAsync();
            }
        }
Esempio n. 10
0
        private async Task OpenDialogAddSharedAccountAsync()
        {
            if (!await VerifyAdUserAsync())
            {
                return;
            }

            RenderFragment body = (builder) =>
            {
                builder.OpenComponent(0, typeof(AddSharedAccount));
                builder.AddAttribute(1, nameof(AddSharedAccount.EmployeeId), EmployeeId);
                builder.CloseComponent();
            };

            var instance = await ModalDialogService.ShowAsync("Add shared account", body, ModalDialogSize.Large);

            var result = await instance.Result;

            if (result.Succeeded)
            {
                await LoadEmployeeAsync();

                await DataTableService.LoadTableDataAsync();

                await SynchronizationService.UpdateEmployeeDetails(PageId, EmployeeId);
            }
        }
Esempio n. 11
0
        private async Task InviteAdminAsync()
        {
            try
            {
                await ButtonSpinner.SpinAsync(async() =>
                {
                    var callBakcUrl = await ApplicationUserService.InviteAdministratorAsync(Invitation.Email, NavigationManager.BaseUri);
                    await EmailSenderService.SendUserInvitationAsync(Invitation.Email, callBakcUrl);
                    await ToastService.ShowToastAsync("Administrator invited.", ToastType.Success);
                    await SynchronizationService.UpdateAdministrators(ExceptPageId);
                    await ModalDialogService.CloseAsync();
                });
            }
            catch (AlreadyExistException ex)
            {
                ValidationErrorMessage.DisplayError(nameof(Invitation.Email), ex.Message);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CancelAsync();
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Creates the instance.
        /// </summary>
        /// <param name="appSetting">The app setting.</param>
        /// <param name="oItemType">Type of the o item.</param>
        /// <returns></returns>
        public static RemoteProviderProxy CreateInstance(syncAppSetting appSetting, Outlook.OlItemType oItemType)
        {
            RemoteProviderProxy retVal = null;
            NetworkCredential   cred   = new NetworkCredential();

            cred.UserName = appSetting.ibnPortalLogin;
            cred.Password = appSetting.ibnPortalPassword;
            SynchronizationService syncService = new SynchronizationService();

            //enable session
            syncService.CookieContainer = new System.Net.CookieContainer();

            string syncServiceUrl = appSetting.ibnPortalUrl;

            if (!syncServiceUrl.Contains(OutlookAddin.Resources.System_IbnSyncWebServicePath))
            {
                Uri        url        = new Uri(syncServiceUrl);
                UriBuilder uriBuilder = new UriBuilder();
                uriBuilder.Scheme = Uri.UriSchemeHttp;
                uriBuilder.Port   = url.Port;
                uriBuilder.Host   = url.Host;
                uriBuilder.Path   = url.AbsolutePath + OutlookAddin.Resources.System_IbnSyncWebServicePath;
                syncServiceUrl    = uriBuilder.ToString();
            }

            syncService.Url = syncServiceUrl;
            //Authentificate
            syncService.SetCredentials(cred);
            //Set sync provider
            syncService.SetProviderTypeForSyncSession((OutlookAddin.SyncService.eSyncProviderType)oItemType);
            retVal = new RemoteProviderProxy(syncService);


            return(retVal);
        }
Esempio n. 13
0
        public static string GetSyncServiceIcon(SynchronizationService service, string serverInfo = null)
        {
            switch (service)
            {
            case SynchronizationService.None:
                return(string.Empty);

            case SynchronizationService.ToodleDo:
                return(syncToodleDoIconUri.ToString());

            case SynchronizationService.Exchange:
            case SynchronizationService.ExchangeEws:
                if (!string.IsNullOrEmpty(serverInfo) && serverInfo.ToLower().Contains("office365"))
                {
                    return(syncOffice365IconUri.ToString());
                }
                else
                {
                    return(syncExchangeIconUri.ToString());
                }

            case SynchronizationService.OutlookActiveSync:
                return(syncOutlookIconUri.ToString());

            case SynchronizationService.ActiveSync:
                return(syncActiveSyncIconUri.ToString());

            case SynchronizationService.Vercors:
                return(syncVercorsIconUri.ToString());

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 14
0
 public MainViewModel(Community community, NavigationModel navigationModel, NewEntryModel newEntry, SynchronizationService synhronizationService)
 {
     _community = community;
     _navigationModel = navigationModel;
     _newEntry = newEntry;
     _synhronizationService = synhronizationService;
 }
Esempio n. 15
0
        private async Task AddAsync()
        {
            try
            {
                if (!Groups.Any(x => x.Checked))
                {
                    WarningMessage = "Please select at least one group.";
                    return;
                }

                await LdapService.AddGroupsAsync(Groups.Where(x => x.Checked).ToList(), CreateEmployees);

                await ToastService.ShowToastAsync("Groups added.", ToastType.Success);

                await SynchronizationService.UpdateGroups(ExceptPageId);

                await ModalDialogService.CloseAsync();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CancelAsync();
            }
        }
Esempio n. 16
0
        private async Task SaveSettingsAsync()
        {
            try
            {
                var isValid = LdapSettingsContext.Validate();

                if (!isValid)
                {
                    return;
                }

                await LdapService.ValidateCredentialsAsync(LdapSettings);

                await AppSettingsService.SetLdapSettingsAsync(LdapSettings);

                await ToastService.ShowToastAsync("Domain settings updated.", ToastType.Success);

                await SynchronizationService.UpdateParameters(ExceptPageId);

                await ModalDialogService.CloseAsync();
            }
            catch (LdapForNet.LdapInvalidCredentialsException)
            {
                ValidationErrorMessage.DisplayError(nameof(LdapSettings.Password), "Invalid password");
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CloseAsync();
            }
        }
Esempio n. 17
0
        private async Task DeleteAdminAsync()
        {
            if (DataTableService.Entities.Count == 1)
            {
                return;
            }

            RenderFragment body = (builder) =>
            {
                builder.OpenComponent(0, typeof(DeleteAdministrator));
                builder.AddAttribute(1, nameof(DeleteAdministrator.ApplicationUserId), DataTableService.SelectedEntity.Id);
                builder.CloseComponent();
            };

            var instance = await ModalDialogService.ShowAsync("Delete Administrator", body, ModalDialogSize.Default);

            var result = await instance.Result;

            if (result.Succeeded)
            {
                await DataTableService.LoadTableDataAsync();

                await SynchronizationService.UpdateAdministrators(PageId);
            }
        }
Esempio n. 18
0
        private async Task OpenModalDisableSsoAsync()
        {
            if (!await VerifyAdUserAsync())
            {
                return;
            }

            RenderFragment body = (builder) =>
            {
                builder.OpenComponent(0, typeof(EmployeeDisableSso));
                builder.AddAttribute(1, nameof(EmployeeDisableSso.Employee), Employee);
                builder.CloseComponent();
            };

            var instance = await ModalDialogService.ShowAsync("Disable SSO", body);

            var result = await instance.Result;

            if (result.Succeeded)
            {
                await LoadEmployeeSsoState();

                await SynchronizationService.UpdateEmployeeDetails(PageId, EmployeeId);
            }
        }
Esempio n. 19
0
        public MainViewModel(Community community, SynchronizationService synhronizationService, NewGameSelectionModel newGameSelection)
        {
            _community             = community;
            _synhronizationService = synhronizationService;

            _newGame = new NewGameViewModel(synhronizationService.Domain, newGameSelection);
        }
Esempio n. 20
0
        public async Task AddAsync()
        {
            try
            {
                if (!Employees.Any(x => x.Value == true))
                {
                    _notSelected = true;
                    return;
                }

                var employeeIds = Employees.Where(x => x.Value).Select(x => x.Key.Id).ToList();

                await GroupService.AddEmployeesToGroupAsync(employeeIds, GroupId);

                await ToastService.ShowToastAsync("Employee added.", ToastType.Success);

                await SynchronizationService.UpdateGroupDetails(ExceptPageId, GroupId);

                await ModalDialogService.CloseAsync();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CloseAsync();
            }
        }
Esempio n. 21
0
        private async Task DisableAlarmAsync()
        {
            try
            {
                var checkPassword = await UserManager.CheckPasswordAsync(ApplicationUser, UserConfirmPassword);

                if (!checkPassword)
                {
                    throw new Exception("Invalid password");
                }

                await RemoteWorkstationConnections.UnlockAllWorkstationsAsync(ApplicationUser.Email);

                await SynchronizationService.UpdateAlarm(ExceptPageId);

                await CallBack.InvokeAsync(this);

                await ToastService.ShowToastAsync("All workstations are unlocked.", ToastType.Success);

                await ModalDialogService.CloseAsync();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message, ex);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CancelAsync();
            }
        }
        private void OpenProviderSettings(SynchronizationService synchronizationService, string parameter = null)
        {
            if (synchronizationService == SynchronizationService.None)
            {
                return;
            }

            switch (synchronizationService)
            {
            case SynchronizationService.ToodleDo:
                this.NavigationService.FlyoutTo(ViewLocator.SyncToodleDoSettingsPage, parameter);
                break;

            case SynchronizationService.Exchange:
            case SynchronizationService.ExchangeEws:
                this.NavigationService.FlyoutTo(ViewLocator.SyncExchangeSettingsPage, parameter);
                break;

            case SynchronizationService.OutlookActiveSync:
                this.NavigationService.FlyoutTo(ViewLocator.SyncOutlookActiveSyncSettingsPage, parameter);
                break;

            case SynchronizationService.ActiveSync:
                this.NavigationService.FlyoutTo(ViewLocator.SyncActiveSyncSettingsPage, parameter);
                break;

            case SynchronizationService.Vercors:
                this.NavigationService.FlyoutTo(ViewLocator.SyncVercorsSettingsPage, parameter);
                break;

            default:
                throw new ArgumentOutOfRangeException("synchronizationService");
            }
        }
Esempio n. 23
0
        private async Task AddVaultAsync()
        {
            try
            {
                if (SelectedHardwareVault == null)
                {
                    WarningMessage = "Please, select a vault.";
                    return;
                }

                await WorkstationService.AddProximityVaultAsync(WorkstationId, SelectedHardwareVault.Id);

                await RemoteWorkstationConnectionsService.UpdateProximitySettingsAsync(WorkstationId, await WorkstationService.GetProximitySettingsAsync(WorkstationId));

                await ToastService.ShowToastAsync("Vault added", ToastType.Success);

                await SynchronizationService.UpdateWorkstationDetails(ExceptPageId, WorkstationId);

                await ModalDialogService.CloseAsync();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message, ex);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CancelAsync();
            }
        }
Esempio n. 24
0
        public MainViewModel(Community community, SynchronizationService synhronizationService, NewGameSelectionModel newGameSelection)
        {
            _community = community;
            _synhronizationService = synhronizationService;

            _newGame = new NewGameViewModel(synhronizationService.Domain, newGameSelection);
        }
        private async Task CreateAccountAsync()
        {
            try
            {
                await ButtonSpinner.SpinAsync(async() =>
                {
                    await EmployeeService.CreatePersonalAccountAsync(PersonalAccount);
                    RemoteDeviceConnectionsService.StartUpdateHardwareVaultAccounts(await EmployeeService.GetEmployeeVaultIdsAsync(EmployeeId));
                    await Refresh.InvokeAsync(this);
                    await ToastService.ShowToastAsync("Account created.", ToastType.Success);
                    await SynchronizationService.UpdateEmployeeDetails(ExceptPageId, EmployeeId);
                    await ModalDialogService.CloseAsync();
                });
            }
            catch (AlreadyExistException ex)
            {
                ValidationErrorMessage.DisplayError(nameof(PersonalAccount.Name), ex.Message);
            }
            catch (IncorrectUrlException ex)
            {
                ValidationErrorMessage.DisplayError(nameof(PersonalAccount.Urls), ex.Message);
            }
            catch (IncorrectOtpException ex)
            {
                ValidationErrorMessage.DisplayError(nameof(PersonalAccount.OtpSecret), ex.Message);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CancelAsync();
            }
        }
        private async Task EditAccountOtpAsync()
        {
            try
            {
                await ButtonSpinner.SpinAsync(async() =>
                {
                    await EmployeeService.EditPersonalAccountOtpAsync(Account, _accountOtp);
                    RemoteDeviceConnectionsService.StartUpdateHardwareVaultAccounts(await EmployeeService.GetEmployeeVaultIdsAsync(Account.EmployeeId));
                    await ToastService.ShowToastAsync("Account OTP updated.", ToastType.Success);
                    await SynchronizationService.UpdateEmployeeDetails(ExceptPageId, Account.EmployeeId);
                    await ModalDialogService.CloseAsync();
                });
            }
            catch (IncorrectOtpException ex)
            {
                ValidationErrorMessage.DisplayError(nameof(AccountOtp.OtpSecret), ex.Message);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CloseAsync();
            }
        }
Esempio n. 27
0
        private async Task OpenDialogRemoveHardwareVaultAsync(HardwareVault hardwareVault)
        {
            if (!await VerifyAdUserAsync())
            {
                return;
            }

            RenderFragment body = (builder) =>
            {
                builder.OpenComponent(0, typeof(DeleteHardwareVault));
                builder.AddAttribute(1, nameof(DeleteHardwareVault.HardwareVaultId), hardwareVault.Id);
                builder.CloseComponent();
            };

            var instance = await ModalDialogService.ShowAsync("Delete hardware vault", body);

            var result = await instance.Result;

            if (result.Succeeded)
            {
                await LoadEmployeeAsync();

                await SynchronizationService.UpdateEmployeeDetails(PageId, EmployeeId);
            }
        }
Esempio n. 28
0
        private async Task EditAsync()
        {
            try
            {
                await ButtonSpinner.SpinAsync(async() =>
                {
                    await OrgStructureService.EditDepartmentAsync(Department);
                    await ToastService.ShowToastAsync("Department updated.", ToastType.Success);
                    await Refresh.InvokeAsync(this);
                    await SynchronizationService.UpdateOrgSructureCompanies(ExceptPageId);
                    await ModalDialogService.CloseAsync();
                });
            }
            catch (AlreadyExistException ex)
            {
                ValidationErrorMessage.DisplayError(nameof(Department.Name), ex.Message);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CloseAsync();
            }
        }
Esempio n. 29
0
        private async Task OpenDialogDeleteAccountAsync()
        {
            if (!await VerifyAdUserAsync())
            {
                return;
            }

            RenderFragment body = (builder) =>
            {
                builder.OpenComponent(0, typeof(DeleteAccount));
                builder.AddAttribute(1, nameof(DeleteAccount.AccountId), DataTableService.SelectedEntity.Id);
                builder.CloseComponent();
            };

            var instance = await ModalDialogService.ShowAsync("Delete Account", body);

            var result = await instance.Result;

            if (result.Succeeded)
            {
                await DataTableService.LoadTableDataAsync();

                await SynchronizationService.UpdateEmployeeDetails(PageId, EmployeeId);
            }
        }
Esempio n. 30
0
        public async Task DeleteVaultAsync()
        {
            try
            {
                var employeeId = HardwareVault.EmployeeId;
                await EmployeeService.RemoveHardwareVaultAsync(HardwareVault.Id, Reason, IsNeedBackup);

                await Refresh.InvokeAsync(this);

                RemoteDeviceConnectionsService.StartUpdateHardwareVaultStatus(HardwareVault.Id);
                await SynchronizationService.UpdateEmployeeDetails(ExceptPageId, employeeId);

                await SynchronizationService.HardwareVaultStateChanged(HardwareVault.Id);

                await ToastService.ShowToastAsync("Vault removed.", ToastType.Success);

                await ModalDialogService.CloseAsync();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message, ex);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CancelAsync();
            }
        }
Esempio n. 31
0
 public ViewModelLocator()
 {
     _synchronizationService = new SynchronizationService();
     if (DesignMode)
         _synchronizationService.Initialize();
     else
         _synchronizationService.InitializeDesignMode();
 }
 public ViewModelLocator()
 {
     NavigationModel navigationModel = new NavigationModel();
     _synchronizationService = new SynchronizationService(navigationModel);
     if (!DesignerProperties.IsInDesignTool)
         _synchronizationService.Initialize();
     _main = new MainViewModel(_synchronizationService.Community, navigationModel, _synchronizationService);
 }
 public SynchronizationPageViewModel()
 {
     _syncService     = SynchronizationService.GetInstance();
     StartSyncCommand = new DelegateCommand(async() =>
     {
         await _syncService.StartSyncProcess();
     });
 }
Esempio n. 34
0
 public ViewModelLocator()
 {
     _synchronizationService = new SynchronizationService();
     if (!Windows.ApplicationModel.DesignMode.DesignModeEnabled)
     {
         _synchronizationService.Initialize();
     }
 }
Esempio n. 35
0
 public MainViewModel(Attendee attendee, SynchronizationService synhronizationService, ImageCache imageCache, SearchModel searchModel, Clock clock)
 {
     _attendee = attendee;
     _synhronizationService = synhronizationService;
     _imageCache            = imageCache;
     _searchModel           = searchModel;
     _clock = clock;
 }
Esempio n. 36
0
 public ViewModelLocator()
 {
     _synchronizationService = new SynchronizationService();
     if (!DesignerProperties.IsInDesignTool)
     {
         _synchronizationService.Initialize();
     }
 }
Esempio n. 37
0
 public MainViewModel(Attendee attendee, SynchronizationService synhronizationService, ImageCache imageCache, SearchModel searchModel, Clock clock)
 {
     _attendee = attendee;
     _synhronizationService = synhronizationService;
     _imageCache = imageCache;
     _searchModel = searchModel;
     _clock = clock;
 }
Esempio n. 38
0
 public MainViewModel(
     Individual individual, 
     SynchronizationService synhronizationService, 
     MessageBoardSelectionModel selection)
 {
     _individual = individual;
     _synchronizationService = synhronizationService;
     _selection = selection;
 }
Esempio n. 39
0
 public ViewModelLocator()
 {
     _synchronizationService = new SynchronizationService();
     if (!DesignMode)
         _synchronizationService.Initialize();
     else
         _synchronizationService.InitializeDesignData();
     _selection = new MessageBoardSelectionModel();
 }
Esempio n. 40
0
 public MainViewModel(
     SynchronizationService synchronizationService,
     SearchModel search,
     SelectionModel selection)
 {
     _synchronizationService = synchronizationService;
     _search = search;
     _selection = selection;
 }
Esempio n. 41
0
 public AllSessionsViewModel(
     SynchronizationService synchronizationService,
     SearchModel search,
     Func<Track, TrackViewModel> newTrackViewModel)
 {
     _synchronizationService = synchronizationService;
     _search = search;
     _newTrackViewModel = newTrackViewModel;
 }
Esempio n. 42
0
        public ViewModelLocator()
        {
            _synchronizationService = new SynchronizationService();
            if (!DesignerProperties.GetIsInDesignMode(new DependencyObject()))
                _synchronizationService.Initialize();

            MessageBoardSelectionModel messageBoardSelectionModel = new MessageBoardSelectionModel();
            _main = new MainViewModel(_synchronizationService.Community, messageBoardSelectionModel, _synchronizationService);
        }
Esempio n. 43
0
 public ViewModelLocator()
 {
     _synchronizationService = new SynchronizationService();
     if (!DesignerProperties.IsInDesignTool)
         _synchronizationService.Initialize();
     _selection = new MessageBoardSelectionModel();
     _main = new MainViewModel(_synchronizationService.Individual, _synchronizationService, _selection);
     _join = new JoinMessageBoardViewModel(_selection, _synchronizationService.Individual);
 }
        public ViewModelLocator()
        {
            _synchronizationService = new SynchronizationService();
            if (!DesignerProperties.IsInDesignTool)
                _synchronizationService.Initialize();

            NewGameSelectionModel newGameSelection = new NewGameSelectionModel();
            _main = new MainViewModel(_synchronizationService.Community, _synchronizationService, newGameSelection);
        }
Esempio n. 45
0
        public ViewModelLocator()
        {
            _synchronizationService = new SynchronizationService();
            if (!DesignerProperties.IsInDesignTool)
                _synchronizationService.Initialize();

            _conferenceSelection = new ConferenceSelection();
            _imageCache = new ImageCache();
            _searchModel = new SearchModel();
        }
Esempio n. 46
0
 public ViewModelLocator()
 {
     _synchronizationService = new SynchronizationService();
     if (!DesignMode)
         _synchronizationService.Initialize();
     else
         _synchronizationService.InitializeDesignMode();
     _selection = new MessageBoardSelectionModel();
     _selection.SelectedShare = _synchronizationService.Individual.Shares
         .FirstOrDefault();
 }
Esempio n. 47
0
 public ViewModelLocator()
 {
     _navigationModel = new NavigationModel();
     _surveySnapshot = new SurveySnapshotModel();
     _surveyNavigationModel = new SurveyNavigationModel();
     _synchronizationService = new SynchronizationService(_navigationModel);
     if (!DesignerProperties.IsInDesignTool)
     {
         _synchronizationService.Initialize();
         TemporarilyPreselectDallasTechFest();
     }
     _main = new MainViewModel(_synchronizationService.Community, _navigationModel, _synchronizationService);
 }
Esempio n. 48
0
        public static AllSessionsViewModel CreateViewModel(
            SelectionModel selectionModel,
            SearchModel search,
            SynchronizationService synchronizationService)
        {
            Func<SessionPlace, SessionHeaderViewModel> newSessionHeaderViewModel = s =>
                new SessionHeaderViewModel(s, selectionModel);

            Func<Track, TrackViewModel> newTrackViewModel = t =>
                new TrackViewModel(t, search, newSessionHeaderViewModel);

            return new AllSessionsViewModel(synchronizationService, search, newTrackViewModel);
        }
Esempio n. 49
0
 public ViewModelLocator()
 {
     var navigationModel = new NavigationModel();
     var newEntry = new NewEntryModel();
     _synchronizationService = new SynchronizationService();
     if (!DesignerProperties.IsInDesignTool)
     {
         _synchronizationService.Initialize();
         navigationModel.SelectedShare = _synchronizationService.Identity.ActiveShares
             .OrderBy(share => share.Company.Name.Value)
             .FirstOrDefault();
         _main = new MainViewModel(_synchronizationService.Community, navigationModel, newEntry, _synchronizationService);
     }
 }
Esempio n. 50
0
        public MainViewModel(Community community, SynchronizationService synhronizationService, CompanySelectionModel companySelection, GameSelectionModel gameSelection)
        {
            _gameSelection = gameSelection;
            _community = community;
            _synhronizationService = synhronizationService;
            _companySelection = companySelection;

            if (synhronizationService.Individual != null)
            {
                _companySelectionVM = new CompanySelectionViewModel(
                    synhronizationService.Individual,
                    _companySelection);
            }
        }
Esempio n. 51
0
        public ViewModelLocator()
        {
            _synchronizationService = new SynchronizationService();
            if (!DesignerProperties.IsInDesignTool)
                _synchronizationService.Initialize();
            _imageCache = new ImageCache();
            _searchModel = new SearchModel();
            _clock = new Clock();

            _main = new MainViewModel(_synchronizationService.Attendee, _synchronizationService, _imageCache, _searchModel, _clock);
            _schedule = new ScheduleViewModel(_synchronizationService, _synchronizationService.Attendee, _imageCache, _searchModel);
            _tracks = new TracksViewModel(_synchronizationService.Attendee, _imageCache, _searchModel);
            _search = new SearchViewModel(_synchronizationService.Attendee, _imageCache, _searchModel);
            _map = new MapViewModel(_synchronizationService.Attendee, _imageCache, _clock);
            _notices = new NoticesViewModel(_synchronizationService.Attendee, _imageCache, _clock);
            _settings = new SettingsViewModel(_synchronizationService.Individual, _synchronizationService.Attendee);
        }
        public ViewModelLocator()
        {
            _synchronizationService = new SynchronizationService();
            CompanySelectionModel companySelection = new CompanySelectionModel();
            GameSelectionModel gameSelection = new GameSelectionModel(companySelection);
            if (!DesignerProperties.IsInDesignTool)
            {
                _synchronizationService.Initialize();
                companySelection.SelectedCompany = _synchronizationService
                    .Individual.Companies
                    .Ensure()
                    .FirstOrDefault();
            }

            _main = new MainViewModel(
                _synchronizationService.Community,
                _synchronizationService,
                companySelection,
                gameSelection);
        }
Esempio n. 53
0
 private RemoteProviderProxy(SynchronizationService syncService)
 {
     _syncService = syncService;
 }
Esempio n. 54
0
 public MainViewModel(Community community, MessageBoardSelectionModel selection, SynchronizationService synchronizationService)
 {
     _selection = selection;
     _community = community;
     _synchronizationService = synchronizationService;
 }