public UIReturn changePassword(Member input)
        {
            if (String.IsNullOrEmpty(input.password))
            {
                return(Constants.uiErrorEmptyPassword);
            }
            if (String.IsNullOrEmpty(input.confirmPassword))
            {
                return(Constants.uiErrorEmptyConfirmPassword);
            }
            if (!isSamePassword(input))
            {
                return(Constants.uiErrorPasswordNotMatch);
            }

            EditProfileRq req = MemberService.getInstance().getEditProfileRq(input);
            EditProfileRs res = MemberService.getInstance().CallEditProfile(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);
        }
Exemplo n.º 2
0
        public EditProfileRs CallEditProfile(EditProfileRq request)
        {
            string serviceUrl = ServiceURL.ipServer + ServiceURL.editProfileUrl;
            String resJSON    = CallServices.callPost(serviceUrl, request);

            return(JObject.Parse(resJSON).ToObject <EditProfileRs>());
        }
        public UIReturn editProfile(Member input)
        {
            if (String.IsNullOrEmpty(input.email))
            {
                return(Constants.uiErrorEmptyEmail);
            }
            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);
            }

            EditProfileRq req = MemberService.getInstance().getEditProfileRq(input);
            EditProfileRs res = MemberService.getInstance().CallEditProfile(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);
        }
Exemplo n.º 4
0
        public EditProfileRq getEditProfileRq(Member input)
        {
            EditProfileRq ret = JObject.Parse(JsonConvert.SerializeObject(input)).ToObject <EditProfileRq>();

            return(ret);
        }