Ejemplo n.º 1
0
 /// <summary>
 /// 创建开放授权用户
 /// </summary>
 /// <param name="oUserName">开放用户名</param>
 /// <param name="uNamePrefix">用户名前缀</param>
 /// <param name="openId">开放id</param>
 /// <param name="server">服务商</param>
 /// <param name="regionId">区域id</param>
 /// <returns></returns>
 public static UserInfo CreateOAuthUser(string oUserName, string uNamePrefix, string openId, string server, int regionId)
 {
     UserInfo userInfo = InitUser(oUserName, uNamePrefix, regionId);
     int uid = Users.CreateUser(userInfo);
     if (uid > 0)
     {
         OAuthInfo oauthInfo = new OAuthInfo()
         {
             Uid = uid,
             OpenId = openId,
             Server = server
         };
         if (BrnMall.Data.OAuths.CreateOAuthUser(oauthInfo))
         {
             userInfo.Uid = uid;
         }
         else
         {
             userInfo = null;
             Users.DeleteUserById(new int[] { uid });
         }
     }
     else
     {
         userInfo = null;
     }
     return userInfo;
 }
Ejemplo n.º 2
0
        private static IUserNOSQLStrategy _usernosql = BMAData.UserNOSQL;//用户非关系型数据库

        #region 辅助方法

        /// <summary>
        /// 从IDataReader创建OAuthInfo
        /// </summary>
        public static OAuthInfo BuildOAuthFromReader(IDataReader reader)
        {
            OAuthInfo oauthInfo = new OAuthInfo();

            oauthInfo.Id = TypeHelper.ObjectToInt(reader["id"]);
            oauthInfo.Uid = TypeHelper.ObjectToInt(reader["uid"]);
            oauthInfo.OpenId = reader["openid"].ToString();
            oauthInfo.Server = reader["server"].ToString();

            return oauthInfo;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 创建开放授权用户
        /// </summary>
        /// <param name="oauthInfo">开放授权信息</param>
        /// <returns></returns>
        public bool CreateOAuthUser(OAuthInfo oauthInfo)
        {
            DbParameter[] parms = {
									GenerateInParam("@uid",SqlDbType.Int,4,oauthInfo.Uid),
									GenerateInParam("@openid",SqlDbType.Char,50,oauthInfo.OpenId),
                                    GenerateInParam("@server",SqlDbType.Char,10,oauthInfo.Server)	
								   };
            return RDBSHelper.ExecuteNonQuery(CommandType.StoredProcedure,
                                              string.Format("{0}createoauthuser", RDBSHelper.RDBSTablePre),
                                              parms) > 0;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 创建开放授权用户
 /// </summary>
 /// <param name="oauthInfo">开放授权信息</param>
 /// <returns></returns>
 public static bool CreateOAuthUser(OAuthInfo oauthInfo)
 {
     return BrnMall.Core.BMAData.RDBS.CreateOAuthUser(oauthInfo);
 }