Example #1
0
        public LoginRs CallLogin(LoginRq request)
        {
            string serviceUrl = ServiceURL.ipServer + ServiceURL.loginUrl;
            String resJSON    = CallServices.callPost(serviceUrl, request);

            return(JObject.Parse(resJSON).ToObject <LoginRs>());
        }
Example #2
0
        //public async Task<UIReturn> AuthenuserAsync(Login input)
        //{
        //    if (isEmptyUserName(input)) return new UIReturn(input, false, "", Constants.emptyUserName);
        //    if (isEmptyPassword(input)) return new UIReturn(input, false, "", Constants.emptyPassword);
        //    if (!isValidEmail(input)) return new UIReturn(input, false, "", Constants.invalidEmail);

        //    //List<SampleJSONService> result = await SampleService.CallGetAsync();
        //    SampleJSONService result = await SampleService.CallPostAsync();

        //    UIReturn ret = new UIReturn(input);
        //    if (authen(input, result))
        //    {
        //        input.isLogin = true;
        //        MCust.login = input;
        //    }
        //    else
        //    {
        //        ret.setFail("", Constants.authenFail);
        //    }
        //    return ret;
        //}
        public UIReturn LoginMember(Login input)
        {
            if (String.IsNullOrEmpty(input.username))
            {
                return(Constants.uiErrorEmptyUserName);
            }
            if (String.IsNullOrEmpty(input.password))
            {
                return(Constants.uiErrorEmptyPassword);
            }
            if (!Validate.isEmailFormat(input.username))
            {
                return(Constants.uiErrorInvalidEmail);
            }

            LoginRq req = LoginService.getInstance().getLoginRq(input);
            LoginRs res = LoginService.getInstance().CallLogin(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);
        }
Example #3
0
        public LoginRq getLoginRq(Login input)
        {
            LoginRq ret = JObject.Parse(JsonConvert.SerializeObject(input)).ToObject <LoginRq>();

            return(ret);
        }