Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this._authenticationData = GetAuthenticationDataAndCulture();
            this._year = DateTime.Today.Year;

            if (
                !this._authenticationData.CurrentUser.HasAccess(new Access(
                                                                    this._authenticationData.CurrentOrganization, AccessAspect.Bookkeeping, AccessType.Read)))
            {
                throw new UnauthorizedAccessException();
            }

            // TODO: Get and cache account tree and account balances

            Response.ContentType = "application/json";

            string response = string.Empty;

            PopulateLookups(FinancialAccounts.ForOrganization(this._authenticationData.CurrentOrganization));
            this._hashedAccounts  = FinancialAccounts.GetHashedAccounts(this._authenticationData.CurrentOrganization);
            this._resultAccountId = this._authenticationData.CurrentOrganization.FinancialAccounts.CostsYearlyResult.Identity;

            response += GetAccountGroup(FinancialAccountType.Asset, Resources.Global.Financial_Asset) + ",";
            response += GetAccountGroup(FinancialAccountType.Debt, Resources.Global.Financial_Debt) + ",";
            response +=
                GetAccountGroup(FinancialAccountType.Income, Resources.Global.Financial_Income) + ",";
            response += GetAccountGroup(FinancialAccountType.Cost, Resources.Global.Financial_Cost);

            Response.Output.WriteLine("[" + response + "]");
            Response.End();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            _authenticationData = GetAuthenticationDataAndCulture();
            _year = DateTime.Today.Year;

            if (!_authenticationData.CurrentUser.HasAccess(new Access(_authenticationData.CurrentOrganization, AccessAspect.Bookkeeping, AccessType.Read)))
            {
                throw new UnauthorizedAccessException();
            }

            // TODO: Get and cache account tree and account balances

            Response.ContentType = "application/json";

            string response = string.Empty;

            PopulateLookups(FinancialAccounts.ForOrganization(_authenticationData.CurrentOrganization));
            _hashedAccounts = FinancialAccounts.GetHashedAccounts(_authenticationData.CurrentOrganization);

            response += GetAccountGroup(FinancialAccountType.Asset, Resources.Pages.Ledgers.BalanceSheet_Assets) + ",";
            response += GetAccountGroup(FinancialAccountType.Debt, Resources.Pages.Ledgers.BalanceSheet_Debt) + ",";
            response += GetAccountGroup(FinancialAccountType.Income, Resources.Pages.Ledgers.ProfitLossStatement_Income) + ",";
            response += GetAccountGroup(FinancialAccountType.Cost, Resources.Pages.Ledgers.ProfitLossStatement_Costs);

            Response.Output.WriteLine("[" + response + "]");
            Response.End();
        }