Ejemplo n.º 1
0
        protected override async Task OnInitializedAsync()
        {
            try
            {
                WorkstationAuditService = ScopedServices.GetRequiredService <IWorkstationAuditService>();
                DataTableService        = ScopedServices.GetRequiredService <IDataTableService <WorkstationSession, WorkstationSessionFilter> >();

                switch (DashboardFilter)
                {
                case "NonHideezUnlock":
                    DataTableService.DataLoadingOptions.Filter.UnlockedBy = Hideez.SDK.Communication.SessionSwitchSubject.NonHideez;
                    break;

                case "LongOpenSession":
                    DataTableService.DataLoadingOptions.Filter.Query = WorkstationAuditService.SessionQuery().Where(x => x.StartDate <= DateTime.UtcNow.AddHours(-12) && x.EndDate == null);
                    break;

                case "OpenedSessions":
                    DataTableService.DataLoadingOptions.Filter.Query = WorkstationAuditService.SessionQuery().Where(x => x.EndDate == null);
                    break;
                }

                await BreadcrumbsService.SetAuditWorkstationSessions();

                await DataTableService.InitializeAsync(WorkstationAuditService.GetWorkstationSessionsAsync, WorkstationAuditService.GetWorkstationSessionsCountAsync, StateHasChanged, nameof(WorkstationSession.StartDate), ListSortDirection.Descending);

                SetInitialized();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                SetLoadFailed(ex.Message);
            }
        }
Ejemplo n.º 2
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);
            }
        }
        public DataTableDTO <OrderHeaderDTO> Post(FormDataCollection form)
        {
            var dtFilters   = GetFilters(form, FilterType.Orders);
            var salesOrders = _ordersService.List(dtFilters);

            return(DataTableService.Sort(GetDataTableData(form), salesOrders));
        }
Ejemplo n.º 4
0
        protected override async Task OnInitializedAsync()
        {
            try
            {
                WorkstationService = ScopedServices.GetRequiredService <IWorkstationService>();
                DataTableService   = ScopedServices.GetRequiredService <IDataTableService <Workstation, WorkstationFilter> >();
                SynchronizationService.UpdateWorkstationsPage += UpdateWorkstationsPage;

                switch (DashboardFilter)
                {
                case "NotApproved":
                    DataTableService.DataLoadingOptions.Filter.Approved = false;
                    break;

                case "Online":
                    //TODO
                    break;
                }

                await BreadcrumbsService.SetWorkstations();

                await DataTableService.InitializeAsync(WorkstationService.GetWorkstationsAsync, WorkstationService.GetWorkstationsCountAsync, StateHasChanged, nameof(Workstation.Name));

                SetInitialized();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                SetLoadFailed(ex.Message);
            }
        }
Ejemplo n.º 5
0
        protected override async Task OnInitializedAsync()
        {
            try
            {
                ApplicationUserService = ScopedServices.GetRequiredService <IApplicationUserService>();
                EmailSenderService     = ScopedServices.GetRequiredService <IEmailSenderService>();
                DataTableService       = ScopedServices.GetRequiredService <IDataTableService <ApplicationUser, ApplicationUserFilter> >();

                SynchronizationService.UpdateAdministratorsPage     += UpdateAdministratorsPage;
                SynchronizationService.UpdateAdministratorStatePage += UpdateAdministratorStatePage;

                AuthenticationState = await AuthenticationStateProvider.GetAuthenticationStateAsync();

                await BreadcrumbsService.SetAdministrators();

                await DataTableService.InitializeAsync(ApplicationUserService.GetAdministratorsAsync, ApplicationUserService.GetAdministratorsCountAsync, StateHasChanged, nameof(ApplicationUser.Email), ListSortDirection.Ascending);

                SetInitialized();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                SetLoadFailed(ex.Message);
            }
        }
Ejemplo n.º 6
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);
            }
        }
Ejemplo n.º 7
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);
            }
        }
