//验证登陆用户 public RegistedUser Login(string userName, string passWord) { // RegistedUser RightUser = new RegistedUser(); bool? flag = false; ISingleResult<isRegistedResult> result = dc.isRegisted(userName,passWord,ref flag); if (flag == false) { RegistedUser temp = new RegistedUser(); temp.UserName = ""; //RightUser = null; return temp; } else { foreach (isRegistedResult user in result) { if (user.type == 1) { NonPaymentRegisterUser NoPayUser = new NonPaymentRegisterUser(); NoPayUser.Address = user.address; NoPayUser.City = user.city; NoPayUser.Email = user.email; NoPayUser.NickName = user.nickname; NoPayUser.Phone = user.phone; NoPayUser.Portrait = user.portraitPath; NoPayUser.School = user.school; NoPayUser.UserName = user.id; UserZoneStyle otherStyle = new UserZoneStyle(); otherStyle.ID = null; otherStyle.FileUrl = user.zonestyleid; NoPayUser.ZoneStyle = otherStyle; NoPayUser.UserName = user.id; NoPayUser.Userservice = new RegisterUserService(); NoPayUser.UserService = new NonPaymentUserService(); return NoPayUser; } else if(user.type ==2) { PaymentRegisterUser payUser = new PaymentRegisterUser(); payUser.Address = user.address; payUser.City = user.city; payUser.Email = user.email; payUser.NickName = user.nickname; payUser.Phone = user.phone; payUser.Portrait = user.portraitPath; payUser.School = user.school; payUser.UserName = user.id; UserZoneStyle otherStyle = new UserZoneStyle(); otherStyle.ID = null; otherStyle.FileUrl = user.zonestyleid; payUser.ZoneStyle = otherStyle; payUser.UserName = user.id; return payUser; } } } return null; }
//得到所有付费用户 public List<PaymentRegisterUser> GetAllPaymentUser() { List<PaymentRegisterUser> PayRegistefUserList = new List<PaymentRegisterUser>(); ISingleResult<getAllPayUserResult> result = dc.getAllPayUser(); foreach (getAllPayUserResult user in result) { PaymentRegisterUser payUser = new PaymentRegisterUser(); //父类信息 payUser.Address = user.address; payUser.City = user.city; payUser.Email = user.email; payUser.NickName = user.nickname; //payUser.Password = null; payUser.Phone = user.phone; payUser.Portrait = user.portraitPath; payUser.School = user.school; payUser.UserName = user.id; UserZoneStyle otherStyle = new UserZoneStyle(); otherStyle.ID = null; otherStyle.FileUrl = user.zonestyleid; payUser.ZoneStyle = otherStyle; //子类特有信息 payUser.PayAmount = user.payamount.Value; payUser.paymentEndTime = user.payendtime.Value; } return PayRegistefUserList; }
//通过用户id的到别的用户的实例 public RegistedUser GetOtherUserInfo(string userName) { ISingleResult<getUserByUserNameResult> result = dc.getUserByUserName(userName); RegistedUser otherUser = new RegistedUser(); foreach(getUserByUserNameResult user in result) { otherUser.Address = user.address; otherUser.City = user.city; otherUser.Email = user.email; otherUser.NickName = user.nickname; //otherUser.Password = null; otherUser.Phone = user.phone; otherUser.Portrait = user.portraitPath; otherUser.School = user.school; otherUser.UserName = user.id; UserZoneStyle otherStyle = new UserZoneStyle(); otherStyle.ID = null; otherStyle.FileUrl = user.zonestyleid; otherUser.ZoneStyle = otherStyle; } return otherUser; }