예제 #1
0
        private static void NoDSAssignedErrorMsg()
        {
            string warningMessage = "";

            if (ApplicationViewModel.Instance.LoggedInUser.UserDto.HighestRole == (int)RolesEnum.SuperAdministrator)
            {
                warningMessage = "No datasource has been created yet!";
            }
            else
            {
                warningMessage = "You do not have access to any datasource. Please contact the administrator for your organization to request access.";
            }
            WarningWindow error = new WarningWindow(warningMessage, "");

            error.Show();
        }
예제 #2
0
        /// <summary>
        /// Handles the Click event of the btnOpen control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs" /> instance containing the event data.</param>
        private void btnOpen_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            int selectedIndex = -1;

            if (ApplicationViewModel.Instance.CurrentCanvasId > 0)
            {
                MessageBoxResult result = MessageBox.Show("You are about to open another dashboard. Any unsaved changes will be lost. Would you like to continue?", "Warning", MessageBoxButton.OKCancel);

                if (result == MessageBoxResult.Cancel)
                {
                    this.DialogResult = false;
                    return;
                }
            }

            for (int i = 0; i < applicationViewModel.EwavDatasources.Count; i++)
            {
                if (ApplicationViewModel.Instance.EwvSelectedDatasourceNameCandidate ==
                    applicationViewModel.EwavDatasources[i].DatasourceName)
                {
                    //  ApplicationViewModel.Instance.EwavSelectedDatasource = applicationViewModel.EwavDatasources[i];
                    ApplicationViewModel.Instance.EwavDatasourceSelectedIndex = i;
                    //  applicationViewModel.ColumnsLoadedEvent += new Client.Application.ColumnsLoadedEventEventHandler(applicationViewModel_ColumnsLoadedEvent);
                    waitCursor.Visibility = System.Windows.Visibility.Visible;
                    applicationViewModel.DatasourceChangedEvent -= new Client.Application.DatasourceChangedEventHandler(applicationViewModel_DatasourceChangedEvent);
                    applicationViewModel.DatasourceChangedEvent += new Client.Application.DatasourceChangedEventHandler(applicationViewModel_DatasourceChangedEvent);
                    selectedIndex = i;
                    break;
                }
            }

            if (selectedIndex < 0) //replaced <= with <
            {
                WarningWindow error = new WarningWindow("You do not have access to this data source. Please contact the owner of the dashboard to request access.", "");
                error.Show();
                //ErrorWindow Err = new ErrorWindow("You don't have access to their datasource. Contact System Adminstrator.", "");
                //Err.Show();
                return;
            }
        }
예제 #3
0
        private void Share_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            //if (ApplicationViewModel.Instance.DemoMode)
            //{
            //    DemoMode dm = new DemoMode();
            //    dm.Show();
            //    return;
            //}


            if (applicationViewModel.CurrentCanvasId != -1) // if its equal to -1 means it belongs to different user or hasn't been saved.
            {
                ShareDash sharedash = new ShareDash();
                sharedash.Show();
            }
            else
            {
                WarningWindow error = new WarningWindow("Please save the dashboard before sharing.", "");
                error.Show();
                //MessageBox.Show("This canvas is either shared by someone or not saved. Please save the canvas before performing this operation.");
            }
        }
예제 #4
0
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            if (ApplicationViewModel.Instance.DemoMode)
            {
                DemoMode dm = new DemoMode();
                dm.Show();
                return;
            }


            if (applicationViewModel.CurrentCanvasId != -1) // if its equal to -1 means it belongs to different user or hasn't been saved.
            {
                dd         = new DeleteDash();
                dd.Closed += new EventHandler(dd_Closed);
                dd.Show();
            }
            else
            {
                WarningWindow error = new WarningWindow("This is a shared dashboard and cannot be deleted, or dashboard does not exist. ", "");
                error.Show();
                //MessageBox.Show("This canvas is either shared by someone or not saved. Please save the canvas before performing this operation.");
            }
        }