Beispiel #1
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="navigationParameter">The parameter value passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested.
        /// </param>
        /// <param name="pageState">A dictionary of state preserved by this page during an earlier
        /// session.  This will be null the first time a page is visited.</param>
        protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            // set month selection resource
            this.DefaultViewModel["MonthSelectionItems"] = DataCore.GetInstance().MonthsAdp.Items;
            // set reports selection resource
            this.DefaultViewModel["ReportsSelectionItems"] = DataCore.GetInstance().ReportsTypeAdp.Items;

            // load balance data
            this.setBalanceData();
        }
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            MonthItem item = e.Parameter as MonthItem;

            if (item == null)
            {
                return;
            }
            this.ItemGridView.ItemsSource = DataCore.GetInstance().CostAdp
                                            .GetItems(item.MonthId);
        }
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected async override void OnLaunched(LaunchActivatedEventArgs args)
        {
            // initialize data
            DataCore dataCore = DataCore.GetInstance();
            await dataCore.InitializeAsync();

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
Beispiel #4
0
        /// <summary>
        /// set balance data
        /// </summary>
        private void setBalanceData()
        {
            // int index = MonthSelection.SelectedIndex;
            MonthItem monthItem = MonthSelection.SelectedItem as MonthItem;

            if (monthItem == null)
            {
                return;
            }
            CoreDriver coreDriver = DataCore.GetInstance().BackendCoreDriver;

            if (coreDriver.IsInitialize == false)
            {
                return;
            }

            TransactionDataManagement  transMgmt = coreDriver.TransMgmt;
            GLAccountBalanceCollection balCol    = transMgmt.AccountBalanceCol;

            #region revenue
            CurrencyAmount revenue = new CurrencyAmount();
            foreach (GLAccountGroupENUM group in GLAccountGroup.REVENUE_GROUP)
            {
                CurrencyAmount cur = balCol
                                     .GetGroupBalance(group, monthItem.MonthId, monthItem.MonthId);
                cur.Negate();
                revenue.AddTo(cur);
            }
            // set value
            incomingAmount.Text = revenue.ToString();
            #endregion

            #region cost
            CurrencyAmount cost = new CurrencyAmount();
            foreach (GLAccountGroupENUM group in GLAccountGroup.COST_GROUP)
            {
                CurrencyAmount cur = balCol
                                     .GetGroupBalance(group, monthItem.MonthId, monthItem.MonthId);
                cost.AddTo(cur);
            }
            // set value
            this.outgoingAmount.Text = cost.ToString();
            #endregion

            #region balance
            CurrencyAmount balance = new CurrencyAmount();
            foreach (GLAccountGroupENUM group in GLAccountGroup.BALANCE_GROUP)
            {
                CurrencyAmount cur = balCol
                                     .GetGroupBalance(group);
                balance.AddTo(cur);
            }
            // set value
            this.balanceAmount.Text = balance.ToString();
            #endregion

            #region liquidity
            CurrencyAmount liquidity = new CurrencyAmount();
            foreach (GLAccountGroupENUM group in GLAccountGroup.Liquidity_GROUP)
            {
                CurrencyAmount cur = balCol
                                     .GetGroupBalance(group);
                liquidity.AddTo(cur);
            }
            // set value
            this.liquidityAmount.Text = liquidity.ToString();
            #endregion
        }