public List <ListViewItem> GetListView(Deal aDeal)
        {
            List <ListViewItem> ListViewItems = new List <ListViewItem>();

            InvestmentGroupDetailDataHelper DH    = new InvestmentGroupDetailDataHelper();
            List <InvestmentGroupDetail>    aList = DH.SelectByGroupID(aDeal.InvestmentGroupID);


            if (aList != null)
            {
                foreach (var item in aList)
                {
                    // Define the list items
                    ListViewItem aListViewItem = new ListViewItem(new InvestmentDataHelper().SelectByID(new InvestmentGroupDetailDataHelper().SelectByID(item.ID).InvestmentID).Name.ToString());
                    aListViewItem.SubItems.Add(item.InHand.ToString());
                    aListViewItem.SubItems.Add(item.BackUp.ToString());
                    aListViewItem.SubItems.Add(item.TotalAmount.ToString());
                    aListViewItem.SubItems.Add(item.ContributionPercentage.ToString());

                    // Add the list items to the ListView
                    ListViewItems.Add(aListViewItem);
                }
            }
            return(ListViewItems);
        }
        public void DeductFinancialTransaction(int anInvestmentGroupID)
        {
            SqlConnection con = new ConnectionString().GetConnection();

            List <InvestmentGroupDetail>    anInvestmentGroupDetailList = new List <InvestmentGroupDetail>();
            InvestmentGroupDetailDataHelper aInvestmentGroupDetailDH    = new InvestmentGroupDetailDataHelper();

            Investment anInvestment = new Investment();
            Investor   anInvestor   = new Investor();


            FinancialTransactionDataHelper financialTransactionH = new FinancialTransactionDataHelper();
            FinancialTransaction           aTransaction          = new FinancialTransaction();

            aTransaction.CascadeChanges = false;



            con.Open();

            using (con)
            {
                SqlTransaction tran = con.BeginTransaction();

                try
                {
                    anInvestmentGroupDetailList = aInvestmentGroupDetailDH.SelectByGroupID(anInvestmentGroupID);

                    //Do financial Transaction
                    foreach (var item in anInvestmentGroupDetailList)
                    {
                        if (!item.AmountDeducted)
                        {
                            anInvestment = new InvestmentDataHelper().SelectByID(item.InvestmentID);
                            anInvestor   = anInvestment.InvestorDetails;

                            aTransaction.ContactID            = anInvestor.ID;
                            aTransaction.WalletType           = WalletType.Investment;
                            aTransaction.WalletReference      = item.InvestmentID;
                            aTransaction.Amount               = item.InHand;
                            aTransaction.FlowType             = FlowType.Debit;
                            aTransaction.TransactionType      = TransactionType.ApplicationTransfer;
                            aTransaction.TransactionReference = "Transfered to InvestmentGroup";
                            aTransaction.TransactionDate      = DateTime.Now;

                            // Deduct from Investment
                            financialTransactionH.Insert(aTransaction, tran);

                            //------------------------
                            // Add in InvestmentGroup
                            aTransaction.WalletType           = WalletType.InvestmentGroup;
                            aTransaction.WalletReference      = item.ID;
                            aTransaction.FlowType             = FlowType.Credit;
                            aTransaction.TransactionReference = "Transfered from Investment";

                            financialTransactionH.Insert(aTransaction, tran);
                        }
                    }

                    //do Update requied Tables
                    aInvestmentGroupDetailDH.UpdateDeductFT(anInvestmentGroupID, tran);

                    tran.Commit();
                }
                catch (Exception ex)
                {
                    tran.Rollback();
                    throw ex;
                }
            }
        }