public void Insert(ChitSubscriberDueModel chitSubscriberDueModel) { var voucherModel = new VoucherTable { KeyId = Guid.NewGuid(), VoucherDate = System.DateTime.Now }; _unitOfWork.GetRepository <VoucherTable>().Add(voucherModel); string st = Reflection.GetPropFullName(new ChitSubscriberDueTable(), "DueAmountInfoKeyId"); if (st != "") { AccountBookFieldMapTable row = _unitOfWork.GetRepository <AccountBookFieldMapTable>().Single(x => x.FieldNameKey == st); var CashBook = _unitOfWork.GetRepository <AccountBookTable>().Single(x => x.ProgId == AccountBookProgs.CashBook); if (row != null && CashBook != null) { string AccessId = int.Parse(chitSubscriberDueModel.AccessId).ToString(); var voucherInfoModelCr = new VoucherInfoTable { KeyId = Guid.NewGuid(), VoucherKeyId = voucherModel.KeyId, AccountBookKeyId = row.AccountBookKeyId, Amount = chitSubscriberDueModel.Amount, IsCredit = true }; var voucherInfoModelDr = new VoucherInfoTable { KeyId = Guid.NewGuid(), VoucherKeyId = voucherModel.KeyId, AccountBookKeyId = CashBook.KeyId, Amount = chitSubscriberDueModel.Amount, IsCredit = false }; _unitOfWork.GetRepository <VoucherInfoTable>().Add(voucherInfoModelCr); _unitOfWork.GetRepository <VoucherInfoTable>().Add(voucherInfoModelDr); _unitOfWork.GetRepository <ChitSubscriberDueTable>().Add(new ChitSubscriberDueTable { KeyId = Guid.NewGuid(), AccessId = chitSubscriberDueModel.AccessId, ChitSubscriberKeyId = chitSubscriberDueModel.ChitSubscriberKeyId, DueAmountInfoKeyId = voucherInfoModelCr.KeyId }); _unitOfWork.SaveChanges(); } } else { throw new Exception("Account Book not Configured"); } }
private void AccountIntitilizing() { lstAccountGroup = new List <AccountGroupTable>(); lstAccountBook = new List <AccountBookTable>(); lstAgent = new List <AgentTable>(); lstContact = new List <ContactTable>(); lstAccountBookFieldMap = new List <AccountBookFieldMapTable>(); var UnderGroupAsset = new AccountGroupTable { AccountGroupName = "Assets", ProgId = AccountGroupProgs.Assets }; var UnderGroupLiabilities = new AccountGroupTable { AccountGroupName = "Liabilities", ProgId = AccountGroupProgs.Liabilities }; var UnderGroupIncome = new AccountGroupTable { AccountGroupName = "Income", ProgId = AccountGroupProgs.Income }; var UnderGroupExpense = new AccountGroupTable { AccountGroupName = "Expense", ProgId = AccountGroupProgs.Expense }; var CashInHand = new AccountGroupTable { AccountGroupName = "Cash In Hand", ParentGroupId = UnderGroupAsset.KeyId }; var CurrentLiabilities = new AccountGroupTable { AccountGroupName = "Current Liabilities", ParentGroupId = UnderGroupLiabilities.KeyId }; lstAccountGroup.Add(UnderGroupAsset); lstAccountGroup.Add(UnderGroupLiabilities); lstAccountGroup.Add(UnderGroupIncome); lstAccountGroup.Add(UnderGroupExpense); lstAccountGroup.Add(CashInHand); lstAccountGroup.Add(CurrentLiabilities); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Bank Account", ParentGroupId = UnderGroupAsset.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Loan & Advance(Assets)", ParentGroupId = UnderGroupAsset.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Inventments", ParentGroupId = UnderGroupAsset.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Fixed Assets", ParentGroupId = UnderGroupAsset.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Suspense A/c", ParentGroupId = UnderGroupAsset.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Unsecured Loans", ParentGroupId = UnderGroupAsset.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Miscellineous Expenses(Assets)", ParentGroupId = UnderGroupAsset.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Current Assets", ParentGroupId = UnderGroupAsset.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Deposits(Assets)", ParentGroupId = UnderGroupAsset.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Bank OCC", ParentGroupId = UnderGroupLiabilities.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Loan(Liability)", ParentGroupId = UnderGroupLiabilities.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Duties & Taxes", ParentGroupId = UnderGroupLiabilities.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Sundry Creditors", ParentGroupId = UnderGroupLiabilities.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Sundry Debitors", ParentGroupId = UnderGroupLiabilities.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Provisions", ParentGroupId = UnderGroupLiabilities.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Capital Account", ParentGroupId = UnderGroupLiabilities.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Branch / Divisions", ParentGroupId = UnderGroupLiabilities.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Direct Incomes", ParentGroupId = UnderGroupIncome.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "InDirect Incomes", ParentGroupId = UnderGroupIncome.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Provisions", ParentGroupId = UnderGroupIncome.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Reserves & Surplus", ParentGroupId = UnderGroupIncome.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "SalesAccount", ParentGroupId = UnderGroupIncome.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Direct Expenses", ParentGroupId = UnderGroupExpense.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Indirect Expenses", ParentGroupId = UnderGroupExpense.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Purchase Accounting", ParentGroupId = UnderGroupExpense.KeyId }); lstAccountGroup.Add(new AccountGroupTable { AccountGroupName = "Ratained Earnings", ParentGroupId = UnderGroupExpense.KeyId }); var CashBook = new AccountBookTable { KeyId = Guid.NewGuid(), BookName = "Cash", UnderAccountGroupKeyId = CashInHand.KeyId, ProgId = AccountBookProgs.CashBook }; lstAccountBook.Add(CashBook); var ChitCollection = new AccountBookTable { KeyId = Guid.NewGuid(), BookName = "Chit Collection", UnderAccountGroupKeyId = CurrentLiabilities.KeyId }; lstAccountBook.Add(ChitCollection); var DueAmountInfoKeyIdMap = new AccountBookFieldMapTable { FieldNameKey = "addon365.Chit.DataEntity.ChitSubscriberDueTable.DueAmountInfoKeyId", AccountBookKeyId = ChitCollection.KeyId }; lstAccountBookFieldMap.Add(DueAmountInfoKeyIdMap); var AgentContactNone = new ContactTable { FirstName = "None" }; lstContact.Add(AgentContactNone); var AgentNoneRow = new AgentTable { AccessId = "0", ContactId = AgentContactNone.KeyId }; lstAgent.Add(AgentNoneRow); }