public UIReturn LoginBranch(Login input)
        {
            if (String.IsNullOrEmpty(input.username))
            {
                return(Constants.uiErrorEmptyUserName);
            }
            if (String.IsNullOrEmpty(input.password))
            {
                return(Constants.uiErrorEmptyPassword);
            }

            BranchLoginRq req = BranchLoginService.getInstance().getBranchLoginRq(input);
            BranchLoginRs res = BranchLoginService.getInstance().CallLogin(req);

            if (res.header.isSuccess)
            {
                BranchSessionModel.loginBranch = res.branch;
                App.Database.SaveItem(DBConstants.ID_LOGIN_BRANCH, JsonConvert.SerializeObject(BranchSessionModel.loginBranch));
            }


            UIReturn ret = new UIReturn(res.header);

            return(ret);
        }
Пример #2
0
        public BranchLoginRs CallLogin(BranchLoginRq request)
        {
            string serviceUrl = ServiceURL.ipServer + ServiceURL.branchLoginUrl;
            String resJSON    = CallServices.callPost(serviceUrl, request);

            return(JObject.Parse(resJSON).ToObject <BranchLoginRs>());
        }
Пример #3
0
        public BranchLoginRq getBranchLoginRq(Login input)
        {
            BranchLoginRq ret = JObject.Parse(JsonConvert.SerializeObject(input)).ToObject <BranchLoginRq>();

            return(ret);
        }