public bool SkorKaydiEkle(YeniSkorKaydi aKayit)
        {
            try
            {
                int lKey = Convert.ToInt32(aKayit.Key);
                lKey--;
                string lKeyS = (lKey - (aKayit.Skor * 2) - (DateTime.Now.Hour + 57) * 1000) + "";
                if (lKeyS.Substring(0, 3) != lKeyS.Substring(3, 3))
                {
                    return(false);
                }

                using (var lDb = new yilanEntities())
                {
                    yilan_skorlar lKayit = lDb.yilan_skorlar.FirstOrDefault(s => s.kullanici == aKayit.Kullanici) ?? new yilan_skorlar();

                    if (lKayit.id == 0 || lKayit.skor < aKayit.Skor)
                    {
                        lKayit.kullanici = aKayit.Kullanici;
                        lKayit.skor      = aKayit.Skor;
                        lKayit.zaman     = DateTime.Now;
                        if (lKayit.id == 0)
                        {
                            lDb.yilan_skorlar.Add(lKayit);
                        }
                        lDb.SaveChanges();
                    }
                    return(true);
                }
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Esempio n. 2
0
 public bool SkorKaydiEkle(YeniSkorKaydi aKayit)
 {
     return(new SkorlarFacade().SkorKaydiEkle(aKayit));
 }