示例#1
0
        public RegisterRs CallRegister(RegisterRq request)
        {
            string serviceUrl = ServiceURL.ipServer + ServiceURL.registerUrl;
            String resJSON    = CallServices.callPost(serviceUrl, request);

            return(JObject.Parse(resJSON).ToObject <RegisterRs>());
        }
        public UIReturn register(Member input)
        {
            if (String.IsNullOrEmpty(input.email))
            {
                return(Constants.uiErrorEmptyEmail);
            }
            if (String.IsNullOrEmpty(input.password))
            {
                return(Constants.uiErrorEmptyPassword);
            }
            if (String.IsNullOrEmpty(input.confirmPassword))
            {
                return(Constants.uiErrorEmptyConfirmPassword);
            }
            if (String.IsNullOrEmpty(input.firstName))
            {
                return(Constants.uiErrorEmptyFirstName);
            }
            if (String.IsNullOrEmpty(input.lastName))
            {
                return(Constants.uiErrorEmptyLastName);
            }
            if (String.IsNullOrEmpty(input.birthDate))
            {
                return(Constants.uiErrorEmptyBirthdate);
            }
            if (!Validate.isDateFormat(input.birthDate))
            {
                return(Constants.uiErrorInvalidDateFormat);
            }
            if (!String.IsNullOrEmpty(input.tel) && !Validate.isPhoneNumber(input.tel))
            {
                return(Constants.uiErrorInvalidPhoneNumber);
            }
            if (!Validate.isEmailFormat(input.email))
            {
                return(Constants.uiErrorInvalidEmail);
            }
            if (!isSamePassword(input))
            {
                return(Constants.uiErrorPasswordNotMatch);
            }

            RegisterRq req = MemberService.getInstance().getRegisterRq(input);
            RegisterRs res = MemberService.getInstance().CallRegister(req);

            if (res.header.isSuccess)
            {
                SessionModel.loginMember = res.member;
                App.Database.SaveItem(DBConstants.ID_LOGIN_MEMBER, JsonConvert.SerializeObject(SessionModel.loginMember));
            }

            UIReturn ret = new UIReturn(res.header);

            return(ret);
        }
示例#3
0
        public RegisterRq getRegisterRq(Member input)
        {
            RegisterRq ret = JObject.Parse(JsonConvert.SerializeObject(input)).ToObject <RegisterRq>();

            return(ret);
        }