/// <summary> /// 根据数据行为会员赋值信息 /// </summary> /// <param name="dr"></param> /// <param name="member"></param> /// <param name="details"></param> private void FillMemberDetails(DbDataReader rd, out Member member, out MemberDetails details) { member = new Member(); member.ID = rd.GetInt32(0); member.Username = rd["username"].ToString(); member.Password = rd["password"].ToString(); member.Avatar = rd["avatar"].ToString(); member.Nickname = rd["nickname"].ToString(); member.Sex =rd["sex"].ToString(); member.TelePhone = rd["telephone"].ToString(); member.Note = rd["note"].ToString(); member.Email = rd["email"].ToString(); details = new MemberDetails(); details.UID = member.ID; details.Token = rd["token"].ToString(); details.Status = rd["status"].ToString(); details.RegIP = rd["regip"].ToString(); details.RegTime = Convert.ToDateTime(rd["RegTime"]); details.LastLoginTime = Convert.ToDateTime(rd["Lastlogintime"]); }
/// <summary> /// 根据会员用户名获取会员及详细信息 /// </summary> /// <param name="username"></param> /// <param name="member"></param> /// <param name="details"></param> public void GetMemberDetails(string username, out Member member, out MemberDetails details) { Member m = null; MemberDetails d = null; dal.GetMemberDetailsByUsername(username, rd => { if (rd.HasRows) { rd.Read(); FillMemberDetails(rd, out m, out d); } }); member = m; details = d; }
/// <summary> /// 更新资料 /// </summary> /// <param name="id"></param> /// <param name="password"></param> /// <param name="nickname"></param> /// <param name="email"></param> /// <param name="sex"></param> /// <param name="note"></param> public void Update(Member member) { dal.Update(member.ID, member.Password, member.Nickname, member.Avatar, member.Sex, member.Email, member.TelePhone, member.Note); }
/// <summary> /// 根据会员ID获取会员及详细信息 /// </summary> /// <param name="id"></param> /// <param name="member"></param> /// <param name="details"></param> public void GetMemberDetails(int id, out Member member, out MemberDetails details) { Member m=null; MemberDetails d=null; dal.GetMemberDetailsByID(id, rd => { if (rd.HasRows) { rd.Read(); FillMemberDetails(rd, out m, out d); } }); member = m; details = d; }