コード例 #1
0
ファイル: MasterPage.master.cs プロジェクト: pyfxl/fxlweb
    //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, "修改失败!");
        }
    }
コード例 #2
0
ファイル: MasterPage.master.cs プロジェクト: pyfxl/fxlweb
    //切换主题
    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());
    }