Exemple #1
0
        public void GivenIHaveCreatedANewRepeatingInvoice()
        {
            WebBrowser.Current.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(10));
            WebBrowser.Current.Navigate().GoToUrl("https://login.xero.com/");
            driver    = WebBrowser.Current;
            loginPage = new LoginPage(driver);
            PageFactory.InitElements(driver, loginPage);
            loginPage.SetEmail("*****@*****.**");
            loginPage.SetPassword("123Xero1");
            DashBoardPage dashBoard = loginPage.ClickSave();

            dashBoard = dashBoard.topToolBar.clickDashboard();
            SalesPage salesPage = dashBoard.clickOnGoToSalesLink();

            invoicePage             = salesPage.clickOnRepeating();
            nrOfInvoices            = invoicePage.nrOfInvoices();
            newRepeatingInvoicePage = invoicePage.clickNewRepeatingInvoice();
        }
Exemple #2
0
        private async Task OnItemSelected(MenuItemModel item)
        {
            if (item == null)
            {
                return;
            }
            if (item.IsSeparator)
            {
                SelectedItem = null;
                return;
            }
            if (item.IsWebLink)
            {
                await Launcher.OpenAsync(new Uri(item.Link));

                SelectedItem = null;
                MessengerInstance.Send(new MenuItemSelectedMessage());
                return;
            }
            //Logout
            if (item.TargetType == typeof(LoginPage))
            {
                App.Current.MainPage = new NavigationPage(new LoginPage());
                return;
            }
            if (item.Id == 16)//When in pipeline or portal super user mode return
            {
                try
                {
                    if (IsBusy)
                    {
                        return;
                    }
                    IsBusy = true;
                    var settings = SettingsService.Instance;
                    settings.AxCustomerId            = settings.MasterAxCustomerId;
                    settings.Token                   = settings.MasterToken;
                    settings.TokenExpiration         = settings.MasterTokenExpiration;
                    settings.IsImpersonatingCustomer = false;
                    var infoResult = await ApiService.Instance.GetMyInfo(Api.GetCustomerContext());

                    if (infoResult.Data == null)
                    {
                        await Alert.ShowMessage(Translate.Get(nameof(AppResources.CouldNotReceiveInformationFromServer)));

                        return;
                    }
                    Settings.MyPreferences = infoResult.Data.AppPreferences;
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        Page mainPage = null;
                        Messenger.Reset();
                        mainPage             = new NavigationPage(new MasterDetailPage1(MainPageMode.OpenInPipelineAccounts));
                        App.Current.MainPage = mainPage;
                    }
                                                   );
                    return;
                }
                catch (Exception e)
                {
                    await Alert.DisplayError(e);
                }
                finally
                {
                    IsBusy = false;
                }
            }

            if (item.Id == 116)//When in pipeline or portal super user mode return
            {
                try
                {
                    if (IsBusy)
                    {
                        return;
                    }
                    IsBusy = true;
                    var settings = SettingsService.Instance;
                    settings.AxCustomerId            = settings.MasterAxCustomerId;
                    settings.Token                   = settings.MasterToken;
                    settings.TokenExpiration         = settings.MasterTokenExpiration;
                    settings.IsImpersonatingCustomer = false;
                    var infoResult = await ApiService.Instance.GetMyInfo(Api.GetCustomerContext());

                    if (infoResult.Data == null)
                    {
                        await Alert.ShowMessage(Translate.Get(nameof(AppResources.CouldNotReceiveInformationFromServer)));

                        return;
                    }
                    Settings.MyPreferences = infoResult.Data.AppPreferences;
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        Page mainPage = null;
                        Messenger.Reset();
                        mainPage             = new NavigationPage(new MasterDetailPage1(MainPageMode.PortalSuperUser));
                        App.Current.MainPage = mainPage;
                    }
                                                   );
                    return;
                }
                catch (Exception e)
                {
                    await Alert.DisplayError(e);
                }
                finally
                {
                    IsBusy = false;
                }
            }
            Page page;

            if (item.Id == 3 || item.Id == 30)
            {
                page = new InvoicesPage
                {
                    InvoicePageDefaultMode = (InvoicePageDefaultMode)item.Tag
                };
                page.Title = $"Invoices - {item.Title}";
            }
            else if (item.Id == 9999)
            {
                page = new InvoicePaymentPage(item.Tag as List <InvoiceModel>, PaymentRequest.FullPayment);
            }
            else
            {
                page       = (Page)Activator.CreateInstance(item.TargetType);
                page.Title = item.Title;
            }

            MessengerInstance.Send(new MenuItemSelectedMessage
            {
                Page = new NavigationPage(page)
            });
            SelectedItem = null;
        }
