Esempio n. 1
0
    /// <summary>
    /// Gets the pool basing on the type. If pool is not present in the DB, it is being created
    /// </summary>
    /// <param name="type"></param>
    /// <returns></returns>
    public static GlobalPool Get(int poolId)
    {
        var results = TableHelper.SelectRows <GlobalPool>(TableHelper.MakeDictionary("GlobalPoolType", poolId));

        if (results.Count > 0)
        {
            return(results[0]);
        }

        GlobalPool NewPool = new GlobalPool();

        NewPool.GlobalPoolType = poolId;
        NewPool.SumAmount      = new Money(0);
        NewPool.Save();

        return(NewPool);
    }