Example #1
0
        /// <summary>
        /// The DB initialization script.
        /// </summary>
        public static string GetIntializationScript(DataScriptVersion scriptVersion)
        {
            StringBuilder sb = new StringBuilder();
              sb.AppendLine(PublicDbInitHelper.GetDefaultSystemScript(scriptVersion));
              sb.AppendLine(PublicDbInitHelper.GetClientSqlCommand(CoreConstants.SHARED_CLIENT_ID, "Dummy Client",
            CoreConstants.SUBSCRIPTION_LEVEL_SYSTEM, SUBSCRIPTION_TYPE_SYSTEM, BillingInterval.Monthly, new DateTime(2015, 5, 1), new DateTime(2100, 1, 1), true, true));

              sb.AppendLine(PublicDbInitHelper.GetSubscriptionTypeSqlCommand(AppConstants.SUBSCRIPTION_TYPE_DUMMY, "Dummy", DefaultCreatedDate, true, true));

              // Delete then re-add these items.
              sb.AppendLine("DELETE FROM saas.SubscriptionFeature");
              sb.AppendLine("DELETE FROM saas.ApplicationFeature");
              sb.AppendLine("DELETE FROM saas.ApplicationFeatureGroup");

              sb.AppendLine(PublicDbInitHelper.GetSubscriptionLevelSqlCommand(AppConstants.SUBSCRIPTION_LEVEL_BASIC,
            "Basic", 1, true, AppConstants.CLIENT_PAYMENT_LINE_ITEM_TYPE_NO_CHARGE_ID,
            AppConstants.CLIENT_PAYMENT_LINE_ITEM_TYPE_NO_CHARGE_ID, AppConstants.CLIENT_PAYMENT_LINE_ITEM_TYPE_NO_CHARGE_ID,
            10, DefaultCreatedDate, true, true));

              return sb.ToString();
        }
        /// <summary />
        public static string GetDefaultSystemScript(DataScriptVersion scriptVersion)
        {
            PublicDbInitHelper.ScriptVersion = scriptVersion;
              StringBuilder sb = new StringBuilder();

              sb.AppendLine(PublicDbInitHelper.GetBillingItemCodeSqlCommand(CoreConstants.CLIENT_PAYMENT_LINE_ITEM_TYPE_NO_CHARGE_ID,
            "NC", "No Charge", 0, DefaultCreatedDate, true, true));

              if (scriptVersion == DataScriptVersion.InitialCommonLibrary)
              {
            sb.AppendLine(PublicDbInitHelper.GetSubscriptionLevelSqlCommandInitialCommonLibrary(CoreConstants.SUBSCRIPTION_LEVEL_SYSTEM,
              "System", "System", "System", 0, false, 0.00, 0.00, 0, DefaultCreatedDate, true, true));
              }
              else
              {
            sb.AppendLine(PublicDbInitHelper.GetSubscriptionLevelSqlCommand(CoreConstants.SUBSCRIPTION_LEVEL_SYSTEM, "System", 0,
              false, CoreConstants.CLIENT_PAYMENT_LINE_ITEM_TYPE_NO_CHARGE_ID, CoreConstants.CLIENT_PAYMENT_LINE_ITEM_TYPE_NO_CHARGE_ID,
              CoreConstants.CLIENT_PAYMENT_LINE_ITEM_TYPE_NO_CHARGE_ID, 0, DefaultCreatedDate, true, true));
              }

              sb.AppendLine(PublicDbInitHelper.GetSubscriptionTypeSqlCommand(CoreConstants.SUBSCRIPTION_TYPE_SYSTEM, "System", DefaultCreatedDate, true, true));

              sb.AppendLine(PublicDbInitHelper.GetClientSqlCommand(CoreConstants.SHARED_CLIENT_ID, "System",
            CoreConstants.SUBSCRIPTION_LEVEL_SYSTEM, CoreConstants.SUBSCRIPTION_TYPE_SYSTEM, BillingInterval.Monthly,
            DefaultCreatedDate, new DateTime(2100, 1, 1), true, true));

              sb.AppendLine(PublicDbInitHelper.GetDefaultAppModuleSqlCommands(true));
              sb.AppendLine(PublicDbInitHelper.GetDefaultAppModuleAccessLevelSqlCommands(true));
              sb.AppendLine(PublicDbInitHelper.GetLocalTimeZoneSqlCommands());

              sb.AppendLine(PublicDbInitHelper.GetDefaultClientConfigurationTypeSqlCommand(true));

              sb.AppendLine(PublicDbInitHelper.GetDefaultNotificationTypeSqlCommands(true));
              sb.AppendLine(PublicDbInitHelper.GetDefaultDiscussionForumSqlCommands(true));

              return sb.ToString();
        }