/// <summary>
 /// Deprecated Method for adding a new object to the AccountHackings EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToAccountHackings(AccountHacking accountHacking)
 {
     base.AddObject("AccountHackings", accountHacking);
 }
Example #2
0
        //Metodi per registrare i tentativi precedenti
        public static void RegistraHackingAccount(long account, long hacker, bool successo)
        {
            using (HolonetEntities context = new HolonetEntities())
            {
                long numeroTentativo = 0;

                var tentativiPrecedenti = (from trials in context.AccountHackings
                                           where trials.NumeroPGAccount == account
                                           where trials.NumeroPGHacker == hacker
                                           select trials.NumeroTentativo);
                if (tentativiPrecedenti.Count() > 0)
                {
                    long ultimoTentativo = tentativiPrecedenti.Max();
                    numeroTentativo = ultimoTentativo + 1;
                }

                AccountHacking tentativoDaRegistrare = new AccountHacking();
                tentativoDaRegistrare.NumeroPGAccount = account;
                tentativoDaRegistrare.NumeroPGHacker = hacker;
                tentativoDaRegistrare.NumeroTentativo = numeroTentativo;
                tentativoDaRegistrare.Riuscito = successo ? 1 : 0;
                tentativoDaRegistrare.DataTentativo = DateTime.Now;

                context.AddToAccountHackings(tentativoDaRegistrare);
                context.SaveChanges();
            }
        }
 /// <summary>
 /// Create a new AccountHacking object.
 /// </summary>
 /// <param name="numeroPGAccount">Initial value of the NumeroPGAccount property.</param>
 /// <param name="numeroPGHacker">Initial value of the NumeroPGHacker property.</param>
 /// <param name="numeroTentativo">Initial value of the NumeroTentativo property.</param>
 public static AccountHacking CreateAccountHacking(global::System.Int64 numeroPGAccount, global::System.Int64 numeroPGHacker, global::System.Int64 numeroTentativo)
 {
     AccountHacking accountHacking = new AccountHacking();
     accountHacking.NumeroPGAccount = numeroPGAccount;
     accountHacking.NumeroPGHacker = numeroPGHacker;
     accountHacking.NumeroTentativo = numeroTentativo;
     return accountHacking;
 }