Ejemplo n.º 1
0
    protected void btnOk_Click(object sender, EventArgs e)
    {
        ParamFacade facade          = new ParamFacade();
        ParamInfo   param           = facade.GetParam("AdministratorPassword");
        string      oldPassword     = EncryptTool.MD5(txtOldPassword.Text);
        string      newPassword     = EncryptTool.MD5(txtNewPassword.Text);
        string      confirmPassword = EncryptTool.MD5(txtConfirmPassword.Text);

        if (newPassword != confirmPassword)
        {
            lblMessage.Text = "两次输入的密码不相同。";
            return;
        }
        if (param == null || string.IsNullOrEmpty(param.Value) || param.Value == oldPassword)
        {
            param       = new ParamInfo();
            param.Key   = "AdministratorPassword";
            param.Value = newPassword;
            facade.SaveParam(param);

            string url = "Default.aspx";
            if (!string.IsNullOrEmpty(Request["ReturnUrl"]))
            {
                url = Request["ReturnUrl"];
            }
            string msg = "修改密码成功!";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "AlertChangePassword", "AlertAndRedirect('" + msg + "', '" + url + "');", true);
        }
        else
        {
            lblMessage.Text = "旧密码输入不正确。";
            return;
        }
    }
Ejemplo n.º 2
0
 private string GetParamValue(string key, string defaultValue)
 {
     ParamFacade facade = new ParamFacade();
     ParamInfo paraAddress = facade.GetParam(key);
     string name = defaultValue;
     if (paraAddress != null)
     {
         name = paraAddress.Value;
         this.Application[key] = name;
     }
     return name;
 }
Ejemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ParamFacade facade = new ParamFacade();
         ParamInfo   param  = facade.GetParam("AdministratorPassword");
         if (param == null || string.IsNullOrEmpty(param.Value))
         {
             txtOldPassword.Enabled = false;
             lblMessage.Text        = "管理员密码尚未设置,请直接输入新密码。";
         }
     }
 }
Ejemplo n.º 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ParamFacade facade = new ParamFacade();
         ParamInfo   param  = facade.GetParam("AdministratorPassword");
         if (param == null || string.IsNullOrEmpty(param.Value))
         {
             string msg = "管理员密码尚未设置,请先设置管理员密码。";
             string url = this.ResolveUrl("AdminChangePassword.aspx?ReturnUrl=AdminLogin.aspx");
             JavascriptAlertAndRedirect(msg, url);
         }
     }
 }
Ejemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ParamFacade facade       = new ParamFacade();
         ParamInfo   paraSiteName = facade.GetParam("SiteName");
         if (paraSiteName != null)
         {
             txtSiteName.Text = paraSiteName.Value;
         }
         ParamInfo paraLogoFileName = facade.GetParam("LogoFileName");
         if (paraLogoFileName != null)
         {
             txtLogoFileName.Text = paraLogoFileName.Value;
         }
         ParamInfo paraAddress = facade.GetParam("Address");
         if (paraAddress != null)
         {
             txtAddress.Text = paraAddress.Value;
         }
         ParamInfo paraPhoneNumber = facade.GetParam("PhoneNumber");
         if (paraPhoneNumber != null)
         {
             txtPhone.Text = paraPhoneNumber.Value;
         }
         ParamInfo paraFaxNumber = facade.GetParam("FaxNumber");
         if (paraFaxNumber != null)
         {
             txtFax.Text = paraFaxNumber.Value;
         }
         ParamInfo paraQQNumber = facade.GetParam("QQNumber");
         if (paraQQNumber != null)
         {
             txtQQ.Text = paraQQNumber.Value;
         }
         ParamInfo paraNoticeDelay = facade.GetParam("NoticeDelay");
         if (paraNoticeDelay != null)
         {
             txtDelay.Text = paraNoticeDelay.Value;
         }
         ParamInfo paraAutoPlayMusic = facade.GetParam("AutoPlayMusic");
         if (paraAutoPlayMusic != null)
         {
             cbAutoMusic.Checked = paraAutoPlayMusic.Value == "1";
         }
     }
 }
Ejemplo n.º 6
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        string      password = EncryptTool.MD5(txtPassword.Text);
        ParamFacade facade   = new ParamFacade();
        ParamInfo   param    = facade.GetParam("AdministratorPassword");

        if (param != null && param.Value == password)
        {
            IsAdminLogined = true;
            string url = "Default.aspx";
            if (!string.IsNullOrEmpty(Request["ReturnUrl"]))
            {
                url = Request["ReturnUrl"];
            }
            RedirectToUrl(url);
        }
        else
        {
            lblMessage.Text = "密码错误!";
        }
    }
Ejemplo n.º 7
0
    public static ParamInfo GetParam(Page _page, string key)
    {
        ParamFacade facade = PageHelper.GetParamFacade(_page);

        return(facade.GetParam(key));
    }