/// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="user">The DFP user object running the code example.</param>
    public override void Run(DfpUser user) {
      // Get the UserService.
      UserService userService = (UserService) user.GetService(DfpService.v201508.UserService);

      // Create a statement to get all users.
      StatementBuilder statementBuilder = new StatementBuilder()
          .OrderBy("id ASC")
          .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

      // Sets defaults for page and statement.
      UserPage page = new UserPage();

      try {
        do {
          // Get users by statement.
          page = userService.getUsersByStatement(statementBuilder.ToStatement());

          if (page.results != null && page.results.Length > 0) {
            int i = page.startIndex;
            foreach (User usr in page.results) {
              Console.WriteLine("{0}) User with ID = '{1}', email = '{2}', and role = '{3}'" +
                  " was found.", i, usr.id, usr.email, usr.roleName);
              i++;
            }
          }
          statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
        } while (statementBuilder.GetOffset() < page.totalResultSetSize);

        Console.WriteLine("Number of results found: {0}", page.totalResultSetSize);
      } catch (Exception e) {
        Console.WriteLine("Failed to get all users. Exception says \"{0}\"",
            e.Message);
      }
    }
            public void MultiplePages()
            {
                Page page = new UserPage { Controls = new ControlList() };
                page.Controls.Add(new TextControl { Id = 5 });
                this.Product.FormDefinition.Pages.Add(page);

                Assert.AreEqual(6, this.Product.FormDefinition.Pages.GetNextControlId());
            }
Example #3
0
		public ModelResult<UserPage> List(ListRequest request)
		{
			var users = UserRepository.GetAll().TakePage(request.Page, request.PageSize);
			int totalItems = UserRepository.Count();

			var page = new UserPage(request.Page, request.PageSize, totalItems, users);
			return Model(page, request.Formatting);
		}
