Ejemplo n.º 1
0
            public static void PersonGen(int Len, int ramControler)
            {
                len          = Len;
                RamControler = ramControler;

                Modals.Persons.Person[] Pr = new Modals.Persons.Person[RamControler];
                for (int i = 0; i < len; i++)
                {
                    for (int j = 0; j < RamControler; j++)
                    {
                        Pr[j] = new Modals.Persons.Person {
                            FullName = RandomGen.GetFulNameDefault(), Password = RandomGen.GetPasswordDefault(8), AccessLevel = 1
                        };
                    }
                    for (int j = 0; j < RamControler; j++)
                    {
                        try
                        {
                            ConectionToDb.AddNewPeronNoLimited(Pr, RamControler);
                        }
                        catch (Exception ex)
                        {
                            throw ex;
                        }
                    }
                }
            }
Ejemplo n.º 2
0
 public static void PersonGene(int count)
 {
     Modals.Persons.Person Pr = new Modals.Persons.Person();
     using (var db = new Modals.Context())
     {
         for (int i = 0; i < count; i++)
         {
             Pr = new Modals.Persons.Person {
                 FullName = RandomGen.GetFulNameDefault(), Password = RandomGen.GetPasswordDefault(8), AccessLevel = 1
             };
             db.Persons.Add(Pr);
         }
         db.SaveChanges();
     }
 }
Ejemplo n.º 3
0
            public static bool PasswordRecovery(string username)
            {
                try
                {
                    using (var db = new Modals.Context())
                    {
                        var    res = db.Persons.Where(i => i.UserName == username).FirstOrDefault();
                        string Rec = RandomGen.GetPasswordDefault(8);
                        res.RecoveryCode = Rec;
                        Security.MailSender.MailSend(res.Email, Rec);
                        db.SaveChanges();
                    }
                    return(true);
                }
                catch (Exception)
                {
                    return(false);

                    throw;
                }
            }