Beispiel #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 (BrnShop.Data.OAuths.CreateOAuthUser(oauthInfo))
         {
             userInfo.Uid = uid;
         }
         else
         {
             userInfo = null;
             Users.DeleteUserById(new int[] { uid });
         }
     }
     else
     {
         userInfo = null;
     }
     return userInfo;
 }
Beispiel #2
0
        private static IUserNOSQLStrategy _usernosql = BSPData.UserNOSQL; //用户非关系型数据库

        #endregion Fields

        #region Methods

        /// <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;
        }
Beispiel #3
0
 /// <summary>
 /// 创建开放授权用户
 /// </summary>
 /// <param name="oauthInfo">开放授权信息</param>
 /// <returns></returns>
 public static bool CreateOAuthUser(OAuthInfo oauthInfo)
 {
     return BrnShop.Core.BSPData.RDBS.CreateOAuthUser(oauthInfo);
 }
Beispiel #4
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;
 }