/*
* Copyright(c) 2009-2012 万户网络
* 文 件 名：regkey.aspx.cs
* 文件描述：授权页。 
*/

using System;

using Whir.Framework;
using Whir.Authorize;

public partial class whir_system_module_security_regkey : System.Web.UI.Page
{
    //用于显示万网和万户的logo,默认万户
    public string CssStyle1 = "body_login";
    public string CssStyle2 = "font_whir";

    protected void Page_Load(object sender, EventArgs e)
    { 
        //已成功授权的不再需要显示本页面
       // if (ChecKReg.IsReg()) { Response.Redirect("../../login.aspx"); }
        if (AppSettingUtil.GetString("EzeipType") == "1")
        {
            CssStyle1 = "body_login_wanwang";
            CssStyle2 = "font_wanwang";
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string Code = txtCode.Text.Trim();

        string msg = "";
        if (Code == "")
        {
            msg = "请输入授权码";
        }
        if (Code.Length > 10000)
        {
            msg = "请输入正确的授权码";
        }
        if (msg != "")
        {
            lbTips.Text = msg;
            return;
        }

        try
        {
            AppSettingUtil.SetAppSettings("RegKey", Code);
             if (ChecKReg.IsReg(Code)) { Response.Redirect("../../login.aspx"); }
            lbTips.Text = "授权码错误";
        }
        catch
        {
            lbTips.Text = "保存授权码出错(可能没有更改文件的权限)";
        }
    }
}