//更新付费用户信息。
        //页面上传过来的paymentRegisterUser只有部分信息,username 和关于付费相关的两个信息
        //我需要根据他的id的到所有的信息后,更新和付费相关的信息,然后再调用数据库的update
        public bool UpdatePaymentUser(PaymentRegisterUser updataUser)
        {
            //的到用户旧的信息...
            try
            {
                ISingleResult<getUserByUserNameResult> result = dc.getUserByUserName(updataUser.UserName);
                foreach (getUserByUserNameResult old in result)
                {
                    updataUser.Address = old.address;
                    updataUser.City = old.city;
                    updataUser.Email = old.email;
                    //updataUser.IsPayUser = true;
                    updataUser.NickName = old.nickname;
                    updataUser.Password = old.pwd;
                    updataUser.Phone = old.phone;
                    updataUser.Portrait = old.portraitPath;
                    updataUser.School = old.school;

                    //updataUser.ZoneStyle = old.zonestyleid
                }
                int ispay = 2;
                if (updataUser.IsPayUser == true)
                {
                    ispay = 2;
                }
                else
                {
                    ispay = 1;
                }
                dc.updateRegistedUser(updataUser.UserName, updataUser.Password, updataUser.NickName, updataUser.Email, updataUser.Phone, updataUser.ZoneStyle.FileUrl, updataUser.Portrait, updataUser.City, updataUser.School, updataUser.Address, new int?(ispay), new double?(updataUser.PayAmount), new DateTime?(updataUser.paymentEndTime));
            }
            catch (Exception e)
            {
                return false;
            }
            return true;
        }
        //得到所有付费用户
        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;
        }
        //验证登陆用户
        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;
        }