public EventGame GetEventGame() { EventGame result = new EventGame(); EventS eventS = EventsServices.Instance.GetCurrentEvent(DateTime.Now); PricePoolS[] pricepoolS = null; if (eventS != null) { pricepoolS = EventsServices.Instance.GetPricePool(eventS.id); result.eventS = eventS; if (pricepoolS != null) { result.pricePoolS = new PricePoolS[pricepoolS.Length]; result.priceS = new PriceS[pricepoolS.Length]; for (int i = 0; i < pricepoolS.Length; i++) { result.pricePoolS[i] = pricepoolS[i]; result.priceS[i] = EventsServices.Instance.GetPrice(pricepoolS[i].priceId); } return result; } } return null; }
public int GetLastPastEvent() { EventGame result = new EventGame(); using (MasterDBDataContext db = new MasterDBDataContext()) { DateTime date = DateTime.Now; var eventGames = db.Event.Where(ev => ev.EndDate < date).OrderByDescending(ev => ev.EndDate); if (eventGames != null) { Event[] arrayEventGames = new Event[eventGames.ToArray().Count()]; arrayEventGames = eventGames.ToArray(); return arrayEventGames[0].idEvent; } } return -1; }
public EventGame GetEarnedPrices(int idProfil, int idEvent) { EventGame result = new EventGame(); using (MasterDBDataContext db = new MasterDBDataContext()) { GroupSign groupSign = db.GroupSign.SingleOrDefault(gs => gs.idProfil == idProfil && gs.idEvent == idEvent); if (groupSign != null) { int[] classement = new int[2]; classement = GetRankGroupSign(idEvent, idProfil); int classementPourcent = 100; if (classement[1] > 0) classementPourcent = classement[0] / classement[1] * 100; var earnedPricePool = db.PricePool.Where(pp => pp.idEvent == idEvent && ((classement[0] <= pp.placeRangeMin && classement[0] >= pp.placeRangeMax) || (classement[0] >= pp.placeRangeMin && classement[0] <= pp.placeRangeMax) || (classementPourcent <= pp.placePurcent))); if (earnedPricePool != null) { PricePool[] arrayEarnedPricePool = new PricePool[earnedPricePool.ToArray().Count()]; arrayEarnedPricePool = earnedPricePool.ToArray(); result.priceS = new PriceS[arrayEarnedPricePool.Count()]; for (int i = 0; i < arrayEarnedPricePool.Count(); i++) { result.priceS[i] = GetPrice((int)arrayEarnedPricePool[i].idPrice); } result.eventS = GetEvent(idEvent); return result; } } } //return -1; return null; }