public void PerformWithdrawal(Account account, decimal amount, string description, DateTimeOffset withdrawalDate) { Account acc = AccountList.Find(account.AccountNumber); acc.Balance -= amount; AccountList.Update(acc); TransactionLog.Add(new StatementRow(acc, withdrawalDate, amount, acc.Balance, description)); }
public static void CheckDungeonsList() { bool found = false; for (int i = 0; i < CharList.Count; i++) { for (int j = 0; j < DungList.Count; j++) { found = false; for (int h = 0; h < CharList[i].Dungeons.Count; h++) { if (CharList[i].Dungeons[h].Name == DungList[j].ShortName) { found = true; break; } } if (!found) { int tc = 1; if (AccountList.Find(x => x.Id == CharList[i].AccountId).TeraClub) { tc = 2; } CharList[i].Dungeons.Insert(j, new CharDungeon(DungList[j].ShortName, DungList[j].MaxBaseRuns * tc)); } } } found = false; for (int i = 0; i < CharList.Count; i++) { for (int h = 0; h < CharList[i].Dungeons.Count; h++) { found = false; for (int j = 0; j < DungList.Count; j++) { if (CharList[i].Dungeons[h].Name == DungList[j].ShortName) { found = true; break; } } if (!found) { CharList[i].Dungeons.RemoveAt(h); } } } }
/// <summary> /// Adds a new character to TCTData.Data.CharList and invokes CharacterAddedEvent /// </summary> /// <param name="character">Character to be added (if not existing)</param> public static void AddCharacter(Character character) { bool found = false; foreach (var cl in CharList) { if (cl.Name == character.Name) { found = true; cl.Laurel = character.Laurel; cl.Level = character.Level; cl.CharClass = character.CharClass; cl.GuildId = character.GuildId; cl.LocationId = character.LocationId; cl.LastOnline = character.LastOnline; cl.AccountId = character.AccountId; cl.Position = character.Position; break; } } if (!found) { // add char to chList CharList.Add(character); // check for TC int tc = 1; if (AccountList.Find(a => a.Id == character.AccountId).TeraClub) { tc = 2; } // initialize dungeons for (int j = 0; j < DungList.Count; j++) { if (DungList[j].ShortName == "AH" || DungList[j].ShortName == "EA" || DungList[j].ShortName == "GL" || DungList[j].ShortName == "CA") { CharList.Last().Dungeons.Add(new CharDungeon(DungList[j].ShortName, DungList[j].MaxBaseRuns, 0)); } else { CharList.Last().Dungeons.Add(new CharDungeon(DungList[j].ShortName, DungList[j].MaxBaseRuns * tc, 0)); } } // create and add strip to list CharacterAddedEvent.Invoke(CharList.Count - 1); //UI.MainWin.CreateStrip(CharList.Count - 1); } }
public Account FindAccount(int ID) { return(AccountList.Find(x => x.ID == ID)); }