Exemple #1
0
        /// <summary>
        /// Adds an operation to the selected account
        /// </summary>
        /// <param name="selectedAccount">The selected account</param>
        public void AddOperation(string selectedAccount)
        {
            ModifyingColumns = true;

            int addedRowIndex = RowCount - 2;
            int accountCol    = 0;

            while (!AccountNames.ElementAt(accountCol++).Equals(selectedAccount))
            {
                ;                                                                   // Take the index of the AccountName + 1 (because the accounts begin on the second column)
            }
            // Move the two last rows down
            foreach (AbstractCase c in this.Where(c => c.Row >= addedRowIndex))
            {
                c.Row++;
            }

            // Add date case
            Add(new DateCase()
            {
                Row = addedRowIndex, Column = 0, Date = DateTime.Now
            });

            // Add amount case
            Add(new AmountCase()
            {
                Row = addedRowIndex, Column = accountCol, Amount = 0.0M
            });

            // Add Gray cases (for not selected accounts)
            for (int col = 1; col < ColumnCount - 2; ++col)
            {
                if (col != accountCol)
                {
                    Add(new GrayUnaccessibleCase()
                    {
                        Row = addedRowIndex, Column = col
                    });
                }
            }

            // Add Okay case
            Add(new OkayCase()
            {
                Row = addedRowIndex, Column = ColumnCount - 2, IsOkay = false
            });

            // Add description case
            Add(new DescriptionCase()
            {
                Row = addedRowIndex, Column = ColumnCount - 1, Description = ""
            });

            ModifyingColumns = false;
            UpdateAmounts(accountCol);
        }
        protected override void InitializeCollections()
        {
            EnsureBaseBalances();

            ActiveRequests   = new ActiveFundReqsRepo(this);
            InactiveRequests = new InactiveFundReqsRepo(this);
            ActiveCheques    = new ActiveChequesRepo(this);
            //InactiveCheques  = new InactiveChequesRepo(this);
            GLAccounts = new GLAccountsRepo(this);

            AccountNames.Clear();
            AccountNames.AddRange(GetAccountNames());
            if (!AccountNames.Any())
            {
                GetSoaRepo();
                AccountNames.Clear();
                AccountNames.AddRange(this.GetAccountNames());
                AccountIDs.Clear();
                AccountIDs.AddRange(AccountNames.Select((s, i) => i + 1));
            }
        }
 // GET: AccountTypes
 public ActionResult Index()
 {
     string[] accountTypes = new AccountNames().GetAccountTypes();
     ViewBag.AccountTypes = accountTypes;
     return(View());
 }
Exemple #4
0
 private void FillAccountNames()
 {
     AccountNames.SetItems(AppArgs.DCDR.AccountNames);
     AccountName = AccountNames.FirstOrDefault();
 }
Exemple #5
0
 public void AddAccountName(AccountName accountName)
 {
     AccountNames.Add(accountName);
 }
Exemple #6
0
 /// <summary>
 /// Accounts the name.
 /// </summary>
 /// <param name="accountId">The account identifier.</param>
 /// <returns></returns>
 protected string AccountName(int accountId)
 {
     return(AccountNames.ContainsKey(accountId) ? AccountNames[accountId] : "");
 }