Beispiel #1
0
        public static List <TransferMoney> GetTransfertList(string accountNumber)
        {
            string sql = "SELECT [idTransfert],[idOriginAccount],[idDestinationAccount], [TransferDate], [amount],isDone, idTransaction" +
                         " FROM [Transfert] WHERE idOriginAccount= @idAccount";

            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = GetConnexion;
            cmd.CommandText = sql;
            cmd.Parameters.Add(new SqlParameter("@idAccount", GetIdAccountFromAccountNumber(accountNumber)));
            List <TransferMoney> newTransfertList = new List <TransferMoney>();

            using (DbDataReader reader = cmd.ExecuteReader())
            {
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        TransferMoney transfertMoney = new TransferMoney();
                        transfertMoney.idTransfert   = reader.GetInt32(reader.GetOrdinal("idTransfert"));
                        transfertMoney.IdOrigin      = reader.GetInt32(reader.GetOrdinal("idOriginAccount"));
                        transfertMoney.idDestination = reader.GetInt32(reader.GetOrdinal("idDestinationAccount"));
                        transfertMoney.TransferDate  = reader.GetDateTime(reader.GetOrdinal("TransferDate"));
                        transfertMoney.Amount        = reader.GetDecimal(reader.GetOrdinal("amount"));
                        transfertMoney.IsDone        = reader.GetBoolean(reader.GetOrdinal("isDone"));
                        transfertMoney.IdTransaction = reader.GetInt32(reader.GetOrdinal("idTransaction"));
                        newTransfertList.Add(transfertMoney);
                    }
                }
                return(newTransfertList);
            }
        }
Beispiel #2
0
        public override List <TransferMoney> GetTransferts()
        {
            List <TransferMoney> Transfert        = new List <TransferMoney>();
            TransferMoney        currentTransfert = new TransferMoney(this);

            Transfert.Add(currentTransfert);
            return(Transfert);
        }
        public override List <TransferMoney> GetTransferts()
        {
            List <TransferMoney> Transfert = new List <TransferMoney>();

            while (StartDate < EndDate)
            {
                TransferMoney currentTransfert = new TransferMoney(this);
                Transfert.Add(currentTransfert);
                StartDate = StartDate + TimeSpan.FromDays(Periodicity);
            }
            return(Transfert);
        }