Esempio n. 1
0
        public static object CheckLogin(SqlConnection conn, string username, string password)
        {
            PersonDAL personDAL = new PersonDAL(conn);
            string password_md5 = CommonBLL.GetMD5Password(password);
            DataRow p =null;

            //username
            if (null == p)
            {
                p = personDAL.GetAPersonByUsername(username);
            }

            //usercode
            if (null == p)
            {
                p = personDAL.GetAPersonByUserCode(username);
            }

            //idnumber
            if (null == p)
            {
                p = personDAL.GetAPersonByIDNumber(username);
            }

            if (null == p) return "-1";
            if (Functions.CleanDBString(p["password"]).Equals(password_md5))
            {

                //return Functions.CleanDBGuid(p["id"]);
                return p;
            }
            else
            {
                return "-2";
            }
        }
Esempio n. 2
0
        //分配11位的号码
        public static string GetPersonNumber()
        {
            string res = "";
            using(SqlConnection conn = new SqlConnection(Globals.ConnectionString)){
                while (true)
                {
                    res = RandomHelper.GenerateRandomNumber(11);

                    PersonDAL pd = new PersonDAL(conn);
                    DataRow p = pd.GetAPersonByUserCode(res);
                    if (null == p) break;
                }
            }
            return res;
        }