Ejemplo n.º 8
0
 public KNNChartWindow(Model.Table table)
 {
     InitializeComponent();
     mainTable     = table;
     columnBinding = DataTableService.GetColumnHeadersAsList(table);
     DataContext   = this;
 }
Ejemplo n.º 9
0
        protected override async Task OnInitializedAsync()
        {
            try
            {
                EmployeeService    = ScopedServices.GetRequiredService <IEmployeeService>();
                AppSettingsService = ScopedServices.GetRequiredService <IAppSettingsService>();
                DataTableService   = ScopedServices.GetRequiredService <IDataTableService <Account, AccountFilter> >();
                LdapService        = ScopedServices.GetRequiredService <ILdapService>();

                SynchronizationService.UpdateEmployeeDetailsPage += UpdateEmployeeDetailsPage;
                SynchronizationService.UpdateHardwareVaultState  += UpdateHardwareVaultState;

                await LoadEmployeeAsync();

                await BreadcrumbsService.SetEmployeeDetails(Employee?.FullName);
                await LoadLdapSettingsAsync();

                await DataTableService.InitializeAsync(EmployeeService.GetAccountsAsync, EmployeeService.GetAccountsCountAsync, StateHasChanged, nameof(Account.Name), entityId : EmployeeId);

                await LoadEmployeeSsoState();

                SetInitialized();
            }
            catch (Exception ex)
            {
                SetLoadFailed(ex.Message);
                Logger.LogError(ex.Message);
            }
        }
Ejemplo n.º 10
0
        private void buttonTree_Click(object sender, RoutedEventArgs e)
        {
            mainTable = DecisionTreeService.Group(mainTable);

            ClearMainDataGrid();
            mainDataGrid = DataTableService.InsertDataToGrid(mainTable, mainDataGrid);
            MessageBox.Show(mainTable.ResultInfo);
        }
Ejemplo n.º 11
0
 private async Task UpdateAdministratorStatePage()
 {
     await InvokeAsync(async() =>
     {
         await DataTableService.LoadTableDataAsync();
         StateHasChanged();
     });
 }
