using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Bitrix.UI;
using System.Data.Sql;
using SiteUpdater;
using Bitrix.Installer;

public partial class bitrix_install_Step3 : BXWizardStep
{
	protected override void OnInit(EventArgs e)
	{
		base.OnInit(e);
		LicenseKey.Text = BXInstaller.CheckKey("DEMO") ? "DEMO" : "";
		
	}

	protected override void OnNext(object sender, EventArgs arg)
	{
		if (!Page.IsValid)
			return;
		
		if (BXInstaller.CheckKey(LicenseKey.Text))
		{
			BXSiteUpdater siteUpdater = BXSiteUpdater.GetUpdater();
			siteUpdater.Config.Key = LicenseKey.Text;
			siteUpdater.Config.Update();
			base.OnNext(sender, arg);
		}
		else
		{
			Errors.AddErrorHtml(BXInstaller.GetMessage(this, "Error.InvalidLicenseKey"));
		}
	}

}
