Пример #1
0
 public ContactForm()
 {
     _database = ApplicationContext.Current.DatabaseContext.Database;
     if (!_database.TableExist("ContactForm"))
     {
         _database.CreateTable<ContactFormPoco>();
     }
 }
        public ExternalLoginStore()
        {
            if (identityStoreConnection == null)
            {
                throw new ConfigurationException("UmbracoIdentityStore is not set in the configuration");
            }

            _db = new UmbracoDatabase(identityStoreConnection.ConnectionString, "System.Data.SqlClient");
            if (!_db.TableExist("ExternalLogins"))
            {
                //unfortunately we'll get issues if we just try this because of differing sql syntax providers. In newer
                // umbraco versions we'd just use the DatabaseSchemaHelper. So in the meantime we have to just
                // do this manually and use reflection :(;
                _db.CreateTable<ExternalLoginDto>();
            }
        }
Пример #3
0
        private static void CreateDataBase(UmbracoDatabase db)
        {
            if (!db.TableExist("ContactMessage"))
            {
                db.CreateTable<ContactPoco>(false);
            }

            if (!db.TableExist("ContactSettings"))
            {
                db.CreateTable<ContactSettings>(false);
                var settingsTwo = new List<ContactSettings>()
                {
                    new ContactSettings()
                    {
                        ConfigName = "PageSize",
                        ConfigValue = "10",
                        ConfigText = "Page Size",
                        ConfigHelper = "",
                        ConfigSort = 9
                    },
                    new ContactSettings()
                    {
                        ConfigName = "AutoReplyMessage",
                        ConfigValue = "Thanks for contacting us",
                        ConfigText = "Auto Reply Message",
                        ConfigHelper = "",
                        ConfigSort = 3
                    },
                    new ContactSettings()
                    {
                        ConfigName = "TemplateNode",
                        ConfigValue = "",
                        ConfigText = "Auto Reply Template",
                        ConfigHelper = "",
                        ConfigSort = 4
                    },
                    new ContactSettings()
                    {
                        ConfigName = "SendNotificationTo",
                        ConfigValue = "",
                        ConfigText = "Send Notification To",
                        ConfigHelper = "*Use commas to include multiple email",
                        ConfigSort = 7
                    },
                    new ContactSettings()
                    {
                        ConfigName = "NotificationMessage",
                        ConfigValue = "You have new message from %name%",
                        ConfigText = "Notification Message",
                        ConfigHelper = "",
                        ConfigSort = 6
                    },
                    new ContactSettings()
                    {
                        ConfigName = "AutoReplySubject",
                        ConfigValue = "Thanks for contacting us %name%",
                        ConfigText = "Auto Reply Subject",
                        ConfigHelper = "",
                        ConfigSort = 2
                    },
                    new ContactSettings()
                    {
                        ConfigName = "NotificationSubject",
                        ConfigValue = "New message from %name%",
                        ConfigText = "Notification Subject",
                        ConfigHelper = "",
                        ConfigSort = 5
                    },
                    new ContactSettings()
                    {
                        ConfigName = "NotificationTemplateNode",
                        ConfigValue = "",
                        ConfigText = "Notification Template",
                        ConfigHelper = "",
                        ConfigSort = 8
                    },
                    new ContactSettings()
                    {
                        ConfigName = "SenderEmail",
                        ConfigValue = "*****@*****.**",
                        ConfigText = "Sender Email",
                        ConfigHelper = "",
                        ConfigSort = 0
                    },
                    new ContactSettings()
                    {
                        ConfigName = "DisplayNameSender",
                        ConfigValue = "Noreply You Website",
                        ConfigText = "Display Name Sender",
                        ConfigHelper = "",
                        ConfigSort = 1
                    }
                };

                db.BulkInsertRecords(settingsTwo);
            }
        }