Ejemplo n.º 12
0
        public JsonResult GetDatas(TableProcessModel table)
        {
            IDataTableService dataTableService = new DataTableService();
            var result = dataTableService.GetData(table.TableName);

            return(new JsonResult {
                Data = result, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Ejemplo n.º 13
0
 private async Task UpdateHardwareVaultState(string hardwareVaultId)
 {
     await InvokeAsync(async() =>
     {
         await DataTableService.LoadTableDataAsync();
         await ToastService.ShowToastAsync($"Hardware Vault {hardwareVaultId} state changed.", ToastType.Notify);
         StateHasChanged();
     });
 }
Ejemplo n.º 14
0
        private void buttonDiscretize_Click(object sender, RoutedEventArgs e)
        {
            DiscretizationWindow discretizationWindow = new DiscretizationWindow(mainTable);

            discretizationWindow.ShowDialog();

            ClearMainDataGrid();
            mainDataGrid = DataTableService.InsertDataToGrid(discretizationWindow.mainTable, mainDataGrid);
        }
Ejemplo n.º 15
0
        private void buttonNormalize_Click(object sender, RoutedEventArgs e)
        {
            NormalizationWindow normalizationWindow = new NormalizationWindow(mainTable);

            normalizationWindow.ShowDialog();

            ClearMainDataGrid();
            mainDataGrid = DataTableService.InsertDataToGrid(normalizationWindow.mainTable, mainDataGrid);
        }
Ejemplo n.º 16
0
        private void buttonGroup_Click(object sender, RoutedEventArgs e)
        {
            KMeansWindow kMeansWindow = new KMeansWindow(mainTable);

            kMeansWindow.ShowDialog();

            ClearMainDataGrid();
            mainDataGrid = DataTableService.InsertDataToGrid(kMeansWindow.mainTable, mainDataGrid);
        }
Ejemplo n.º 17
0
 public ChartWindow(Model.Table table)
 {
     InitializeComponent();
     mainTable      = table;
     columnBinding  = DataTableService.GetColumnHeadersAsList(table);
     metrykaBinding = new List <string>()
     {
         "odległość Euklidesowa", "metryka Manhattan", "nieskończoność", "Mahalanobisa"
     };
     DataContext = this;
 }
Ejemplo n.º 18
0
        private void buttonConvertToNum_Click(object sender, RoutedEventArgs e)
        {
            ConvertToNumWindow convertToNumWindow = new ConvertToNumWindow(mainTable);

            if (convertToNumWindow.ShowDialog() == false)
            {
                if (convertToNumWindow.result)
                {
                    ClearMainDataGrid();
                    mainDataGrid = DataTableService.InsertDataToGrid(convertToNumWindow.mainTable, mainDataGrid);
                }
            }
        }
Ejemplo n.º 19
0
        private async Task UpdateLicensesPage(string exceptPageId, string userName)
        {
            if (PageId == exceptPageId)
            {
                return;
            }

            await InvokeAsync(async() =>
            {
                await DataTableService.LoadTableDataAsync();
                await ToastService.ShowToastAsync($"Page edited by {userName}.", ToastType.Notify);
                StateHasChanged();
            });
        }
Ejemplo n.º 20
0
        protected override async Task OnInitializedAsync()
        {
            try
            {
                HardwareVaultService = ScopedServices.GetRequiredService <IHardwareVaultService>();
                DataTableService     = ScopedServices.GetRequiredService <IDataTableService <HardwareVault, HardwareVaultFilter> >();

                SynchronizationService.UpdateHardwareVaultsPage += UpdateHardwareVaultsPage;
                SynchronizationService.UpdateHardwareVaultState += UpdateHardwareVaultState;

                switch (DashboardFilter)
                {
                case "LowBattery":
                    DataTableService.DataLoadingOptions.Filter.Battery = "low";
                    break;

                case "VaultLocked":
                    DataTableService.DataLoadingOptions.Filter.Status = VaultStatus.Locked;
                    break;

                case "VaultReady":
                    DataTableService.DataLoadingOptions.Filter.Status = VaultStatus.Ready;
                    break;

                case "LicenseWarning":
                    DataTableService.DataLoadingOptions.Filter.LicenseStatus = VaultLicenseStatus.Warning;
                    break;

                case "LicenseCritical":
                    DataTableService.DataLoadingOptions.Filter.LicenseStatus = VaultLicenseStatus.Critical;
                    break;

                case "LicenseExpired":
                    DataTableService.DataLoadingOptions.Filter.LicenseStatus = VaultLicenseStatus.Expired;
                    break;
                }

                await BreadcrumbsService.SetHardwareVaults();

                await DataTableService.InitializeAsync(HardwareVaultService.GetVaultsAsync, HardwareVaultService.GetVaultsCountAsync, StateHasChanged, nameof(HardwareVault.Id));

                SetInitialized();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                SetLoadFailed(ex.Message);
            }
        }
Ejemplo n.º 21
0
        private void comboBoxClassColumn_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            valuesWithClass = DataTableService.GetColumnsFromTableAsValuesWithClassList(table, comboBoxClassColumn.SelectedIndex);
            int j = 0;

            for (int i = 1; i < columnBinding.Count; i++)
            {
                if (i != comboBoxClassColumn.SelectedIndex)
                {
                    gridValues.ColumnDefinitions.Add(new ColumnDefinition()
                    {
                        Width = GridLength.Auto
                    });

                    Label tempLabel = new Label();
                    tempLabel.Name    = "labelValue" + i;
                    tempLabel.Content = columnBinding[i];
                    tempLabel.HorizontalContentAlignment = HorizontalAlignment.Center;

                    TextBox tempTextBox = new TextBox();
                    tempTextBox.Name   = "textBoxValue" + i;
                    tempTextBox.Height = 30;
                    tempTextBox.HorizontalContentAlignment = HorizontalAlignment.Center;

                    gridValues.Children.Add(tempLabel);
                    gridValues.Children.Add(tempTextBox);

                    Grid.SetRow(tempLabel, j);
                    Grid.SetColumn(tempLabel, i - (j / 2 * 20));

                    Grid.SetRow(tempTextBox, j + 1);
                    Grid.SetColumn(tempTextBox, i - (j / 2 * 20));
                }
                if (i % 20 == 0 && i != 0)
                {
                    j += 2;
                    gridValues.RowDefinitions.Add(new RowDefinition()
                    {
                        Height = GridLength.Auto
                    });
                    gridValues.RowDefinitions.Add(new RowDefinition()
                    {
                        Height = GridLength.Auto
                    });
                }
            }
            DataContext = this;
        }
Ejemplo n.º 22
0
        private async Task ImportVaultsAsync()
        {
            try
            {
                await HardwareVaultService.ImportVaultsAsync();

                await DataTableService.LoadTableDataAsync();

                await ToastService.ShowToastAsync("Vaults imported.", ToastType.Success);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);
            }
        }
Ejemplo n.º 23
0
        protected override async Task OnInitializedAsync()
        {
            try
            {
                WorkstationAuditService = ScopedServices.GetRequiredService <IWorkstationAuditService>();
                DataTableService        = ScopedServices.GetRequiredService <IDataTableService <SummaryByEmployees, SummaryFilter> >();
                await DataTableService.InitializeAsync(WorkstationAuditService.GetSummaryByEmployeesAsync, WorkstationAuditService.GetSummaryByEmployeesCountAsync, StateHasChanged, nameof(SummaryByEmployees.Employee), syncPropName : "Employee");

                SetInitialized();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                SetLoadFailed(ex.Message);
            }
        }
Ejemplo n.º 24
0
        static void Main(string[] args)
        {
            //var credentials = new NetworkCredential("fabien", "test");
            //var handler = new HttpClientHandler { Credentials = credentials };
            //CryptDecrypt c = new CryptDecrypt();
            //var id = c.DataEncrypted("57e5ad63-5e01-4fdc-adae-a7ef9ecff759");
            //using (HttpClient client = new HttpClient(handler))
            //{
            //    var req = new HttpRequestMessage() { RequestUri = new Uri("http://localhost:55493/Outlook/GetAppointments") };
            //    req.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
            //    req.Headers.Add("username", "fabien");
            //    //req.Headers.Add("Authorization", id);
            //    var byteArray =  Encoding.Default.GetBytes(id);
            //    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", id);
            //    var reponse = Task.Run(async () => await client.SendAsync(req));
            //    reponse.Wait();
            //    //client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
            //    //client.Headers.Add("Authorization", "3987345394580");
            //    //client.Headers.Add("username", "user");
            //    //client.Headers.Add("password", "pwd");
            //    //var token = client.UploadString("http://localhost:55493/Outlook/GetAppointments", "POST", "grant_type=username=fabien&password=test");
            //}
            //using (HttpClient client = new HttpClient())
            //{
            //    var req = new HttpRequestMessage() { RequestUri = new Uri("http://localhost:55493/Outlook/GetAppointments") };

            //    req.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
            //    req.Headers.Add("username", "user");
            //    var byteArray = new UTF8Encoding().GetBytes("<clientid>:<clientsecret>");
            //    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
            //    var reponse = Task.Run(async () => await client.SendAsync(req));
            //    reponse.Wait();
            //    //client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
            //    //client.Headers.Add("Authorization", "3987345394580");
            //    //client.Headers.Add("username", "user");
            //    //client.Headers.Add("password", "pwd");
            //    //var token = client.UploadString("http://localhost:55493/Outlook/GetAppointments", "POST", "grant_type=username=fabien&password=test");
            //}
            ////GenerateToken(null, DateTime.Now, "test");
            ///
            DataTableService s = new DataTableService();

            s.GetData("TemplateTable");
        }
Ejemplo n.º 25
0
        protected override async Task OnInitializedAsync()
        {
            try
            {
                WorkstationAuditService = ScopedServices.GetRequiredService <IWorkstationAuditService>();
                DataTableService        = ScopedServices.GetRequiredService <IDataTableService <WorkstationEvent, WorkstationEventFilter> >();

                await BreadcrumbsService.SetAuditWorkstationEvents();

                await DataTableService.InitializeAsync(WorkstationAuditService.GetWorkstationEventsAsync, WorkstationAuditService.GetWorkstationEventsCountAsync, StateHasChanged, nameof(WorkstationEvent.Date), ListSortDirection.Descending);

                SetInitialized();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                SetLoadFailed(ex.Message);
            }
        }
Ejemplo n.º 26
0
        private void buttonGeneruj_Click(object sender, RoutedEventArgs e)
        {
            if (comboBoxFirstColumn.SelectedIndex == -1 ||
                comboBoxSecondColumn.SelectedIndex == -1 ||
                comboBoxClassColumn.SelectedIndex == -1)
            {
                MessageBox.Show("Nie wybrano wartości dla wszystkich kolumn");
            }
            else
            {
                classPointList = DataTableService.GetColumnFromTableAsClassPointList(mainTable, comboBoxFirstColumn.SelectedIndex, comboBoxSecondColumn.SelectedIndex, comboBoxClassColumn.SelectedIndex);

                cartesianChart.Series = ChartsService.GetNewSeriesCollectionDependOnColumns(classPointList);
                axisX.Title           = comboBoxFirstColumn.SelectedItem.ToString();
                axisY.Title           = comboBoxSecondColumn.SelectedItem.ToString();

                buttonRozwinKlasyfikacje.IsEnabled = true;
            }
        }
Ejemplo n.º 27
0
        private async Task InviteAdminAsync()
        {
            RenderFragment body = (builder) =>
            {
                builder.OpenComponent(0, typeof(InviteAdmin));
                builder.CloseComponent();
            };

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

            var result = await instance.Result;

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

                await SynchronizationService.UpdateAdministrators(PageId);
            }
        }
