Esempio n. 1
0
        //private static readonly ILog Logger = LogManager.GetLogger(typeof(Program));
        private static void Main()
        {
            string username = "******";
            string pass = "******";

            BasicConfigurator.Configure();

            //Logger.Debug("Here is a debug log.");
            //Logger.Info("... and an Info log.");
            //Logger.Warn("... and a warning.");
            //Logger.Error("... and an error.");
            //Logger.Fatal("... and a fatal error.");

            using (ISession session = NHibernateHelper.GetCurrentSession())
            {

                new SchemaExport(NHibernateHelper.Configuration).Execute(true, true, false);

                IQuery query = session.CreateQuery("FROM Account WHERE username = :name  AND pass = :pass ");
                query.SetString("name", username);
                query.SetString("pass", pass);
                IList<Account> acc = query.List<Account>();

                if (acc.Count == 0)
                {
                    Console.WriteLine("Cannot find specified user");
                }
                else
                {
                    Console.WriteLine("Found " + acc[0].UserName);
                }

                var customer = new Account { Pass = "******", UserName = "******" };
                session.Save(customer);
            }

            Console.ReadKey();
        }
Esempio n. 2
0
        private void SendVerificationEmail(Data.Account a)
        {
            if (NeedsEmailVerification)
            {
                var code = PasswordGenerator.Generate(20);
                RepoAccount.SetEmailValidationCode(code, a.ID);

                var salutation = $"{a.Title} {a.FirstName} {a.LastName}";

                var email = new MongoWebApiStarter.Models.Email(
                    Settings.Email.FromName,
                    Settings.Email.FromEmail,
                    salutation,
                    a.Email,
                    "Please validate your Virtual Practice account...",
                    EmailTemplates.Email_Address_Validation);

                email.MergeFields.Add("Salutation", salutation);
                email.MergeFields.Add("ValidationLink", $"{BaseURL}#/account/{a.ID}-{code}/validate");

                email.AddToSendingQueue();
            }
        }