/// <summary> /// 根据会员名称或邮箱和密码得到会员信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public MemberInfo GetMemberInfo(MemberInfo model) { MemberInfo info = null; string sqltxt = @"SELECT MID , Name , HeadPic , Email , Birthday , Addtime , UpdateTime , mURL , [Description] , sex , Tags , Likes , IsRecommend , ISNULL(IsBlogUser,0) IsBlogUser, BlogUserName , BlogDecription , BlogCount FROM qds157425440_db.dbo.MemberInfo WITH ( NOLOCK ) WHERE ( Name = @str OR Email = @str ) AND [Password] = @password AND [Status] = 20"; using (SqlConnection conn = new SqlConnection(sqlconnectstr)) { info = conn.Query<MemberInfo>(sqltxt, new { str = model.Name.Trim(), password = model.Password }).ToList<MemberInfo>().FirstOrDefault(); } return info; }
/// <summary> /// 快速注册会员 /// </summary> /// <param name="model"></param> /// <returns></returns> public MemberInfo FastRegisterMember(MemberInfo model) { MemberInfo info = null; string sqltxt = @"INSERT INTO qds157425440_db.dbo.MemberInfo ( Name , Email , [Password] , [Status] , Addtime , UpdateTime, IsBlogUser ) VALUES ( @Name , @Email , @Password , 20 , GETDATE() , GETDATE(), 0 ) DECLARE @id INT SET @id = @@IDENTITY SELECT MID , Name , HeadPic , Email , Birthday , Addtime , UpdateTime , mURL , [DESCRIPTION] , sex , Tags , Likes , IsRecommend , IsBlogUser , BlogUserName , BlogDecription , BlogCount FROM qds157425440_db.dbo.MemberInfo WITH ( NOLOCK ) WHERE mid = @id"; using (SqlConnection conn = new SqlConnection(sqlconnectstr)) { info = conn.Query<MemberInfo>(sqltxt, new { Name = model.Name.Trim(), Email = model.Email, Password = model.Password }).ToList<MemberInfo>().FirstOrDefault(); } return info; }
/// <summary> /// 修改用户的头像信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public int UpdateMemberHeadPic(MemberInfo model) { return dal.UpdateMemberHeadPic(model); }
/// <summary> /// 根据会员名称或邮箱和密码得到会员信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public MemberInfo GetMemberInfo(MemberInfo model) { return dal.GetMemberInfo(model); }
/// <summary> /// 快速注册会员 /// </summary> /// <param name="model"></param> /// <returns></returns> public MemberInfo FastRegisterMember(MemberInfo model) { return dal.FastRegisterMember(model); }
/// <summary> /// 修改用户的头像信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public int UpdateMemberHeadPic(MemberInfo model) { string sqltxt = @"UPDATE qds157425440_db.dbo.MemberInfo SET HeadPic = @HeadPic , MidHeadPic = @MidHeadPic , SmallHeadPic = @SmallHeadPic WHERE MID = @id"; SqlParameter[] paramter = { new SqlParameter("@HeadPic",model.HeadPic), new SqlParameter("@MidHeadPic",model.MidHeadPic), new SqlParameter("@SmallHeadPic",model.SmallHeadPic), new SqlParameter("@id",model.MID) }; int rowcount = helper.ExecuteSql(sqltxt, paramter); return rowcount; }
/// <summary> /// 按照ID读取会员信息 /// </summary> /// <param name="mid"></param> /// <returns></returns> public MemberInfo GetMemberInfoByID(int mid) { MemberInfo info = new MemberInfo(); string sqltxt = @"SELECT MID , Name , HeadPic, Email , Birthday FROM qds157425440_db.dbo.MemberInfo WITH(NOLOCK) WHERE mid=@id"; using (SqlConnection conn = new SqlConnection(sqlconnectstr)) { info = conn.Query<MemberInfo>(sqltxt, new { id = mid }).ToList<MemberInfo>().FirstOrDefault(); } return info; }