Beispiel #1
0
    //checkbox事件
    protected void Button1_Click(object sender, EventArgs e)
    {
        string value = "";

        try
        {
            value = menuHelper.GetSaveMenu();
        }
        catch (Exception ex)
        {
            Utility.Alert(this.Page, ex.Message, "UserFunctionSetting.aspx");
            return;
        }

        UserTableBLL bll = new UserTableBLL();
        UserInfo user = bll.GetUserByUserId(userId);
        user.Synchronize = 1;
        user.UserFunction = value;
        user.ModifyDate = DateTime.Now;

        bool success = bll.UpdateUser(user);
        if (success)
        {
            Session["UserFunction"] = value;
            Response.Redirect(Request.Url.ToString());
        }
        else
        {
            Utility.Alert(this.Page, "修改失败!");
        }
    }
Beispiel #2
0
    //切换主题
    protected void ImageButton_Command(object sender, CommandEventArgs e)
    {
        int userId = 0;
        string theme = e.CommandArgument.ToString();

        Response.Cookies["ThemeCookie"].Value = theme;
        Response.Cookies["ThemeCookie"].Expires = DateTime.MaxValue;

        if (Session["UserID"] != null && Session["UserID"].ToString() != "")
        {
            userId = Convert.ToInt32(Session["UserID"]);

            UserTableBLL bll = new UserTableBLL();

            UserInfo user = bll.GetUserByUserId(userId);
            user.UserTheme = theme;
            user.ModifyDate = DateTime.Now;

            bll.UpdateUser(user);
        }

        Response.Redirect(Request.Url.ToString());
    }