Exemple #3
0
    /// <summary>
    /// Every application in Starcounter works like a console application. They have an .EXE ending. They have a Main() function and
    /// they can do console output. However, they are run inside the scope of a database rather than connecting to it.
    /// </summary>
    static void Main()
    {
        // Handle.POST("/init-demo-data", () => {      // The Handle class is where you register new handlers for incomming requests.
        //     DemoData.Create();                      // Will create some demo data.
        //     return 201;                             // Returning an integer is the shortcut for returning a response with a status code.
        // });

        // Handle.GET("/master", () =>
        // {
        //     Master m = new Master()
        //     {                                       // This is the root view model for our application. A view model is a JSON object/tree.
        //         Html = "/master.html",              // This is just a field we added to allow the client to know what Html to load. No magic.
        //     };
        //     m.Session = new Session();              // Save the JSON on the server to be accessed using GET/PATCH to allow it to be used as a view model in web components.
        //     return m;                               // Return the JSON or the HTML depending on the type asked for. See Page.json on how Starcounter knowns what to return.
        // });

        // Handle.GET("/", () => {                     // The root page of our website.
        //     return PrimaryApp.GET("/primary");      // Redirecting root to Tab 1
        // });

        // Handle.GET("/primary", () =>                // The main screen of the app
        // {
        //     var m = Master.GET("/master");          // Create the view model for the main application frame.
        //     PrimaryApp p = new PrimaryApp();        // The email application also consists of a view model.
        //     p.Html = "/primary.html";               // Starcounter is a generic server and does not know of Html, so this is a variable we create in Page.json
        //     p.AddSomeNiceMenuItems(m);              // Adds some menu items in the main menu (by modifying the master view model)
        //     m.ApplicationPage = p;                  // Place the email applications view model inside the main application frame as its subpage.
        //     m.TabName = "My Form";            // Used to highlight the current tab in the client
        //     return p;                               // Returns the home page. As you can see in Page.json, we taught it how to serve both HTML and the JSON view model without any extra work.
        // });

        // Handle.GET("/primary/create", () =>
        // {
        //     var p = PrimaryApp.GET("/primary");
        //     p.FocusedPage = new PrimaryPage()
        //     {
        //         Html = "/primary-create.html"
        //     };
        //     return p;
        // });

        // Polyjuice hadlers
        // Note that all handlers could be mapped so serve content for different URLs

        // Dashboard
        // Usually brief summary, or basic feature to be shown on a main screen.
        /*Handle.GET("/dashboard", () =>
        {
            var page = new DashboardPage()
            {
                //Html = "/dashboard.html" // will fail as other app does also use `/dashboard.html`
                Html = "/boilerplate-dashboard.html"
            };

            var ingredients = SQL<PolyjuiceBoilerplate.Ingredient>("SELECT i FROM PolyjuiceBoilerplate.Ingredient i");
            page.Ingredients.Data = ingredients;

            page.Transaction = new Transaction();
            return page;
        });*/

        // Menu
        // Launcher navigation menu
        Handle.GET("/menu", () =>
        {
            var p = new Page()
            {
                Html = "/billing-menu.html"
            };
            return p;
        });

        Handle.GET("/billing/vendables", () =>
        {
            var page = new VentablesPage()
            {
                Html = "/billing-vendables.html"
            };
            page.Transaction = new Transaction();
            //page.Session = Session.Current;

            var vendables = SQL<Billing.Vendable>("SELECT v FROM Billing.Vendable v");
            page.Vendables.Data = vendables;

            return page;
        });

        Handle.GET("/billing/offers", () =>
        {
            var page = new OffersPage()
            {
                Html = "/billing-offers.html"
            };
            page.Transaction = new Transaction();
            //page.Session = Session.Current;

            var offers = SQL<Billing.Offer>("SELECT o FROM Billing.Offer o");
            page.Offers.Data = offers;

            var vendables = SQL<Billing.Vendable>("SELECT v FROM Billing.Vendable v");
            page.Vendables.Data = vendables;

            return page;
        });

        Handle.GET("/billing/buy", () =>
        {
            var page = new BuyPage()
            {
                Html = "/billing-buy.html"
            };
            page.Transaction = new Transaction();
            //page.Session = Session.Current;

            var offers = SQL<Billing.Offer>("SELECT o FROM Billing.Offer o");
            page.Offers.Data = offers;

            return page;
        });

        Handle.GET("/billing/orders", () =>
        {
            var page = new OrdersPage()
            {
                Html = "/billing-orders.html"
            };
            page.Transaction = new Transaction();
            //page.Session = Session.Current;

            var orders = SQL<Billing.Order>("SELECT o FROM \"Billing.Order\" o WHERE invoice IS NULL");
            page.Orders.Data = orders;

            return page;
        });

        Handle.GET("/billing/invoices", () =>
        {
            var page = new InvoicesPage()
            {
                Html = "/billing-invoices.html"
            };
            page.Transaction = new Transaction();
            //page.Session = Session.Current;

            var invoices = SQL<Billing.Invoice>("SELECT i FROM Billing.Invoice i ORDER BY \"DateTime\" DESC");
            page.Invoices.Data = invoices;

            return page;
        });

        Handle.GET("/billing/invoices/{?}", (string ObjectID) =>
        {
            var page = new InvoicePage()
            {
                Html = "/billing-invoice.html"
            };
            page.Transaction = new Transaction();
            //page.Session = Session.Current;

            var invoice = SQL<Billing.Invoice>("SELECT i FROM Billing.Invoice i WHERE ObjectID = ?", ObjectID);
            page.Invoice.Data = invoice.First;

            return page;
        });
    }
Exemple #4
0
 public void WhenIPressSave()
 {
     invoicePage = newRepeatingInvoicePage.clickSave();
 }