コード例 #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
ファイル: DeleteUserImage.aspx.cs プロジェクト: pyfxl/fxlweb
    protected void Page_Load(object sender, EventArgs e)
    {
        UserTableBLL bll = new UserTableBLL();

        if (!Page.IsPostBack)
        {
            string dirPath = Server.MapPath("~/Images/Users/");
            DataTable name_dt = FileHelper.GetFileName(dirPath);

            DataTable user_dt = bll.GetUserList();

            foreach (DataRow name_dr in name_dt.Rows)
            {
                bool hasFile = false;
                string fileName = name_dr["FileName"].ToString();

                foreach (DataRow user_dr in user_dt.Rows)
                {
                    string userImage = user_dr["UserImage"].ToString();
                    if (fileName == userImage)
                    {
                        hasFile = true;
                    }
                }

                if (!hasFile)
                {
                    string path = dirPath + fileName;
                    FileHelper.DeleteFile(path);
                }
            }
        }
    }
コード例 #3
0
ファイル: UserLogin.aspx.cs プロジェクト: pyfxl/fxlweb
    //登录按钮
    protected void SubmitButtom_Click(object sender, EventArgs e)
    {
        string userName = this.UserName.Text.Trim();
        string userPassword = this.UserPassword.Text.Trim();

        if (userName == "")
        {
            Utility.Alert(this, "用户名未填写!");
            return;
        }

        if (userPassword == "")
        {
            Utility.Alert(this, "密码未填写!");
            return;
        }

        //保留用户名Cookie
        Response.Cookies["UserCookie"].Value = userName;
        Response.Cookies["UserCookie"].Expires = DateTime.MaxValue;

        UserTableBLL bll = new UserTableBLL();
        bool success = bll.UserLogin(userName, userPassword);
        if (success)
        {
            Session["TodayDate"] = DateTime.Now.ToString("yyyy-MM-dd");

            UserInfo user = bll.GetUserByUserPassword(userName, userPassword);
            UserHelper.SaveSession(user);

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

            string url = Request.QueryString["url"];
            if (url == "" || url == null)
            {
                url = "Default.aspx";
            }

            Response.Redirect(url);
        }
        else
        {
            Utility.Alert(this, "登录失败!");
        }
    }
コード例 #4
0
ファイル: UserService.cs プロジェクト: pyfxl/fxlweb
        public void Execute(IJobExecutionContext context)
        {
            log.Info("开始用户自动服务。");

            try
            {
                UserTableBLL bll = new UserTableBLL();
                DataTable dt = bll.GetUserList();

                log.Info("用户数:" + dt.Rows.Count);
            }
            catch (Exception ex)
            {
                log.Error(ex.Message + Environment.NewLine + ex.StackTrace);
                JobExecutionException jobException = new JobExecutionException(ex);
                throw jobException;
            }
        }
コード例 #5
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());
    }
コード例 #6
0
ファイル: UserTableTest.cs プロジェクト: pyfxl/fxlweb
 public void Init()
 {
     bll = new UserTableBLL();
 }
コード例 #7
0
ファイル: UserHelper.cs プロジェクト: pyfxl/fxlweb
    public static string GetUserName(string from)
    {
        UserTableBLL bll = new UserTableBLL();
        UserInfo user = new UserInfo();

        string userName = "";
        do
        {
            userName = from + Utility.GetRandomNumber(10000, 99999);
            user = bll.GetUserByUserName(userName);
        } while (user.UserID > 0);

        return userName;
    }