Exemplo n.º 1
0
        //用户注册
        public int AddUser(UserInfo user)
        {
            try
            {
                if (connection.State == ConnectionState.Closed)
                {
                    connection.Open();
                }

                var        bus     = UserInfoLogin.GenerateSalt();
                string     sql     = $@"insert into UserInfo(NickName,Img,PhoneNumber,Password,Salt,Email,RealName,CreateTime,UpdateTime,CreaterId,UpdaterId) 
                                 values('{user.NickName}','','{user.PhoneNumber}','{MD5Encrypt32(user.PassWord + bus)}','{bus}','{user.Email}','{user.RealName}','{DateTime.Now}','{DateTime.Now}','{user.CreaterId}','{user.UpdaterId}')";
                SqlCommand command = new SqlCommand(sql, connection);
                var        res     = command.ExecuteNonQuery();

                if (connection.State == ConnectionState.Open)
                {
                    connection.Close();
                }
                return(res);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 2
0
        //用户注册
        public int AddUser(UserInfo user)
        {
            connection.Open();
            var        bus     = UserInfoLogin.GenerateSalt();
            string     sql     = $@"insert into UserInfo(NickName,Img,PhoneNumber,Password,Salt,Email,RealName,CreateTime,UpdateTime,CreaterId,UpdaterId) 
                                 values('{user.NickName}','{user.PhoneNumber}','{MD5Encrypt32(user.PassWord + "{"+bus+"}")}','{bus}','{user.Email}','{user.RealName},'{user.CreateTime}','{user.UpdateTime}','{user.CreaterId}','{user.UpdaterId}'')";
            SqlCommand command = new SqlCommand(sql, connection);
            var        res     = command.ExecuteNonQuery();

            return(res);
        }
Exemplo n.º 3
0
 ///修改密码
 public int EditUserPwd(string pwd, string PhoneNumber)
 {
     try
     {
         var    bus = UserInfoLogin.GenerateSalt();
         int    res = 0;
         string sql = "update UserInfo set Password='******' , Salt='" + bus + "' where PhoneNumber='" + PhoneNumber + "'";
         res = OrmDBHelper.ExecuteNonQuery(sql);
         return(res);
     }
     catch (Exception ex)
     {
         string res = ex.Message;
         throw;
     }
 }