Ejemplo n.º 1
0
        /// <summary>
        /// 签到,查询
        /// <param name="queryOnly">true:查询 false:签到</param>
        /// </summary>
        /// <returns></returns>
        public async Task <DoSignResponseData> DoSign(string queryOnly)
        {
            DoSignRequestParams sParams = new DoSignRequestParams();

            sParams.deviceId = Configuration.GetDeviceUniqueId();
            sParams.queryOny = queryOnly;
            HttpSerializeData <DoSignRequestParams> httpSerializeData = new HttpSerializeData <DoSignRequestParams>("doSign.html", sParams);
            NetworkRequest networkRequest = NetworkRequest.CreateHttp(httpSerializeData.GetURL());
            var            resultJson     = await networkRequest.PostAsync <string>(JsonAnalysis.Serialize(httpSerializeData));

            HttpDeserializeData <DoSignResponseData> sData = JsonAnalysis.Deserialize <HttpDeserializeData <DoSignResponseData> >(resultJson);

            if (queryOnly.Equals("false"))
            {
            }
            if (sData.result.error == "00")// 签到成功
            {
                return(sData.result);
            }
            else if (sData.status.code.Equals("0000"))
            {
                return(sData.result);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        public async Task <bool> GetUserInfo()
        {
            GetUserInforRequestParams sParams = new GetUserInforRequestParams();

            sParams.deviceId = Configuration.GetDeviceUniqueId();
            HttpSerializeData <GetUserInforRequestParams> httpSerializeData = new HttpSerializeData <GetUserInforRequestParams>("getUserInfo.html", sParams);
            NetworkRequest networkRequest = NetworkRequest.CreateHttp(httpSerializeData.GetURL());
            var            resultJson     = await networkRequest.PostAsync <string>(JsonAnalysis.Serialize(httpSerializeData));

            if (!string.IsNullOrEmpty(resultJson))
            {
                HttpDeserializeData <GetUserInforResponseData> sData = JsonAnalysis.Deserialize <HttpDeserializeData <GetUserInforResponseData> >(resultJson);

                if (sData.result.error == "01")   // 未绑定账户
                {
                    //todo:跳转到绑定页面,进行用户绑定
                    (Window.Current.Content as Frame).Navigate(typeof(BindDevicePage));
                }
                else if (sData.status.code.Equals("0000"))
                {
                    //todo:跳转到签到页面
                    (Window.Current.Content as Frame).Navigate(typeof(SignPage));
                }
                else
                {
                }
                return(true);
            }
            return(false);
        }
Ejemplo n.º 3
0
        private async void BindDevice()
        {
            BindDeviceRequest sParams = new BindDeviceRequest();

            sParams.deviceId = Configuration.GetDeviceUniqueId();
            sParams.userName = "******";

            HttpSerializeData <BindDeviceRequest> httpSerializeData = new HttpSerializeData <BindDeviceRequest>("bindDevice.html", sParams);
            string         url            = httpSerializeData.GetURL();
            NetworkRequest networkRequest = NetworkRequest.CreateHttp(httpSerializeData.GetURL());
            var            result         = await networkRequest.PostAsync <string>(JsonAnalysis.Serialize(httpSerializeData));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 签到,查询
        /// <param name="queryOnly">true:查询 false:签到</param>
        /// </summary>
        /// <returns></returns>
        public async Task <DoSignResponseData> DoSign(string queryOnly)
        {
            DoSignRequestParams sParams = new DoSignRequestParams();

            sParams.deviceId = Configuration.GetDeviceUniqueId();
            sParams.queryOny = queryOnly;
            HttpSerializeData <DoSignRequestParams> httpSerializeData = new HttpSerializeData <DoSignRequestParams>("doSign.html", sParams);
            NetworkRequest networkRequest = NetworkRequest.CreateHttp(httpSerializeData.GetURL());
            var            resultJson     = await networkRequest.PostAsync <string>(JsonAnalysis.Serialize(httpSerializeData));

            HttpDeserializeData <DoSignResponseData> sData = JsonAnalysis.Deserialize <HttpDeserializeData <DoSignResponseData> >(resultJson);

            if (sData == null)
            {
                //todo:报错
                var res = CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    var msg = new MessageDialog("网络请求错误!").ShowAsync();
                });
            }
            if (queryOnly.Equals("false"))
            {
            }
            if (sData.result.error == "00")// 签到成功
            {
                this.SystemTime  = sData.result.sysTime;
                this.SignInTime  = sData.result.signInTime;
                this.SignOutTime = sData.result.signOutTime;
                this.UserName    = sData.result.realName;
                return(sData.result);
            }
            else if (sData.status.code.Equals("0000"))
            {
                this.SystemTime  = sData.result.sysTime;
                this.SignInTime  = sData.result.signInTime;
                this.SignOutTime = sData.result.signOutTime;
                this.UserName    = sData.result.realName;
                if (queryOnly.Equals("false"))
                {
                    //todo:报错
                    var res = CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        var msg = new MessageDialog(sData.result.errorMsg).ShowAsync();
                    });
                }
                return(sData.result);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 5
0
        public async Task <string> BindDevice(string userName)
        {
            BindDeviceRequest sParams = new BindDeviceRequest();

            sParams.deviceId = Configuration.GetDeviceUniqueId();
            sParams.userName = userName;

            HttpSerializeData <BindDeviceRequest> httpSerializeData = new HttpSerializeData <BindDeviceRequest>("bindDevice.html", sParams);
            string         url            = httpSerializeData.GetURL();
            NetworkRequest networkRequest = NetworkRequest.CreateHttp(httpSerializeData.GetURL());
            var            result         = await networkRequest.PostAsync <string>(JsonAnalysis.Serialize(httpSerializeData));

            return(result);
        }
Ejemplo n.º 6
0
        private async void GetUserInfo()
        {
            GetUserInforRequestParams sParams = new GetUserInforRequestParams();

            sParams.deviceId = Configuration.GetDeviceUniqueId();
            HttpSerializeData <GetUserInforRequestParams> httpSerializeData = new HttpSerializeData <GetUserInforRequestParams>("getUserInfo.html", sParams);
            NetworkRequest networkRequest = NetworkRequest.CreateHttp(httpSerializeData.GetURL());
            var            resultJson     = await networkRequest.PostAsync <string>(JsonAnalysis.Serialize(httpSerializeData));

            HttpDeserializeData <GetUserInforResponseData> sData = JsonAnalysis.Deserialize <HttpDeserializeData <GetUserInforResponseData> >(resultJson);

            if (sData.result.error == "01")   // 未绑定账户
            {
                //todo:跳转到绑定页面,进行用户绑定
            }
            else if (sData.status.code.Equals("0000"))
            {
                //todo:跳转到签到页面
            }
            else
            {
            }
        }