Exemple #1
0
    /// <summary>
    /// 更改当前用户信息
    /// </summary>
    /// <param name="u_name"></param>
    /// <param name="u_pno"></param>
    /// <param name="u_password"></param>
    /// <returns></returns>
    public Boolean UserChangeInfo(String u_name, String u_pno, String u_password, String userid)
    {
        String password = U_String.GetMD5_32(u_password).Substring(8, 16).Trim();
        String sql      = "update manager set u_name='" + u_name + "',u_pno='" + u_pno + "',u_password='******' where u_id=" + int.Parse(userid) + ";";

        String[] sqls = new String[] { sql };
        return(new MysqlOperate().IDU(sqls));
    }
Exemple #2
0
    /// <summary>
    /// 管理员注册验证
    /// </summary>
    /// <param name="u_name"></param>
    /// <param name="u_pno"></param>
    /// <param name="u_password"></param>
    /// <returns></returns>
    public Boolean UserRegister(String u_name, String u_pno, String u_password)
    {
        String password = U_String.GetMD5_32(u_password).Substring(8, 16);
        String sql      = "insert into manager(u_name,u_pno,u_password) values('" + u_name + "','" + u_pno + "','" + password + "');";

        String[] sqls = new String[] { sql };
        return(new MysqlOperate().IDU(sqls));
    }
Exemple #3
0
    /// <summary>
    /// 添加读者信息
    /// </summary>
    /// <param name="r_name"></param>
    /// <param name="r_sex"></param>
    /// <param name="r_no"></param>
    /// <param name="r_pno"></param>
    /// <param name="r_pic"></param>
    /// <returns></returns>
    public Boolean AddReader(String r_name, String r_sex, String r_no, String r_pno, String r_pic)
    {
        String password = U_String.GetMD5_32(r_pic).Substring(8, 16);
        String sql      = "insert into reader(r_name,r_sex,r_no,r_pno,r_pic) values('" + r_name + "','" + r_sex + "','" + r_no + "','" + r_pno + "','" + r_pic + "');";

        String[] sqls = new String[] { sql };
        return(new MysqlOperate().IDU(sqls));
    }
Exemple #4
0
    /// <summary>
    /// 登录验证
    /// </summary>
    /// <param name="name"></param>
    /// <param name="password"></param>
    /// <returns></returns>
    public String checkLogin(String name, String password)
    {
        MySqlDataReader mdr = null;
        MySqlConnection con = MysqlHelper.Connection();
        MysqlHelper     mh  = new MysqlHelper();

        mh.OpenConnection();
        MySqlCommand msc = new MySqlCommand("select u_id,u_name,u_password from manager", con);

        mdr = msc.ExecuteReader(CommandBehavior.CloseConnection);
        while (mdr.Read())
        {
            Int16  u_id       = mdr.GetInt16("u_id");
            String u_name     = mdr.GetString("u_name");
            String u_password = mdr.GetString("u_password");
            if (u_name.Trim().Equals(name.Trim()) && U_String.GetMD5_32(password).Substring(8, 16).Trim().Equals(u_password.Trim()))
            {
                mh.CloseConnection();
                return(u_id + "");
            }
        }
        mh.CloseConnection();
        return(null);
    }