Exemplo n.º 1
0
 public static void ConfigureAppModel(this ModelBuilder builder)
 {
     AppUserProfile.ConfigureFluent(builder);
     AppUserBank.ConfigureFluent(builder);
     AppUserRole.ConfigureFluent(builder);
     AppUserFile.ConfigureFluent(builder);
     Bank.ConfigureFluent(builder);
     Country.ConfigureFluent(builder);
     State.ConfigureFluent(builder);
     LGA.ConfigureFluent(builder);
     Staff.ConfigureFluent(builder);
     Supplier.ConfigureFluent(builder);
     BillPayable.ConfigureFluent(builder);
     BillReceivable.ConfigureFluent(builder);
     Journal.ConfigureFluent(builder);
     JournalLineItem.ConfigureFluent(builder);
     Payment.ConfigureFluent(builder);
     Receipt.ConfigureFluent(builder);
     PayableWorkFlow.ConfigureFluent(builder);
     ReceivableWorkFlow.ConfigureFluent(builder);
     AccountGroup.ConfigureFluent(builder);
     AccountSubType.ConfigureFluent(builder);
     LineItem.ConfigureFluent(builder);
     BankAccount.ConfigureFluent(builder);
     AppData.ConfigureFluent(builder);
 }
Exemplo n.º 2
0
        public AccountLinkViewModel(
            ILoggerFactory loggerFactory,
            AccountLink accountLink)
        {
            m_logger = loggerFactory.CreateLogger <AccountLinkViewModel>();

            AccountId = accountLink.AccountId;
            m_name    = accountLink.Name;
            m_type    = accountLink.Type;
            m_subType = accountLink.SubType;
        }
Exemplo n.º 3
0
        public AccountItemViewModel(
            ILoggerFactory loggerFactory,
            Account account)
        {
            m_logger = loggerFactory.CreateLogger <AccountItemViewModel>();

            AccountId      = account.AccountId;
            m_name         = account.Name;
            m_type         = account.Type;
            m_subType      = account.SubType;
            m_currencyName = account.Currency.Name;
        }
Exemplo n.º 4
0
        public AccountTreeItemViewModel(
            ILoggerFactory loggerFactory,
            Account account,
            IEnumerable <Transaction> transactions,
            IEnumerable <IAccountTreeItemViewModel> childAccountVMs)
        {
            m_logger = loggerFactory.CreateLogger <AccountTreeItemViewModel>();

            AccountId      = account.AccountId;
            m_name         = account.Name;
            m_type         = account.Type;
            m_subType      = account.SubType;
            m_currencyName = account.Currency.Name;

            decimal debitSum  = transactions.Where(t => t.DebitAccount.AccountId == AccountId).Sum(t => t.Amount);
            decimal creditSum = transactions.Where(t => t.CreditAccount.AccountId == AccountId).Sum(t => t.Amount);
            decimal balance   = debitSum - creditSum;

            CurrencySymbol    = string.Empty;
            ChildAccountItems = new ObservableCollection <IAccountTreeItemViewModel>(childAccountVMs);
            Balance           = balance + ChildAccountItems.Sum(a => a.Balance);
        }
Exemplo n.º 5
0
        static async Task InitializeCOA(IServiceProvider serviceProvider, IUnitOfWork unitOfWork)
        {
            var accountGroups   = DataToSeed.GetData.AccountGroupList();
            var accountSubTypes = DataToSeed.GetData.AccountSubTypeList();
            var lineItems       = DataToSeed.GetData.LineItemList();
            var bankAccounts    = DataToSeed.GetData.BankAccountList();



            if (!unitOfWork.AccountGroupsRepository.Items.ToList().Any())
            {
                foreach (var accountGroupModel in accountGroups)
                {
                    var accountGroup = new AccountGroup
                    {
                        Code        = accountGroupModel.Code,
                        Description = accountGroupModel.Description,
                    };

                    unitOfWork.AccountGroupsRepository.Insert(accountGroup);

                    if (!unitOfWork.AccountSubTypesRepository.Items.ToList().Any())
                    {
                        var accountSubTypeMatchList = accountSubTypes.Where(x => x.Type == accountGroupModel.Type);

                        foreach (var accountSubTypeModel in accountSubTypeMatchList)
                        {
                            var accountSubType = new AccountSubType
                            {
                                Code        = accountSubTypeModel.Code,
                                Description = accountSubTypeModel.Description,
                            };

                            accountSubType.AccountGroup = accountGroup;

                            unitOfWork.AccountSubTypesRepository.Insert(accountSubType);

                            if (!unitOfWork.LineItemsRepository.Items.Any())
                            {
                                var lineItemMatchList = lineItems.Where(x => x.Code.StartsWith(accountSubType.Code));

                                foreach (var lineItemModel in lineItemMatchList)
                                {
                                    //var found = unitOfWork.LineItemsRepository.Items.FirstOrDefault(x => x.Code == lineItemModel.Code);

                                    //if (found)
                                    //{
                                    var lineItem = new LineItem
                                    {
                                        Code             = lineItemModel.Code.Trim(),
                                        Description      = lineItemModel.Description.Trim(),
                                        AccountGroupType = accountGroupModel.Type,
                                    };

                                    lineItem.AccountSubType = accountSubType;

                                    unitOfWork.LineItemsRepository.Insert(lineItem);
                                    //}
                                }
                            }
                        }
                    }
                }

                unitOfWork.BankAccountsRepository.Insert(bankAccounts);

                await unitOfWork.SaveChangesAsync();
            }
        }