Пример #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);
            }
        }
Пример #2
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);
            }
        }