예제 #1
0
        /// <summary>
        /// 添加用户
        /// </summary>
        /// <returns></returns>
        public static bool Add(UserModel model)
        {
            string sql = @"
insert into user
(UserID
,NickName
,CreateTime
,loginKey
)
values
(@UserID
,@NickName
,@CreateTime
,@loginKey
);
";

            MySqlParameter[] _parameter =
            {
                new MySqlParameter("@UserID",     MySqlDbType.VarChar, 36)
                {
                    Value = model.UserID
                },
                new MySqlParameter("@NickName",   MySqlDbType.VarChar, 36)
                {
                    Value = model.NickName
                },
                new MySqlParameter("@CreateTime", MySqlDbType.VarChar, 36)
                {
                    Value = model.CreateTime
                },
                new MySqlParameter("@loginKey",   MySqlDbType.VarChar, 36)
                {
                    Value = model.LoginKey
                },
            };
            var _rows = DbHelperMySqlForWeiBar.ExecuteSql(sql, _parameter);

            return(_rows > 0);
        }
예제 #2
0
        /// <summary>
        /// 添加吧
        /// </summary>
        /// <returns></returns>
        public static bool Add(UserBarModel model)
        {
            string sql = @"
insert into user_bar
(UserID
,BarID
,CreateTime
,IsFollow
)
values
(@UserID
,@BarID
,@CreateTime
,@IsFollow
);
";

            MySqlParameter[] _parameter =
            {
                new MySqlParameter("@UserID",     MySqlDbType.VarChar, 36)
                {
                    Value = model.UserID
                },
                new MySqlParameter("@BarID",      MySqlDbType.Int64)
                {
                    Value = model.BarID
                },
                new MySqlParameter("@CreateTime", MySqlDbType.Int64)
                {
                    Value = model.CreateTime
                },
                new MySqlParameter("@IsFollow",   MySqlDbType.Int32)
                {
                    Value = model.IsFollow
                },
            };
            var _rows = DbHelperMySqlForWeiBar.ExecuteSql(sql, _parameter);

            return(_rows > 0);
        }
예제 #3
0
        /// <summary>
        /// 添加用户
        /// </summary>
        /// <returns></returns>
        public static bool Add(UserModel model, AuthorizeModel authmodel)
        {
            string sql = @"
insert into user
(UserID
,NickName
,CreateTime
,loginKey
)
values
(@UserID
,@NickName
,@CreateTime
,@loginKey
);

-- 授权
insert into authorize
(UserID
,AuthID
,Data
)
values
(@UserID
,@AuthID
,@Data
);

-- 关注官方的几个吧
insert into user_bar
(UserID
,BarID
,CreateTime
,IsFollow
)
values
(@UserID
,1
,@CreateTime
,1
);

";

            MySqlParameter[] _parameter =
            {
                new MySqlParameter("@UserID",     MySqlDbType.VarChar, 36)
                {
                    Value = model.UserID
                },
                new MySqlParameter("@NickName",   MySqlDbType.VarChar, 36)
                {
                    Value = model.NickName
                },
                new MySqlParameter("@CreateTime", MySqlDbType.VarChar, 36)
                {
                    Value = model.CreateTime
                },
                new MySqlParameter("@loginKey",   MySqlDbType.VarChar, 36)
                {
                    Value = model.LoginKey
                },
                new MySqlParameter("@AuthID",     MySqlDbType.VarChar, 100)
                {
                    Value = authmodel.AuthID
                },
                new MySqlParameter("@Data",       MySqlDbType.LongText)
                {
                    Value = authmodel.Data
                },
            };
            var _rows = DbHelperMySqlForWeiBar.ExecuteSql(sql, _parameter);

            return(_rows > 0);
        }