Example #4
0
 public override void Link()
 {
     VirtualRoot.BuildCmdPath <ShowDialogWindowCommand>(action: message => {
         UIThread.Execute(() => {
             DialogWindow.ShowDialog(new DialogWindowViewModel(message: message.Message, title: message.Title, onYes: message.OnYes, icon: message.Icon));
         });
     });
     VirtualRoot.BuildCmdPath <ShowQQGroupQrCodeCommand>(action: message => {
         UIThread.Execute(() => {
             QQGroupQrCode.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <ShowCalcCommand>(action: message => {
         UIThread.Execute(() => {
             Calc.ShowWindow(message.CoinVm);
         });
     });
     VirtualRoot.BuildCmdPath <ShowLocalIpsCommand>(action: message => {
         UIThread.Execute(() => {
             LocalIpConfig.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <ShowEthNoDevFeeCommand>(action: message => {
         UIThread.Execute(() => {
             EthNoDevFeeEdit.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <ShowCalcConfigCommand>(action: message => {
         UIThread.Execute(() => {
             CalcConfig.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <ShowMinerClientsWindowCommand>(action: message => {
         UIThread.Execute(() => {
             MinerClientsWindow.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <ShowNTMinerUpdaterConfigCommand>(action: message => {
         UIThread.Execute(() => {
             NTMinerUpdaterConfig.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <ShowAboutPageCommand>(action: message => {
         UIThread.Execute(() => {
             AboutPage.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <ShowKernelOutputPageCommand>(action: message => {
         UIThread.Execute(() => {
             KernelOutputPage.ShowWindow(message.SelectedKernelOutputVm);
         });
     });
     VirtualRoot.BuildCmdPath <ShowKernelInputPageCommand>(action: message => {
         UIThread.Execute(() => {
             KernelInputPage.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <ShowTagBrandCommand>(action: message => {
         if (NTMinerRoot.IsBrandSpecified)
         {
             return;
         }
         BrandTag.ShowWindow();
     });
     VirtualRoot.BuildCmdPath <ShowCoinPageCommand>(action: message => {
         UIThread.Execute(() => {
             CoinPage.ShowWindow(message.CurrentCoin, message.TabType);
         });
     });
     VirtualRoot.BuildCmdPath <ShowGroupPageCommand>(action: message => {
         UIThread.Execute(() => {
             GroupPage.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <ShowSysDicPageCommand>(action: message => {
         UIThread.Execute(() => {
             SysDicPage.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <ShowVirtualMemoryCommand>(action: message => {
         UIThread.Execute(() => {
             VirtualMemory.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <ShowRestartWindowsCommand>(action: message => {
         UIThread.Execute(() => {
             RestartWindows.ShowDialog();
         });
     });
     VirtualRoot.BuildCmdPath <ShowNotificationSampleCommand>(action: message => {
         UIThread.Execute(() => {
             NotificationSample.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <ShowPropertyCommand>(action: message => {
         UIThread.Execute(() => {
             Property.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <ShowChartsWindowCommand>(action: message => {
         UIThread.Execute(() => {
             ChartsWindow.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <ShowOverClockDataPageCommand>(action: message => {
         UIThread.Execute(() => {
             OverClockDataPage.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <ShowNTMinerWalletPageCommand>(action: message => {
         UIThread.Execute(() => {
             NTMinerWalletPage.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <ShowMessagePathIdsCommand>(action: message => {
         UIThread.Execute(() => {
             MessagePathIds.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <ShowUserPageCommand>(action: message => {
         UIThread.Execute(() => {
             UserPage.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <ShowRemoteDesktopLoginDialogCommand>(action: message => {
         RemoteDesktopLogin.ShowWindow(message.Vm);
     });
     VirtualRoot.BuildCmdPath <ShowKernelsWindowCommand>(action: message => {
         UIThread.Execute(() => {
             KernelsWindow.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <ShowKernelDownloaderCommand>(action: message => {
         UIThread.Execute(() => {
             KernelDownloading.ShowWindow(message.KernelId, message.DownloadComplete);
         });
     });
     VirtualRoot.BuildCmdPath <EnvironmentVariableEditCommand>(action: message => {
         UIThread.Execute(() => {
             EnvironmentVariableEdit.ShowWindow(message.CoinKernelVm, message.EnvironmentVariable);
         });
     });
     VirtualRoot.BuildCmdPath <InputSegmentEditCommand>(action: message => {
         UIThread.Execute(() => {
             InputSegmentEdit.ShowWindow(message.CoinKernelVm, message.Segment);
         });
     });
     VirtualRoot.BuildCmdPath <CoinKernelEditCommand>(action: message => {
         UIThread.Execute(() => {
             CoinKernelEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.BuildCmdPath <CoinEditCommand>(action: message => {
         UIThread.Execute(() => {
             CoinEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.BuildCmdPath <ColumnsShowEditCommand>(action: message => {
         UIThread.Execute(() => {
             ColumnsShowEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.BuildCmdPath <ShowContainerWindowCommand>(action: message => {
         UIThread.Execute(() => {
             ContainerWindow window = ContainerWindow.GetWindow(message.Vm);
             window?.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <ShowSpeedChartsCommand>(action: message => {
         UIThread.Execute(() => {
             SpeedCharts.ShowWindow(message.GpuSpeedVm);
         });
     });
     VirtualRoot.BuildCmdPath <ShowFileWriterPageCommand>(action: message => {
         UIThread.Execute(() => {
             FileWriterPage.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <FileWriterEditCommand>(action: message => {
         UIThread.Execute(() => {
             FileWriterEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.BuildCmdPath <ShowFragmentWriterPageCommand>(action: message => {
         UIThread.Execute(() => {
             FragmentWriterPage.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <FragmentWriterEditCommand>(action: message => {
         UIThread.Execute(() => {
             FragmentWriterEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.BuildCmdPath <GroupEditCommand>(action: message => {
         UIThread.Execute(() => {
             GroupEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.BuildCmdPath <KernelInputEditCommand>(action: message => {
         UIThread.Execute(() => {
             KernelInputEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.BuildCmdPath <KernelOutputFilterEditCommand>(action: message => {
         UIThread.Execute(() => {
             KernelOutputFilterEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.BuildCmdPath <KernelOutputTranslaterEditCommand>(action: message => {
         UIThread.Execute(() => {
             KernelOutputTranslaterEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.BuildCmdPath <KernelOutputEditCommand>(action: message => {
         UIThread.Execute(() => {
             KernelOutputEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.BuildCmdPath <ShowPackagesWindowCommand>(action: message => {
         UIThread.Execute(() => {
             PackagesWindow.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <KernelEditCommand>(action: message => {
         UIThread.Execute(() => {
             KernelEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.BuildCmdPath <ShowLogColorCommand>(action: message => {
         UIThread.Execute(() => {
             LogColor.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <ShowMinerClientSettingCommand>(action: message => {
         UIThread.Execute(() => {
             MinerClientSetting.ShowWindow(message.Vm);
         });
     });
     VirtualRoot.BuildCmdPath <ShowMinerNamesSeterCommand>(action: message => {
         UIThread.Execute(() => {
             MinerNamesSeter.ShowWindow(message.Vm);
         });
     });
     VirtualRoot.BuildCmdPath <ShowGpuProfilesPageCommand>(action: message => {
         UIThread.Execute(() => {
             GpuProfilesPage.ShowWindow(message.MinerClientsWindowVm);
         });
     });
     VirtualRoot.BuildCmdPath <ShowMinerClientAddCommand>(action: message => {
         UIThread.Execute(() => {
             MinerClientAdd.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <MinerGroupEditCommand>(action: message => {
         UIThread.Execute(() => {
             MinerGroupEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.BuildCmdPath <NTMinerWalletEditCommand>(action: message => {
         UIThread.Execute(() => {
             NTMinerWalletEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.BuildCmdPath <MineWorkEditCommand>(action: message => {
         UIThread.Execute(() => {
             MineWorkEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.BuildCmdPath <OverClockDataEditCommand>(action: message => {
         UIThread.Execute(() => {
             OverClockDataEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.BuildCmdPath <PackageEditCommand>(action: message => {
         UIThread.Execute(() => {
             PackageEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.BuildCmdPath <PoolKernelEditCommand>(action: message => {
         UIThread.Execute(() => {
             PoolKernelEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.BuildCmdPath <PoolEditCommand>(action: message => {
         UIThread.Execute(() => {
             PoolEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.BuildCmdPath <ShowControlCenterHostConfigCommand>(action: message => {
         UIThread.Execute(() => {
             ControlCenterHostConfig.ShowWindow();
         });
     });
     VirtualRoot.BuildCmdPath <SysDicItemEditCommand>(action: message => {
         UIThread.Execute(() => {
             SysDicItemEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.BuildCmdPath <SysDicEditCommand>(action: message => {
         UIThread.Execute(() => {
             SysDicEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.BuildCmdPath <UserEditCommand>(action: message => {
         UIThread.Execute(() => {
             UserEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.BuildCmdPath <WalletEditCommand>(action: message => {
         UIThread.Execute(() => {
             WalletEdit.ShowWindow(message.FormType, message.Source);
         });
     });
 }
Example #5
0
 public void ThenTheUserShouldNotDisplay(string displayName)
 {
     Assert.IsNull(UserPage.GetUserRow(displayName));
 }
Example #6
0
 public void ThenTheUserShouldNotHaveALinkToDeleteTheUser(string displayName)
 {
     Assert.IsFalse(UserPage.GetUserDeleteButton(displayName).Exists);
 }
Example #7
0
 public override void Link()
 {
     VirtualRoot.Window <ShowDialogWindowCommand>(LogEnum.DevConsole,
                                                  action: message => {
         UIThread.Execute(() => {
             DialogWindow.ShowDialog(message: message.Message, title: message.Title, onYes: message.OnYes, icon: message.Icon);
         });
     });
     VirtualRoot.Window <ShowQQGroupQrCodeCommand>(LogEnum.DevConsole,
                                                   action: message => {
         UIThread.Execute(() => {
             QQGroupQrCode.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowCalcCommand>(LogEnum.DevConsole,
                                          action: message => {
         UIThread.Execute(() => {
             Calc.ShowWindow(message.CoinVm);
         });
     });
     VirtualRoot.Window <ShowFileDownloaderCommand>(LogEnum.DevConsole,
                                                    action: message => {
         UIThread.Execute(() => {
             FileDownloader.ShowWindow(message.DownloadFileUrl, message.FileTitle, message.DownloadComplete);
         });
     });
     VirtualRoot.Window <ShowCalcConfigCommand>(LogEnum.DevConsole,
                                                action: message => {
         UIThread.Execute(() => {
             CalcConfig.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowMinerClientsWindowCommand>(LogEnum.DevConsole,
                                                        action: message => {
         UIThread.Execute(() => {
             MinerClientsWindow.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowNTMinerUpdaterConfigCommand>(LogEnum.DevConsole,
                                                          action: message => {
         UIThread.Execute(() => {
             NTMinerUpdaterConfig.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowAboutPageCommand>(LogEnum.DevConsole,
                                               action: message => {
         UIThread.Execute(() => {
             AboutPage.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowKernelOutputPageCommand>(LogEnum.DevConsole,
                                                      action: message => {
         UIThread.Execute(() => {
             KernelOutputPage.ShowWindow(message.SelectedKernelOutputVm);
         });
     });
     VirtualRoot.Window <ShowKernelInputPageCommand>(LogEnum.DevConsole,
                                                     action: message => {
         UIThread.Execute(() => {
             KernelInputPage.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowColumnsShowPageCommand>(LogEnum.DevConsole,
                                                     action: message => {
         UIThread.Execute(() => {
             ColumnsShowPage.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowGroupPageCommand>(LogEnum.DevConsole,
                                               action: message => {
         UIThread.Execute(() => {
             GroupPage.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowSysDicPageCommand>(LogEnum.DevConsole,
                                                action: message => {
         UIThread.Execute(() => {
             SysDicPage.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowVirtualMemoryCommand>(LogEnum.DevConsole,
                                                   action: message => {
         UIThread.Execute(() => {
             VirtualMemory.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowRestartWindowsCommand>(LogEnum.DevConsole,
                                                    action: message => {
         UIThread.Execute(() => {
             RestartWindows.ShowDialog();
         });
     });
     VirtualRoot.Window <ShowNotificationSampleCommand>(LogEnum.DevConsole,
                                                        action: message => {
         UIThread.Execute(() => {
             NotificationSample.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowInnerPropertyCommand>(LogEnum.DevConsole,
                                                   action: message => {
         UIThread.Execute(() => {
             InnerProperty.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowChartsWindowCommand>(LogEnum.DevConsole,
                                                  action: message => {
         UIThread.Execute(() => {
             ChartsWindow.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowOverClockDataPageCommand>(LogEnum.DevConsole,
                                                       action: message => {
         UIThread.Execute(() => {
             OverClockDataPage.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowUserPageCommand>(LogEnum.DevConsole,
                                              action: message => {
         UIThread.Execute(() => {
             UserPage.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowKernelDownloaderCommand>(LogEnum.DevConsole,
                                                      action: message => {
         UIThread.Execute(() => {
             KernelDownloading.ShowWindow(message.KernelId, message.DownloadComplete);
         });
     });
     VirtualRoot.Window <EnvironmentVariableEditCommand>(LogEnum.DevConsole,
                                                         action: message => {
         UIThread.Execute(() => {
             EnvironmentVariableEdit.ShowWindow(message.CoinKernelVm, message.EnvironmentVariable);
         });
     });
     VirtualRoot.Window <InputSegmentEditCommand>(LogEnum.DevConsole,
                                                  action: message => {
         UIThread.Execute(() => {
             InputSegmentEdit.ShowWindow(message.CoinKernelVm, message.Segment);
         });
     });
     VirtualRoot.Window <CoinKernelEditCommand>(LogEnum.DevConsole,
                                                action: message => {
         UIThread.Execute(() => {
             CoinKernelEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <CoinEditCommand>(LogEnum.DevConsole,
                                          action: message => {
         UIThread.Execute(() => {
             CoinEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <ColumnsShowEditCommand>(LogEnum.DevConsole,
                                                 action: message => {
         UIThread.Execute(() => {
             ColumnsShowEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <ShowContainerWindowCommand>(LogEnum.DevConsole,
                                                     action: message => {
         UIThread.Execute(() => {
             ContainerWindow window = ContainerWindow.GetWindow(message.Vm);
             window?.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowSpeedChartsCommand>(LogEnum.DevConsole,
                                                 action: message => {
         UIThread.Execute(() => {
             SpeedCharts.ShowWindow(message.GpuSpeedVm);
         });
     });
     VirtualRoot.Window <GroupEditCommand>(LogEnum.DevConsole,
                                           action: message => {
         UIThread.Execute(() => {
             GroupEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <KernelInputEditCommand>(LogEnum.DevConsole,
                                                 action: message => {
         UIThread.Execute(() => {
             KernelInputEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <KernelOutputFilterEditCommand>(LogEnum.DevConsole,
                                                        action: message => {
         UIThread.Execute(() => {
             KernelOutputFilterEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <KernelOutputTranslaterEditCommand>(LogEnum.DevConsole,
                                                            action: message => {
         UIThread.Execute(() => {
             KernelOutputTranslaterEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <KernelOutputEditCommand>(LogEnum.DevConsole,
                                                  action: message => {
         UIThread.Execute(() => {
             KernelOutputEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <ShowPackagesWindowCommand>(LogEnum.DevConsole,
                                                    action: message => {
         UIThread.Execute(() => {
             PackagesWindow.ShowWindow();
         });
     });
     VirtualRoot.Window <KernelEditCommand>(LogEnum.DevConsole,
                                            action: message => {
         UIThread.Execute(() => {
             KernelEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <ShowLogColorCommand>(LogEnum.DevConsole,
                                              action: message => {
         UIThread.Execute(() => {
             LogColor.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowMinerClientSettingCommand>(LogEnum.DevConsole,
                                                        action: message => {
         UIThread.Execute(() => {
             MinerClientSetting.ShowWindow(message.Vm);
         });
     });
     VirtualRoot.Window <ShowMinerNamesSeterCommand>(LogEnum.DevConsole,
                                                     action: message => {
         UIThread.Execute(() => {
             MinerNamesSeter.ShowWindow(message.Vm);
         });
     });
     VirtualRoot.Window <ShowGpuProfilesPageCommand>(LogEnum.DevConsole,
                                                     action: message => {
         UIThread.Execute(() => {
             GpuProfilesPage.ShowWindow(message.MinerClientsWindowVm);
         });
     });
     VirtualRoot.Window <ShowMinerClientAddCommand>(LogEnum.DevConsole,
                                                    action: message => {
         UIThread.Execute(() => {
             MinerClientAdd.ShowWindow();
         });
     });
     VirtualRoot.Window <MinerGroupEditCommand>(LogEnum.DevConsole,
                                                action: message => {
         UIThread.Execute(() => {
             MinerGroupEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <MineWorkEditCommand>(LogEnum.DevConsole,
                                              action: message => {
         UIThread.Execute(() => {
             MineWorkEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <OverClockDataEditCommand>(LogEnum.DevConsole,
                                                   action: message => {
         UIThread.Execute(() => {
             OverClockDataEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <PackageEditCommand>(LogEnum.DevConsole,
                                             action: message => {
         UIThread.Execute(() => {
             PackageEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <PoolKernelEditCommand>(LogEnum.DevConsole,
                                                action: message => {
         UIThread.Execute(() => {
             PoolKernelEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <PoolEditCommand>(LogEnum.DevConsole,
                                          action: message => {
         UIThread.Execute(() => {
             PoolEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <ShowControlCenterHostConfigCommand>(LogEnum.DevConsole,
                                                             action: message => {
         UIThread.Execute(() => {
             ControlCenterHostConfig.ShowWindow();
         });
     });
     VirtualRoot.Window <SysDicItemEditCommand>(LogEnum.DevConsole,
                                                action: message => {
         UIThread.Execute(() => {
             SysDicItemEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <SysDicEditCommand>(LogEnum.DevConsole,
                                            action: message => {
         UIThread.Execute(() => {
             SysDicEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <UserEditCommand>(LogEnum.DevConsole,
                                          action: message => {
         UIThread.Execute(() => {
             UserEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <WalletEditCommand>(LogEnum.DevConsole,
                                            action: message => {
         UIThread.Execute(() => {
             WalletEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <UpgradeCommand>(LogEnum.DevConsole,
                                         action: message => {
         Upgrade(message.FileName, message.Callback);
     });
 }
Example #8
0
 public UserTests()
 {
     driver.Navigate().GoToUrl(url);
     userPageObject = new UserPage(driver);
     commonPage     = new CommonPage(driver);
 }
        public void GivenPageNumber(Table table)
        {
            UserPage pagesList = table.CreateInstance <UserPage>();

            _pages.Page = pagesList.Page;
        }
 private string GetPageURL(User user, UserPage up)
 {
     return(Intranet.Properties.Settings.Default.BaseURL + "/" + Intranet.Properties.Settings.Default.HomePath + "/" + user.login_name.ToLower() + (up == null ? "" : "/" + up.url));
 }
Example #11
0
        public void Show(int key)
        {
            switch (key)
            {
            case 1:
                RecepcionWindow recepcion = new RecepcionWindow();
                recepcion.Show();
                break;

            case 2:
                RegisterPage register = new RegisterPage();
                register.Show();
                break;

            case 3:
                UserPage user = new UserPage();
                user.Show();
                break;

            case 4:
                CookReportPage cookReport = new CookReportPage();
                cookReport.Show();
                break;

            case 5:
                CookInfoPage cookInfo = new CookInfoPage();
                cookInfo.Show();
                break;

            case 6:
                UserMenuPage menu = new UserMenuPage();
                menu.Show();
                break;

            case 7:
                UrgencyPage urgency = new UrgencyPage();
                urgency.Show();
                break;

            case 8:
                UserReportPage report = new UserReportPage();
                report.Show();
                break;

            case 9:
                InfoPage info = new InfoPage();
                info.Show();
                break;

            case 10:
                OptionDr option = new OptionDr();
                option.Show();
                break;

            case 11:
                PaymentPage pay = new PaymentPage();
                pay.Show();
                break;

            default:
                MessageBox.Show("Error");
                break;
            }
        }
Example #12
0
        private async Task Login()
        {
            if (IsLogining)
            {
                try
                {
                    if (string.IsNullOrEmpty(UserName))
                    {
                        _commonFun.AlertLongText("请输入用户名。");
                        return;
                    }
                    else if (string.IsNullOrEmpty(Password))
                    {
                        _commonFun.AlertLongText("请输入密码。");
                        return;
                    }

                    if (_commonHelper.IsNetWorkConnected() == true)
                    {
                        IsLogining = false;
                        _commonFun.ShowLoading("登录中...");
                        var result = await _accountService.Login(UserName, Password);

                        if (result.ResultCode == Module.ResultType.Success)
                        {
                            _commonFun.JPushSetAlias(UserName.ToLower().Trim());
                            MessagingCenter.Send <string>(UserName.ToLower().Trim(), "RegistPushTags");
                            AccountInfo accountInfo = CommonHelper.DecodeString <AccountInfo>(result.Body);
                            if (accountInfo != null)
                            {
                                accountInfo.LoggedInAt = DateTime.Now;
                                CommonContext.Account  = accountInfo;
                                _commonFun.SetCach(CommonContext.USERNAMEKEY, UserName);

                                #region Create Table
                                var conn = Resolver.Resolve <ISQLite>().GetConnection();
                                conn.CreateTable <Attachment>();
                                conn.CreateTable <CalenderPlans>();
                                conn.CreateTable <CasesInfo>();
                                conn.CreateTable <CheckResult>();
                                conn.CreateTable <Domain.CheckStandard>();
                                conn.CreateTable <CodeHidden>();
                                conn.CreateTable <Department>();
                                conn.CreateTable <Distributor>();
                                conn.CreateTable <Employee>();
                                conn.CreateTable <ImprovementApprovalHis>();
                                conn.CreateTable <ImprovementItem>();
                                conn.CreateTable <ImprovementItemResult>();
                                conn.CreateTable <Notice>();
                                conn.CreateTable <NoticeDepart>();
                                conn.CreateTable <NoticeReader>();
                                conn.CreateTable <NoticeReplyHis>();
                                conn.CreateTable <Domain.PictureStandard>();
                                conn.CreateTable <Plans>();
                                conn.CreateTable <ProcessDtl>();
                                conn.CreateTable <ProcessMst>();
                                conn.CreateTable <PushSend>();
                                conn.CreateTable <Score>();
                                conn.CreateTable <Domain.StandardPic>();
                                conn.CreateTable <TaskCard>();
                                conn.CreateTable <TaskItem>();
                                conn.CreateTable <TaskOfPlan>();
                                #endregion

                                #region Bottom Menu
                                TabbedBarPage _bottomPage = new TabbedBarPage()
                                {
                                    Title = "服务"
                                };

                                var _messagePage = new MessagePage()
                                {
                                    Title = "消息",
                                    Icon  = (FileImageSource)FileImageSource.FromFile("message")
                                };

                                _bottomPage.Children.Add(_messagePage);

                                var _mainPage = new MainPage()
                                {
                                    Title = "服务",
                                    Icon  = (FileImageSource)FileImageSource.FromFile("server")
                                };

                                _bottomPage.Children.Add(_mainPage);

                                var _userPage = new UserPage()
                                {
                                    Title = "我的",
                                    Icon  = (FileImageSource)FileImageSource.FromFile("me")
                                };

                                _bottomPage.Children.Add(_userPage);


                                _bottomPage.CurrentPageChanged += (sender, e) =>
                                {
                                    _bottomPage.Title = "全景经营能力PCM评估改善平台";//_bottomPage.CurrentPage.Title;
                                    if (Device.OS == TargetPlatform.Android)
                                    {
                                        _bottomPage.BarTextColor = Color.FromHex("#6281AB"); //底端Menu,当前菜单的颜色
                                    }
                                };

                                _bottomPage.CurrentPage = _bottomPage.Children[1];
                                #endregion

                                #region DownLoadData
                                _commonFun.HideLoading();
                                if (accountInfo.UserType == "Z")
                                {
                                    //if (await _commonFun.Confirm("登录成功,是否同步数据?"))
                                    //{
                                    await MasterDataDownloadHelper.DownloadData();

                                    //}
                                }

                                #endregion

                                //BarTextColor 导航栏字体颜色
                                //BarBackgroundColor 导航栏背景颜色
                                Application.Current.MainPage = new NavigationPage(_bottomPage)
                                {
                                    BarTextColor       = Color.White,
                                    BarBackgroundColor = Color.FromHex("#6281AB"),
                                    BackgroundColor    = Color.FromHex("#6281AB")
                                };
                            }
                            else
                            {
                                _commonFun.AlertLongText("用户名或者密码不正确。");
                                IsLogining = true;
                            }
                        }
                        else
                        {
                            _commonFun.HideLoading();
                            _commonFun.AlertLongText("登录失败,请重试。 " + result.Msg);
                            IsLogining = true;
                        }
                    }
                    else
                    {
                        _commonFun.AlertLongText("网络连接异常。");
                        IsLogining = true;
                    }
                }
                catch (OperationCanceledException)
                {
                    _commonFun.HideLoading();
                    _commonFun.AlertLongText("请求超时。");
                    IsLogining = true;
                }
                catch (Exception ex)
                {
                    _commonFun.HideLoading();
                    _commonFun.AlertLongText("登录异常,请重试。");
                    IsLogining = true;
                }
                finally
                {
                    _commonFun.HideLoading();
                }
            }
        }
Example #13
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            Page.Validate();

            if (Page.IsValid == false)
            {
                return;
            }

            ScentaurusEntities2 entity = MyDBContext;
            string userName            = txtUserName.Text;
            string password            = txtPassword.Text.Trim();
            string firstName           = txtFirstName.Text;
            string lastName            = txtLastName.Text;
            int    userType            = int.Parse(ddl_Type.SelectedValue);
            //int camp = int.Parse((Master.FindControl("ddlCampus") as DropDownList).SelectedValue);
            // int camp = Utils.GetCampusIDForAddition();
            DataTable dtUsers  = new DataTable();
            DataTable dtFilter = new DataTable();

            List <UserDetail> userData = entity.UserDetails.Where(x => x.Username.ToLower().Trim() == userName.ToLower().Trim()).ToList();

            if (hdnMode.Value == "Add")
            {
                if (userData.Count > 0)
                {
                    UserDetail obj = new UserDetail
                    {
                        Username = txtUserName.Text.Trim(),
                        Password = txtPassword.Text,
                        //   obj.Role = ddl_Type.SelectedItem.Text;
                        FirstName = txtFirstName.Text,
                        LastName  = txtLastName.Text,
                        IsActive  = true,
                        // obj.CampusID = camp;
                        CreatedBy = Utils.GetUserName(),
                        CreatedOn = DateTime.Now
                    };

                    entity.UserDetails.Add(obj);

                    if (entity.SaveChanges() > 0)
                    {
                        int userID = entity.UserDetails.OrderByDescending(x => x.ID).FirstOrDefault().ID;

                        foreach (RepeaterItem ri in rpPages.Items)
                        {
                            // chkParentPage hdnID cblPages
                            HiddenField  hdnID         = ri.FindControl("hdnID") as HiddenField;
                            CheckBox     chkParentPage = ri.FindControl("chkParentPage") as CheckBox;
                            CheckBoxList cblPages      = ri.FindControl("cblPages") as CheckBoxList;

                            if (chkParentPage.Checked)
                            {
                                UserPage up = new UserPage
                                {
                                    PageID    = int.Parse(hdnID.Value),
                                    UserID    = userID,
                                    IsAllowed = true
                                };
                                entity.UserPages.Add(up);
                                entity.SaveChanges();

                                foreach (ListItem item in cblPages.Items)
                                {
                                    if (item.Selected)
                                    {
                                        UserPage upc = new UserPage
                                        {
                                            PageID    = int.Parse(item.Value),
                                            UserID    = userID,
                                            IsAllowed = true
                                        };
                                        entity.UserPages.Add(upc);
                                        entity.SaveChanges();
                                    }
                                }
                            }
                        }


                        Utils.ShowAlert(this, "User Added successfully.");
                        btnCancel_Click(null, null);
                    }
                }
                else
                {
                    Utils.ShowAlert(this, "Error", "Username already exist.", false);
                }
            }

            else
            {
                UserDetail obj = entity.UserDetails.Where(x => x.Username.ToLower().Trim() == hdnUserName.Value.ToLower().Trim()).FirstOrDefault();

                //obj.Username = txtUserName.Text.Trim();
                obj.Password = txtPassword.Text;
                //obj.Role = ddl_Type.SelectedItem.Text;
                obj.FirstName = txtFirstName.Text;
                obj.LastName  = txtLastName.Text;
                // obj.IsActive = true;
                //obj.CampusID = camp;
                //obj.CreatedBy = Utils.GetUserName();
                //obj.CreatedTimeStamp = DateTime.Now.ToString();

                ///entity.Users.Add(obj);
                entity.SaveChanges();
                //if (entity.SaveChanges() > 0)
                {
                    List <UserPage> upl    = entity.UserPages.Where(x => x.UserID == obj.ID).ToList();
                    int             userID = obj.ID;

                    foreach (UserPage i in upl)
                    {
                        entity.UserPages.Remove(i);
                    }


                    foreach (RepeaterItem ri in rpPages.Items)
                    {
                        // chkParentPage hdnID cblPages
                        HiddenField  hdnID         = ri.FindControl("hdnID") as HiddenField;
                        CheckBox     chkParentPage = ri.FindControl("chkParentPage") as CheckBox;
                        CheckBoxList cblPages      = ri.FindControl("cblPages") as CheckBoxList;

                        if (chkParentPage.Checked)
                        {
                            UserPage up = new UserPage
                            {
                                PageID    = int.Parse(hdnID.Value),
                                UserID    = userID,
                                IsAllowed = true
                            };
                            entity.UserPages.Add(up);
                            entity.SaveChanges();

                            foreach (ListItem item in cblPages.Items)
                            {
                                if (item.Selected)
                                {
                                    UserPage upc = new UserPage
                                    {
                                        PageID    = int.Parse(item.Value),
                                        UserID    = userID,
                                        IsAllowed = true
                                    };
                                    entity.UserPages.Add(upc);
                                    entity.SaveChanges();
                                }
                            }
                        }
                    }

                    Utils.ShowAlert(this, "User updated successfully.");
                    btnCancel_Click(null, null);
                    FillGrid();
                }
            }
        }
        catch (Exception)
        {
            DisplayMessage(@"Error while saving information.");
        }
    }
Example #14
0
 // Navigates to the user page
 private async void NavigateUser()
 {
     UserViewModel viewModel = new UserViewModel(this);
     UserPage      page      = new UserPage(viewModel);
     await Application.Current.MainPage.Navigation.PushAsync(page);
 }
Example #15
0
 public void ClassSetUp() =>
 userPage = new UserPage(fakeDriver, null);
Example #16
0
        private void TempClickUser(object sender, RoutedEventArgs e)
        {
            UserPage userPage = new UserPage();

            NavigationService.Navigate(userPage);
        }
Example #17
0
 public void WhenIClickTheEditUserLinkForUser(string userName)
 {
     _userPage = GetPage <UserPage>();
     _userPage.GetUserEditButton(userName).Click();
 }
Example #18
0
        /// <summary>
        /// 获取新的完整状态树
        /// </summary>
        /// <param name="state">当前 UI 状态</param>
        /// <param name="userManager"><see cref="KeylolUserManager"/></param>
        /// <param name="dbContext"><see cref="KeylolDbContext"/></param>
        /// <param name="coupon"><see cref="CouponProvider"/></param>
        /// <param name="cachedData"><see cref="CachedDataProvider"/></param>
        /// <param name="pointIdCode">据点识别码</param>
        /// <param name="authorIdCode">作者识别码</param>
        /// <param name="userIdCode">用户识别码</param>
        /// <param name="sidForAuthor">文章在作者名下的序号</param>
        /// <param name="keyword">搜索关键字</param>
        /// <returns>完整状态树</returns>
        public static async Task <Root> Locate(string state, [Injected] KeylolUserManager userManager,
                                               [Injected] KeylolDbContext dbContext, [Injected] CouponProvider coupon,
                                               [Injected] CachedDataProvider cachedData, string pointIdCode = null, string authorIdCode = null,
                                               string userIdCode = null, int sidForAuthor = 0, string keyword = null)
        {
            var root          = new Root();
            var currentUserId = StateTreeHelper.GetCurrentUserId();
            var isOperator    = StateTreeHelper.GetCurrentUser().IsInRole(KeylolRoles.Operator);

            if (await StateTreeHelper.CanAccessAsync <Root>(nameof(CurrentUser)))
            {
                var user = await userManager.FindByIdAsync(currentUserId);

                root.CurrentUser = await CurrentUser.CreateAsync(user, userManager, dbContext, coupon, cachedData);
            }

            switch (state)
            {
            case "entrance":
                root.Entrance = await EntranceLevel.CreateAsync(currentUserId,
                                                                States.Entrance.EntrancePage.Auto, dbContext, cachedData);

                break;

            case "entrance.discovery":
                root.Entrance = await EntranceLevel.CreateAsync(currentUserId,
                                                                States.Entrance.EntrancePage.Discovery, dbContext, cachedData);

                break;

            case "entrance.points":
                root.Entrance = await EntranceLevel.CreateAsync(currentUserId,
                                                                States.Entrance.EntrancePage.Points, dbContext, cachedData);

                break;

            case "entrance.timeline":
                root.Entrance = await EntranceLevel.CreateAsync(currentUserId,
                                                                States.Entrance.EntrancePage.Timeline, dbContext, cachedData);

                break;

            case "aggregation.point":
                root.Aggregation = new AggregationLevel
                {
                    Point = await PointLevel.CreateAsync(currentUserId, pointIdCode,
                                                         States.Aggregation.Point.EntrancePage.Auto, dbContext, cachedData)
                };
                break;

            case "aggregation.point.frontpage":
                root.Aggregation = new AggregationLevel
                {
                    Point = await PointLevel.CreateAsync(currentUserId, pointIdCode,
                                                         States.Aggregation.Point.EntrancePage.Frontpage, dbContext, cachedData)
                };
                break;

            case "aggregation.point.intel":
                root.Aggregation = new AggregationLevel
                {
                    Point = await PointLevel.CreateAsync(currentUserId, pointIdCode,
                                                         States.Aggregation.Point.EntrancePage.Intel, dbContext, cachedData)
                };
                break;

            case "aggregation.point.product":
                root.Aggregation = new AggregationLevel
                {
                    Point = await PointLevel.CreateAsync(currentUserId, pointIdCode,
                                                         States.Aggregation.Point.EntrancePage.Product, dbContext, cachedData)
                };
                break;

            case "aggregation.point.timeline":
                root.Aggregation = new AggregationLevel
                {
                    Point = await PointLevel.CreateAsync(currentUserId, pointIdCode,
                                                         States.Aggregation.Point.EntrancePage.Timeline, dbContext, cachedData)
                };
                break;

            case "aggregation.point.edit.info":
                root.Aggregation = new AggregationLevel
                {
                    Point = await PointLevel.CreateAsync(currentUserId, pointIdCode,
                                                         States.Aggregation.Point.EntrancePage.EditInfo, dbContext, cachedData)
                };
                break;

            case "aggregation.point.edit.style":
                root.Aggregation = new AggregationLevel
                {
                    Point = await PointLevel.CreateAsync(currentUserId, pointIdCode,
                                                         States.Aggregation.Point.EntrancePage.EditStyle, dbContext, cachedData)
                };
                break;

            case "aggregation.user":
                root.Aggregation = new AggregationLevel
                {
                    User = await UserLevel.CreateAsync(currentUserId, userIdCode, EntrancePage.Auto,
                                                       dbContext, cachedData, userManager)
                };
                break;

            case "aggregation.user.dossier":
                root.Aggregation = new AggregationLevel
                {
                    User = await UserLevel.CreateAsync(currentUserId, userIdCode, EntrancePage.Dossier,
                                                       dbContext, cachedData, userManager)
                };
                break;

            case "aggregation.user.people":
                root.Aggregation = new AggregationLevel
                {
                    User = await UserLevel.CreateAsync(currentUserId, userIdCode, EntrancePage.People,
                                                       dbContext, cachedData, userManager)
                };
                break;

            case "aggregation.user.timeline":
                root.Aggregation = new AggregationLevel
                {
                    User = await UserLevel.CreateAsync(currentUserId, userIdCode, EntrancePage.Timeline,
                                                       dbContext, cachedData, userManager)
                };
                break;

            case "aggregation.user.edit":
                root.Aggregation = new AggregationLevel
                {
                    User = await UserLevel.CreateAsync(currentUserId, userIdCode, EntrancePage.Edit,
                                                       dbContext, cachedData, userManager)
                };
                break;

            case "content.article":
                root.Content = new ContentLevel
                {
                    Article =
                        await
                        States.Content.Article.ArticlePage.CreateAsync(authorIdCode, sidForAuthor, currentUserId,
                                                                       isOperator, dbContext, cachedData, userManager)
                };
                break;

            case "content.activity":
                root.Content = new ContentLevel
                {
                    Activity = await ActivityPage.CreateAsync(authorIdCode, sidForAuthor, currentUserId,
                                                              isOperator, dbContext, cachedData, userManager)
                };
                break;

            case "post-office.unread":
                if (await StateTreeHelper.CanAccessAsync <Root>(nameof(PostOffice)))
                {
                    root.PostOffice = new PostOfficeLevel
                    {
                        Unread = await UnreadPage.CreateAsync(currentUserId, dbContext, cachedData)
                    }
                }
                ;
                break;

            case "post-office.social-activity.comment":
                if (await StateTreeHelper.CanAccessAsync <Root>(nameof(PostOffice)))
                {
                    root.PostOffice = new PostOfficeLevel
                    {
                        SocialActivity = new SocialActivityLevel
                        {
                            Comment = await CommentPage.CreateAsync(currentUserId, dbContext, cachedData)
                        }
                    }
                }
                ;
                break;

            case "post-office.social-activity.like":
                if (await StateTreeHelper.CanAccessAsync <Root>(nameof(PostOffice)))
                {
                    root.PostOffice = new PostOfficeLevel
                    {
                        SocialActivity = new SocialActivityLevel
                        {
                            Like = await LikePage.CreateAsync(currentUserId, dbContext, cachedData)
                        }
                    }
                }
                ;
                break;

            case "post-office.social-activity.subscriber":
                if (await StateTreeHelper.CanAccessAsync <Root>(nameof(PostOffice)))
                {
                    root.PostOffice = new PostOfficeLevel
                    {
                        SocialActivity = new SocialActivityLevel
                        {
                            Subscriber = await SubscriberPage.CreateAsync(currentUserId, dbContext, cachedData)
                        }
                    }
                }
                ;
                break;

            case "post-office.missive":
                if (await StateTreeHelper.CanAccessAsync <Root>(nameof(PostOffice)))
                {
                    root.PostOffice = new PostOfficeLevel
                    {
                        Missive = await MissivePage.CreateAsync(currentUserId, dbContext, cachedData)
                    }
                }
                ;
                break;

            case "coupon.detail":
                if (await StateTreeHelper.CanAccessAsync <Root>(nameof(Coupon)))
                {
                    root.Coupon = new CouponLevel
                    {
                        Detail = await DetailPage.CreateAsync(currentUserId, dbContext, userManager)
                    }
                }
                ;
                break;

            case "coupon.store":
                if (await StateTreeHelper.CanAccessAsync <Root>(nameof(Coupon)))
                {
                    root.Coupon = new CouponLevel
                    {
                        Store =
                            await StorePage.CreateAsync(currentUserId, dbContext, cachedData, userManager, coupon)
                    }
                }
                ;
                break;

            case "coupon.ranking":
                if (await StateTreeHelper.CanAccessAsync <Root>(nameof(Coupon)))
                {
                    root.Coupon = new CouponLevel
                    {
                        Ranking = await RankingPage.CreateAsync(currentUserId, dbContext, cachedData)
                    }
                }
                ;
                break;

            case "search.point":
                root.Search = new SearchLevel
                {
                    Point = await PointPage.CreateAsync(currentUserId, keyword, dbContext, cachedData)
                };
                break;

            case "search.article":
                root.Search = new SearchLevel
                {
                    Article = await ArticlePage.CreateAsync(keyword, dbContext, cachedData)
                };
                break;

            case "search.user":
                root.Search = new SearchLevel
                {
                    User = await UserPage.CreateAsync(currentUserId, keyword, dbContext, cachedData)
                };
                break;

            default:
                throw new NotSupportedException("Not supported state.");
            }
            return(root);
        }
Example #19
0
 public static int Insert(UserPage userpage)
 {
     return(iuserpage.Insert(userpage));
 }
        protected override void OnBindingContextChanged()
        {
            base.OnBindingContextChanged();

            // BindingContext
            var vm = BindingContext as SignUpViewModel;

            if (vm == null)
            {
                return;
            }

            // Credentials Card
            var credentialCard = new CredentialPage();

            credentialCard.BindingContext = vm.CredentialViewModel;
            _cards.Add(credentialCard);

            // Account Card
            var accountPage = new AccountPage();

            accountPage.BindingContext = vm.AccountViewModel;
            _cards.Add(accountPage);

            // Genre selection Card
            var genreCard = new GenrePage();

            genreCard.BindingContext = vm.GenreViewModel;
            _cards.Add(genreCard);

            // User data Card
            var userCard = new UserPage();

            userCard.BindingContext = vm.UserViewModel;
            _cards.Add(userCard);

            // Subscription data Card
            var subscriptionCard = new SubscriptionPage();

            subscriptionCard.BindingContext = vm.SubscriptionViewModel;
            _cards.Add(subscriptionCard);

            for (int i = 0; i < NumCards; i++)
            {
                var card = _cards[i];

                CardStackView.Children.Add(
                    card,
                    Constraint.Constant(0),
                    Constraint.Constant(0),
                    Constraint.RelativeToParent((parent) =>
                {
                    return(parent.Width);
                }),
                    Constraint.RelativeToParent((parent) =>
                {
                    return(parent.Height);
                })
                    );
            }

            // Init
            InitializeCards();
        }
        public void ThenNumeHeaderIsDisplayed()
        {
            UserPage userPage = new UserPage(Driver);

            Assert.IsTrue(userPage.NumeHeader.Displayed);
        }
Example #22
0
        protected void Button1_ServerClick1(object sender, EventArgs e)
        {
            //获取考卷ID
            int KaoJuanId  = int.Parse(Request.QueryString["id"].ToString());
            int sum        = 0;                                                                //初始化对的信息 默认为0个
            int Score      = 0;                                                                //初始化分数的信息 默认为0分
            int singlemark = int.Parse(((Label)GridView1.Rows[0].FindControl("Label4")).Text); //每一道单选题的分数

            foreach (GridViewRow dr in GridView1.Rows)

            //遍历每一行的数据
            {
                string str = "";
                if (((RadioButton)dr.FindControl("RadioButton1")).Checked)
                {
                    str = "A";
                }
                else if (((RadioButton)dr.FindControl("RadioButton2")).Checked)
                {
                    str = "B";
                }
                else if (((RadioButton)dr.FindControl("RadioButton3")).Checked)
                {
                    str = "C";
                }
                else if (((RadioButton)dr.FindControl("RadioButton4")).Checked)
                {
                    str = "D";
                }
                //逐个 判断 某一个单选框是否选中 即  选择的答案 ABCD  哪一个
                if (((Label)dr.FindControl("Label3")).Text.Trim() == str)
                //用户选择的答案 和正确答案 对比
                {
                    sum   = sum + 1;
                    Score = Score + singlemark;
                    //分数 增加
                    string   title = ((Label)dr.FindControl("Label2")).Text.Trim();
                    int      fid   = int.Parse(((Label)dr.FindControl("Label111")).Text.Trim());
                    UserPage up    = new UserPage();
                    up.Fid       = fid;
                    up.Title     = title;
                    up.UserID    = int.Parse(Session["UserID"].ToString());
                    up.KaoJuanID = KaoJuanId;
                    up.UserAns   = str;
                    UserPageService.Insert(up);
                    //将信息再插入到 用户试卷题目表里
                }
                else
                {
                    string   title = ((Label)dr.FindControl("Label2")).Text.Trim();
                    int      fid   = int.Parse(((Label)dr.FindControl("Label111")).Text.Trim());
                    UserPage up    = new UserPage();
                    up.Fid       = fid;
                    up.Title     = title;
                    up.UserID    = int.Parse(Session["UserID"].ToString());
                    up.KaoJuanID = KaoJuanId;
                    up.UserAns   = str;
                    UserPageService.Insert(up);
                    Mistakes Mt = new Mistakes();
                    Mt.UserID  = int.Parse(Session["UserID"].ToString());
                    Mt.ObID    = fid;
                    Mt.MisTime = DateTime.Now;
                    MistakesService.Insert(Mt);
                    //将信息再插入到 用户试卷题目表和错题表里
                }
                int id = int.Parse(Request.QueryString["id"].ToString());
                Session["KaoshiID"] = id;
                string UserName = Session["UserName"].ToString();
                //插入到 分数表 和 学生考试表
                Score sc = new Score();
                sc.UserID    = int.Parse(Session["UserID"].ToString());
                sc.KaoJuanID = id;
                sc.Scores    = Score;
                sc.UserName  = UserName;
                sc.Sum       = sum;
                int    j  = ScoreService.Insert(sc);
                KaoShi ks = new KaoShi();
                ks.PageID = id;
                ks.UserID = int.Parse(Session["UserID"].ToString());
                int i = KaoShiService.Insert(ks);
                if (i >= 1 && j >= 1)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "true", "<script>alert('答题成功!查看成绩!!');location='ExamResult.aspx'</script>");
                }
            }
        }
        public void ThenUserRoleIsDisplayed()
        {
            UserPage userPage = new UserPage(Driver);

            Assert.IsTrue(userPage.UserRole.Displayed);
        }
Example #24
0
        protected void rptUserPageMenu_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            this.pnlAddPage.Visible    = false;
            this.pnlChangeName.Visible = false;

            String argString  = e.CommandArgument.ToString();
            Guid   userPageID = Guid.Empty;

            if (argString.Length == 36)
            {
                userPageID        = new Guid(argString);
                CurrentUserPageId = userPageID;
            }
            switch (e.CommandName)
            {
            case "selectpage":
                // CPersonalizationProvider will adjust the path variable
                // based on cookie to retrieve personalizarion
                // for the correct user page
                if (argString.Length > 0)
                {
                    CookieHelper.SetPersistentCookie(userPageCookie, argString);
                }
                WebUtils.SetupRedirect(this, SiteRoot + Request.RawUrl);
                break;

            case "changename":
                if (userPageID != Guid.Empty)
                {
                    this.pnlChangeName.Visible = true;
                    UserPage userPage = new UserPage(userPageID);
                    this.txtCurrentPageName.Text = userPage.PageName;
                }

                break;

            case "moveright":
                if (userPageID != Guid.Empty)
                {
                    UserPage userPage = new UserPage(userPageID);
                    userPage.MoveDown();
                }
                WebUtils.SetupRedirect(this, SiteRoot + Request.RawUrl);
                break;

            case "moveleft":
                if (userPageID != Guid.Empty)
                {
                    UserPage userPage = new UserPage(userPageID);
                    userPage.MoveUp();
                }
                WebUtils.SetupRedirect(this, SiteRoot + Request.RawUrl);
                break;

            case "remove":
                if (userPageID != Guid.Empty)
                {
                    UserPage.DeleteUserPage(userPageID);
                }
                WebUtils.SetupRedirect(this, SiteRoot + Request.RawUrl);
                break;

            case "addpage":
                this.pnlAddPage.Visible = true;

                break;
            }
        }
Example #25
0
        private async Task InnerAddPageAsync(UserPage page)
        {
            await _db.Pages.AddAsync(page);

            await _db.SaveChangesAsync();
        }
Example #26
0
 public void ThenTheUserShouldHaveALinkToEditTheUser(string displayName)
 {
     Assert.IsTrue(UserPage.GetUserEditButton(displayName).Exists);
 }
Example #27
0
        /// <summary>
        /// Handles the Click event of the btnGetUsers control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="eventArgs">The <see cref="System.EventArgs"/> instance containing
        /// the event data.</param>
        protected void OnGetUsersButtonClick(object sender, EventArgs eventArgs)
        {
            ConfigureUserForOAuth();

            try
            {
                // Get the UserService.
                UserService userService = user.GetService <UserService>();

                // Create a Statement to get all users.
                StatementBuilder statementBuilder = new StatementBuilder().OrderBy("id ASC")
                                                    .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

                // Set default for page.
                UserPage page = new UserPage();

                DataTable dataTable = new DataTable();
                dataTable.Columns.AddRange(new DataColumn[]
                {
                    new DataColumn("Serial No.", typeof(int)),
                    new DataColumn("User Id", typeof(long)),
                    new DataColumn("Email", typeof(string)),
                    new DataColumn("Role", typeof(string))
                });
                do
                {
                    // Get users by Statement.
                    page = userService.getUsersByStatement(statementBuilder.ToStatement());

                    if (page.results != null && page.results.Length > 0)
                    {
                        int i = page.startIndex;
                        foreach (User usr in page.results)
                        {
                            DataRow dataRow = dataTable.NewRow();
                            dataRow.ItemArray = new object[]
                            {
                                i + 1,
                                usr.id,
                                usr.email,
                                usr.roleName
                            };
                            dataTable.Rows.Add(dataRow);
                            i++;
                        }
                    }

                    statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
                } while (statementBuilder.GetOffset() < page.totalResultSetSize);

                if (dataTable.Rows.Count > 0)
                {
                    UserGrid.DataSource = dataTable;
                    UserGrid.DataBind();
                }
                else
                {
                    Response.Write("No users were found.");
                }
            }
            catch (Exception e)
            {
                Response.Write(string.Format("Failed to get users. Exception says \"{0}\"",
                                             e.Message));
            }
        }
Example #28
0
 public void ThenTheUserShouldNotHaveALinkToEditTheSecurityRoles(string displayName)
 {
     Assert.IsFalse(UserPage.GetUserRolesButton(displayName).Exists);
 }
Example #29
0
 public App()
 {
     MainPage = new UserPage ();
 }
Example #30
0
        /// <summary>
        /// Run the code example.
        /// </summary>
        public void Run(DfpUser user)
        {
            using (UserService userService =
                       (UserService)user.GetService(DfpService.v201802.UserService))
            {
                // Set the ID of the user to deactivate
                long userId = long.Parse(_T("INSERT_USER_ID_HERE"));

                // Create statement text to select user by id.
                StatementBuilder statementBuilder = new StatementBuilder()
                                                    .Where("id = :userId")
                                                    .OrderBy("id ASC")
                                                    .Limit(1)
                                                    .AddValue("userId", userId);

                // Sets default for page.
                UserPage      page    = new UserPage();
                List <string> userIds = new List <string>();

                try
                {
                    do
                    {
                        // Get users by statement.
                        page = userService.getUsersByStatement(statementBuilder.ToStatement());

                        if (page.results != null)
                        {
                            int i = page.startIndex;
                            foreach (User userResult in page.results)
                            {
                                Console.WriteLine(
                                    "{0}) User with ID = '{1}', email = '{2}', and status = '{3}'" +
                                    " will be deactivated.", i, userResult.id, userResult.email,
                                    userResult.isActive ? "ACTIVE" : "INACTIVE");
                                userIds.Add(userResult.id.ToString());
                                i++;
                            }
                        }

                        statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
                    } while (statementBuilder.GetOffset() < page.totalResultSetSize);

                    Console.WriteLine("Number of users to be deactivated: {0}",
                                      page.totalResultSetSize);

                    if (userIds.Count > 0)
                    {
                        // Modify statement for action.
                        statementBuilder.RemoveLimitAndOffset();

                        // Create action.
                        DeactivateUsers action = new DeactivateUsers();

                        // Perform action.
                        UpdateResult result =
                            userService.performUserAction(action, statementBuilder.ToStatement());

                        // Display results.
                        if (result != null && result.numChanges > 0)
                        {
                            Console.WriteLine(
                                "Number of users deactivated: {0}" + result.numChanges);
                        }
                        else
                        {
                            Console.WriteLine("No users were deactivated.");
                        }
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("Failed to deactivate users. Exception says \"{0}\"",
                                      e.Message);
                }
            }
        }
        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The DFP user object running the code example.</param>
        public override void Run(DfpUser user)
        {
            // Get the UserService.
            UserService userService = (UserService)user.GetService(DfpService.v201311.UserService);

            // Set the ID of the user to deactivate
            long userId = long.Parse(_T("INSERT_USER_ID_HERE"));

            // Create Statement text to select user by id.
            string    statementText = "WHERE id = :userId LIMIT 500";
            Statement statement     = new StatementBuilder("").AddValue("userId", userId).ToStatement();

            // Sets defaults for page and offset.
            UserPage      page    = new UserPage();
            int           offset  = 0;
            List <string> userIds = new List <string>();

            try {
                do
                {
                    // Create a Statement to page through users.
                    statement.query = string.Format("{0} OFFSET {1}", statementText, offset);

                    // Get users by Statement.
                    page = userService.getUsersByStatement(statement);

                    if (page.results != null && page.results.Length > 0)
                    {
                        int i = page.startIndex;
                        foreach (User userResult in page.results)
                        {
                            Console.WriteLine("{0}) User with ID = '{1}', email = '{2}', and status = '{3}'" +
                                              " will be deactivated.", i, userResult.id, userResult.email,
                                              userResult.isActive ? "ACTIVE" : "INACTIVE");
                            userIds.Add(userResult.id.ToString());
                            i++;
                        }
                    }

                    offset += 500;
                } while (offset < page.totalResultSetSize);

                Console.WriteLine("Number of users to be deactivated: {0}", page.totalResultSetSize);

                if (userIds.Count > 0)
                {
                    // Create action Statement.
                    statement = new StatementBuilder(
                        string.Format("WHERE id IN ({0})", string.Join(",", userIds.ToArray()))).
                                ToStatement();

                    // Create action.
                    DeactivateUsers action = new DeactivateUsers();

                    // Perform action.
                    UpdateResult result = userService.performUserAction(action, statement);

                    // Display results.
                    if (result != null && result.numChanges > 0)
                    {
                        Console.WriteLine("Number of users deactivated: {0}" + result.numChanges);
                    }
                    else
                    {
                        Console.WriteLine("No users were deactivated.");
                    }
                }
            } catch (Exception ex) {
                Console.WriteLine("Failed to deactivate users. Exception says \"{0}\"",
                                  ex.Message);
            }
        }
Example #32
0
 public ProtractorApplication(IWebDriver driver)
 {
     userPage = new UserPage(driver);
 }
Example #33
0
        private void btnUserPage_Click(object sender, RoutedEventArgs e)
        {
            UserPage userPage = new UserPage();

            this.NavigationService.Navigate(userPage);
        }
    /// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="user">The DFP user object running the code example.</param>
    public override void Run(DfpUser user) {
      // Get the UserService.
      UserService userService = (UserService) user.GetService(DfpService.v201508.UserService);

      // Set the ID of the user to deactivate
      long userId = long.Parse(_T("INSERT_USER_ID_HERE"));

      // Create statement text to select user by id.
      StatementBuilder statementBuilder = new StatementBuilder()
          .Where("id = :userId")
          .OrderBy("id ASC")
          .Limit(1)
          .AddValue("userId", userId);

      // Sets default for page.
      UserPage page = new UserPage();
      List<string> userIds = new List<string>();

      try {
        do {
          // Get users by statement.
          page = userService.getUsersByStatement(statementBuilder.ToStatement());

          if (page.results != null && page.results.Length > 0) {
            int i = page.startIndex;
            foreach (User userResult in page.results) {
              Console.WriteLine("{0}) User with ID = '{1}', email = '{2}', and status = '{3}'" +
                 " will be deactivated.", i, userResult.id, userResult.email,
                 userResult.isActive ? "ACTIVE" : "INACTIVE");
              userIds.Add(userResult.id.ToString());
              i++;
            }
          }

          statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
        } while (statementBuilder.GetOffset() < page.totalResultSetSize);

        Console.WriteLine("Number of users to be deactivated: {0}", page.totalResultSetSize);

        if (userIds.Count > 0) {
          // Modify statement for action.
          statementBuilder.RemoveLimitAndOffset();

          // Create action.
          DeactivateUsers action = new DeactivateUsers();

          // Perform action.
          UpdateResult result = userService.performUserAction(action,
              statementBuilder.ToStatement());

          // Display results.
          if (result != null && result.numChanges > 0) {
            Console.WriteLine("Number of users deactivated: {0}" + result.numChanges);
          } else {
            Console.WriteLine("No users were deactivated.");
          }
        }
      } catch (Exception e) {
        Console.WriteLine("Failed to deactivate users. Exception says \"{0}\"",
            e.Message);
      }
    }
        public UtilisateurViewModel()
        {
            Item         = new utilisateur();
            GetUserExist = new DelegateCommand(
                async() =>
            {
                if (!string.IsNullOrWhiteSpace(Mail) && !string.IsNullOrWhiteSpace(MotPasse))
                {
                    utilisateur response = await Helpers.UtilisateurService.GetUser(Mail, MotPasse);
                    if (response.IdUser != 0)
                    {
                        var trajet = new TrajetPage(new TrajetViewModel()
                        {
                            Item = new trajet()
                        }, new UtilisateurViewModel()
                        {
                            Item = response
                        });
                        NavigationPage.SetHasBackButton(trajet, false);
                        NavigationPage.SetHasNavigationBar(trajet, true);
                        Application.Current.Properties["email"]    = this.Mail;
                        Application.Current.Properties["password"] = this.MotPasse;
                        await Application.Current.MainPage.Navigation.PushAsync(trajet);
                    }
                    else
                    {
                        await Application.Current.MainPage.DisplayAlert("Erreur", "Email ou mot de passe incorrect", "OK");
                        return;
                    }
                }
                else
                {
                    await Application.Current.MainPage.DisplayAlert("Erreur", "Veuillez rentrer votre email ou mot de passe", "OK");

                    return;
                }
            });

            CreateUser = new DelegateCommand(
                async() =>
            {
                var response = await Helpers.UtilisateurService.PostUserAsync(Item);
                if (response == true)
                {
                    await Application.Current.MainPage.DisplayAlert("Succès", "Utilisateur créer", "OK");
                    return;
                }
                else
                {
                    await Application.Current.MainPage.DisplayAlert("Erreur", "Problème lors de la création de l'utilisateur", "OK");
                    return;
                }
            });
            GoToInscription = new DelegateCommand(
                async() =>
            {
                var inscription = new RegisterPage(new UtilisateurViewModel()
                {
                    Item = Item
                });
                NavigationPage.SetHasBackButton(inscription, true);
                NavigationPage.SetHasNavigationBar(inscription, true);
                await Application.Current.MainPage.Navigation.PushAsync(inscription);
            });
            GoToReservation = new DelegateCommand(
                async() =>
            {
                var reservation = new ReservePage(this);
                NavigationPage.SetHasBackButton(reservation, true);
                NavigationPage.SetHasNavigationBar(reservation, true);
                await Application.Current.MainPage.Navigation.PushAsync(reservation);
            });
            GoToProfile = new DelegateCommand(
                async() =>
            {
                var profile = new UserPage(this);
                NavigationPage.SetHasBackButton(profile, true);
                NavigationPage.SetHasNavigationBar(profile, true);
                await Application.Current.MainPage.Navigation.PushAsync(profile);
            });
            DeleteReservation = new DelegateCommand <reserve>(
                (reserve) =>
            {
            });
        }