/// <summary> /// To save the board. /// </summary> /// <param name="board">Board.</param> public static void SaveBoard(ExchangeBoard board) { if (board == null) { throw new ArgumentNullException(nameof(board)); } ExchangeInfoProvider.Save(board); }
/// <summary> /// To get a board by its code. If board with the passed name does not exist, then it will be created. /// </summary> /// <param name="code">Board code.</param> /// <param name="createBoard">The handler creating a board, if it is not found. If the value is <see langword="null" />, then the board is created by default initialization.</param> /// <returns>Exchange board.</returns> public static ExchangeBoard GetOrCreateBoard(string code, Func <string, ExchangeBoard> createBoard = null) { if (code.IsEmpty()) { throw new ArgumentNullException(nameof(code)); } if (code.CompareIgnoreCase("RTS")) { return(Forts); } var board = ExchangeInfoProvider.GetExchangeBoard(code); if (board != null) { return(board); } if (createBoard == null) { var exchange = ExchangeInfoProvider.GetExchange(code); if (exchange == null) { exchange = new Exchange { Name = code }; ExchangeInfoProvider.Save(exchange); } board = new ExchangeBoard { Code = code, Exchange = exchange }; } else { board = createBoard(code); if (ExchangeInfoProvider.GetExchange(board.Exchange.Name) == null) { ExchangeInfoProvider.Save(board.Exchange); } } SaveBoard(board); return(board); }
public static bool Save(System.String idx, System.String platformCode, System.String account, System.Guid managerId, System.Int32 zoneName, System.Int32 packId, System.Byte[] rowVersion, System.Int32 exchangeBatchLimitCode, ref System.Int32 returnCode, DbTransaction trans = null) { ExchangeInfoProvider provider = new ExchangeInfoProvider(); return(provider.Save(idx, platformCode, account, managerId, zoneName, packId, rowVersion, exchangeBatchLimitCode, ref returnCode, trans)); }