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 Bitrix.Services;
using Bitrix.Configuration;

public partial class bitrix_install_Step7 : BXWizardStep
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }

    public override void Activate()
    {
		BXWebConfig config = new BXWebConfig();
		config.Load(MapPath("~/web.config"));
		config.ConnectionStrings["BXConnectionString"] = config.ConnectionStrings["BXConnectionString"];
		config.Save();

		if (Request["mode"] != null || Request["step"] != null)
		{
			if (Request["redirect"] != null)
				Response.Redirect(VirtualPathUtility.ToAbsolute("~/"));
			return;
		}

        int step = 6;
        string mode = "full";

        WizardStep wizStep = Parent as WizardStep;
        if (wizStep != null)
        {
            if (wizStep.Wizard.WizardSteps.Count > 2)
                mode = "full";
            else
                mode = "simple";

            step = wizStep.Wizard.WizardSteps.Count - 1;
        }

        Response.Redirect(string.Format("{0}?mode={1}&step={2}", Page.AppRelativeVirtualPath, mode, step), true);
    }
}