Ejemplo n.º 28
0
        private async Task CreateLicenseOrderAsync()
        {
            RenderFragment body = (builder) =>
            {
                builder.OpenComponent(0, typeof(CreateLicenseOrder));
                builder.CloseComponent();
            };

            var instance = await ModalDialogService.ShowAsync("Create License Order", body, ModalDialogSize.Large);

            var result = await instance.Result;

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

                await SynchronizationService.UpdateTemplates(PageId);
            }
        }
Ejemplo n.º 29
0
        private async Task SyncEmployeesWithAdAsync()
        {
            RenderFragment body = (builder) =>
            {
                builder.OpenComponent(0, typeof(SyncEmployeesWithAD));
                builder.CloseComponent();
            };

            var instance = await ModalDialogService.ShowAsync("Sync with Active Directory", body, ModalDialogSize.Large);

            var result = await instance.Result;

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

                await SynchronizationService.UpdateEmployees(PageId);
            }
        }
Ejemplo n.º 30
0
        private async Task SendLicenseOrderAsync()
        {
            RenderFragment body = (builder) =>
            {
                builder.OpenComponent(0, typeof(SendLicenseOrder));
                builder.AddAttribute(1, nameof(SendLicenseOrder.LicenseOrderId), DataTableService.SelectedEntity.Id);
                builder.CloseComponent();
            };

            var instance = await ModalDialogService.ShowAsync("Send License Order", body, ModalDialogSize.Default);

            var result = await instance.Result;

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

                await SynchronizationService.UpdateTemplates(PageId);
            }
        }