private void attach_PricePool(PricePool entity)
		{
			this.SendPropertyChanging();
			entity.Price = this;
		}
		private void detach_PricePool(PricePool entity)
		{
			this.SendPropertyChanging();
			entity.Price = null;
		}
 partial void DeletePricePool(PricePool instance);
 partial void UpdatePricePool(PricePool instance);
 partial void InsertPricePool(PricePool instance);
        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;
        }
        public bool CreatePricePool(int priceId, int eventId, int placeRangeMin, int placeRangeMax, float placePercent)
        {
            using (MasterDBDataContext db = new MasterDBDataContext())
            {
                Event group = db.Event.SingleOrDefault(g => g.idEvent == eventId);
                if (group != null)
                {
                    PricePool pricePool = new PricePool()
                    {
                        idPrice = priceId,
                        idEvent = eventId,
                        placeRangeMin = placeRangeMin,
                        placeRangeMax = placeRangeMax,
                        placePurcent = placePercent
                    };

                    db.PricePool.InsertOnSubmit(pricePool);

                    try
                    {
                        db.SubmitChanges();
                        return true;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("CREATE PRICEPOOL " + ex.Message);
                    }
                }

                return false;
            }
        }