Esempio n. 1
0
 public StudentTransactions(int limit)
 {
     Next   = new StudentTransaction[limit];
     _limit = limit;
     index  = 0;
     Heigth = 0;
 }
Esempio n. 2
0
 public Student(int length)
 {
     this.length  = length;
     IndexNumber  = new string[length];
     Name         = new string[length];
     Balance      = new float[length];
     State        = new int[length];
     Transactions = new StudentTransaction[length];
     Count        = 0;
 }
Esempio n. 3
0
        public void Add(UTransit.Models.Student student)
        {
            lock (student)
            {
                if (Count == IndexNumber.Length)
                {
                    var newLength   = IndexNumber.Length + 1000;
                    var indexNumber = new string[newLength];
                    IndexNumber.CopyTo(indexNumber, 0);
                    IndexNumber = indexNumber;

                    var name = new string[newLength];
                    Name.CopyTo(name, 0);
                    Name = name;

                    var balance = new float[newLength];
                    Balance.CopyTo(balance, 0);
                    Balance = balance;

                    var _transactions = new StudentTransaction[newLength];
                    Transactions.CopyTo(_transactions, 0);
                    Transactions = _transactions;

                    var _state = new int[newLength];
                    State.CopyTo(_state, 0);
                    State = _state;
                }
            }
            IndexNumber[Count]  = student.IndexNumber;
            Name[Count]         = student.Name;
            Balance[Count]      = student.Balance;
            Transactions[Count] = new StudentTransaction(length);
            if (student.Transactions.Count > 0)
            {
                foreach (var t in student.Transactions)
                {
                    Transactions[Count].Add(t);
                }
            }
            State[Count]++;

            Count++;
        }
Esempio n. 4
0
 public void Add(UTransit.Models.StudentTransaction transaction)
 {
     lock (transaction)
     {
         if (Heigth > _limit - 1)
         {
             if (index == _limit)
             {
                 index = 0;
             }
             Next[index].Add(transaction);
             index++;
         }
         else
         {
             Next[Heigth] = new StudentTransaction(1000);
             Next[index].Add(transaction);
             Heigth++;
         }
     }
 }