Пример #1
0
        private void InitView()
        {
            ProgressDialogUtil.StartProgressDialog(this, "正在加载体检详细信息...");
            //设置标题栏
            var btn_header_back = FindViewById <Button> (Resource.Id.btn_header_back);

            btn_header_back.Click += (sender, e) =>
            {
                this.Finish();
                OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
            };
            FindViewById <TextView> (Resource.Id.tv_header_title).Text = "健康信息详情";

            //获取列表传递详细数据
            var _healthItemInfoJson = Intent.GetStringExtra("healthInfo");

            healthInfoItem                = JsonConvert.DeserializeObject <HealthInfoItem> (_healthItemInfoJson);
            tv_TestTime                   = FindViewById <TextView> (Resource.Id.tv_TestTime);
            tv_Height                     = FindViewById <TextView> (Resource.Id.tv_Height);
            tv_Weight                     = FindViewById <TextView> (Resource.Id.tv_Weight);
            tv_BMI                        = FindViewById <TextView> (Resource.Id.tv_BMI);
            tv_BloodGlucose               = FindViewById <TextView> (Resource.Id.tv_BloodGlucose);
            tv_BloodOxygenParaOne         = FindViewById <TextView> (Resource.Id.tv_BloodOxygenParaOne);
            tv_HeartRate                  = FindViewById <TextView> (Resource.Id.tv_HeartRate);
            tv_BreathCapacity             = FindViewById <TextView> (Resource.Id.tv_BreathCapacity);
            tv_BodyTemperature            = FindViewById <TextView> (Resource.Id.tv_BodyTemperature);
            tv_BloodPressureParaTwo       = FindViewById <TextView> (Resource.Id.tv_BloodPressureParaTwo);
            tv_BloodPressureParaOne       = FindViewById <TextView> (Resource.Id.tv_BloodPressureParaOne);
            tv_BloodLipidParaOne          = FindViewById <TextView> (Resource.Id.tv_BloodLipidParaOne);
            tv_BloodLipidParaFour         = FindViewById <TextView> (Resource.Id.tv_BloodLipidParaFour);
            tv_BloodLipidParaTwo          = FindViewById <TextView> (Resource.Id.tv_BloodLipidParaTwo);
            tv_BloodLipidParaThree        = FindViewById <TextView> (Resource.Id.tv_BloodLipidParaThree);
            tv_UrineRoutinePH             = FindViewById <TextView> (Resource.Id.tv_UrineRoutinePH);
            tv_UrineRoutineSG             = FindViewById <TextView> (Resource.Id.tv_UrineRoutineSG);
            tv_UrineRoutineURO            = FindViewById <TextView> (Resource.Id.tv_UrineRoutineURO);
            tv_UrineRoutineWBC            = FindViewById <TextView> (Resource.Id.tv_UrineRoutineWBC);
            tv_UrineRoutineBLO            = FindViewById <TextView> (Resource.Id.tv_UrineRoutineBLO);
            tv_UrineRoutineKET            = FindViewById <TextView> (Resource.Id.tv_UrineRoutineKET);
            tv_UrineRoutineGLU            = FindViewById <TextView> (Resource.Id.tv_UrineRoutineGLU);
            tv_UrineRoutineRPO            = FindViewById <TextView> (Resource.Id.tv_UrineRoutineRPO);
            tv_UrineRoutineBIL            = FindViewById <TextView> (Resource.Id.tv_UrineRoutineBIL);
            img_BMI_Arraw                 = FindViewById <ImageView> (Resource.Id.img_BMI_Arraw);
            img_BloodGlucose_Arraw        = FindViewById <ImageView> (Resource.Id.img_BloodGlucose_Arraw);
            img_BloodOxygenParaOne_Arraw  = FindViewById <ImageView> (Resource.Id.img_BloodOxygenParaOne_Arraw);
            img_HeartRate_Arraw           = FindViewById <ImageView> (Resource.Id.img_HeartRate_Arraw);
            img_BreathCapacity_Arraw      = FindViewById <ImageView> (Resource.Id.img_BreathCapacity_Arraw);
            img_BodyTemperature_Arraw     = FindViewById <ImageView> (Resource.Id.img_BodyTemperature_Arraw);
            img_BloodLipidParaOne_Arraw   = FindViewById <ImageView> (Resource.Id.img_BloodLipidParaOne_Arraw);
            img_BloodLipidParaFour_Arraw  = FindViewById <ImageView> (Resource.Id.img_BloodLipidParaFour_Arraw);
            img_BloodLipidParaTwo_Arraw   = FindViewById <ImageView> (Resource.Id.img_BloodLipidParaTwo_Arraw);
            img_BloodLipidParaThree_Arraw = FindViewById <ImageView> (Resource.Id.img_BloodLipidParaThree_Arraw);
            img_UrineRoutinePH_Arraw      = FindViewById <ImageView> (Resource.Id.img_UrineRoutinePH_Arraw);
            img_UrineRoutineSG_Arraw      = FindViewById <ImageView> (Resource.Id.img_UrineRoutineSG_Arraw);
            img_UrineRoutineURO_Arraw     = FindViewById <ImageView> (Resource.Id.img_UrineRoutineURO_Arraw);

            new Handler().PostDelayed(LoadData, 1000);
        }
 /// <summary>
 ///获取交易详情
 /// </summary>
 private void LoadData(string dealRecordId)
 {
     ProgressDialogUtil.StartProgressDialog(this, "正在获取交易详细数据...");
     //检测网络连接
     if (!EldYoungUtil.IsConnected(this))
     {
         Toast.MakeText(this, "网络连接超时,请检测网路", ToastLength.Short).Show();
         ProgressDialogUtil.StopProgressDialog();
         return;
     }
     //todo:调用webservice赋值
 }
        /// <summary>
        /// Submit this instance.
        /// </summary>
        private void Submit()
        {
            passWord = edit_Pwd.Text;
            if (string.IsNullOrEmpty(passWord))
            {
                Toast.MakeText(this, "密码不能为空,请输入密码", ToastLength.Short).Show();
                return;
            }
            confirmPassWord = edit_ConfirmPwd.Text;
            if (string.IsNullOrEmpty(confirmPassWord))
            {
                Toast.MakeText(this, "确认密码不能为空,请输入确认密码", ToastLength.Short).Show();
                return;
            }
            if (passWord != confirmPassWord)
            {
                Toast.MakeText(this, "输入两次密码不一致,请检查", ToastLength.Short).Show();
                return;
            }
            if (!EldYoungUtil.IsPassWord(passWord))
            {
                Toast.MakeText(this, "请输入正确规范用户名6-20位,建议由字母、数字和符号两种以上组成", ToastLength.Short).Show();
                return;
            }
            ProgressDialogUtil.StartProgressDialog(this, "正在提交...");
            //检测网络连接
            if (!EldYoungUtil.IsConnected(this))
            {
                Toast.MakeText(this, "网络连接超时,请检测网路", ToastLength.Short).Show();
                ProgressDialogUtil.StopProgressDialog();
                return;
            }
            //调用restapi注册,将用户名、密码信息写
            var modipwdParam = new ModiyPasswordParam()
            {
                Type = sendType, Password = passWord
            };

            if (sendType == "FindPwd")
            {
                modipwdParam.UId = phoneNumber;
            }
            else
            {
                modipwdParam.UId = Global.MyInfo.UId;
            }

            //初始化参数
            SetRestRequestParams(modipwdParam);
            var restSharpRequestHelp = new RestSharpRequestHelp(modipwdParam.Url, requestsubmitParams);

            restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) => {
                if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    //获取并解析返回resultJson获取安全码结果值
                    var result     = response.Content;
                    var setpwdJson = JsonConvert.DeserializeObject <SetPasswordJson>(result);
                    if (setpwdJson.statuscode == "1")
                    {
                        RunOnUiThread(() => {
                            Toast.MakeText(this, setpwdJson.message, ToastLength.Short).Show();
                            ProgressDialogUtil.StopProgressDialog();
                            var intent = new Intent(this, typeof(LoginActivity));
                            intent.SetFlags(ActivityFlags.ClearTask | ActivityFlags.NewTask);
                            StartActivity(intent);

                            this.Finish();
                        });
                    }
                    else
                    {
                        RunOnUiThread(() =>
                        {
                            Toast.MakeText(this, setpwdJson.message, ToastLength.Short).Show();
                            ProgressDialogUtil.StopProgressDialog();
                            return;
                        });
                    }
                }
                else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut)
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, "网络连接超时,请重试", ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        return;
                    });
                }
                else
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, response.StatusDescription, ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        return;
                    });
                }
            });
        }
Пример #4
0
        private void InitView()
        {
            //设置标题栏
            var img_header_back = FindViewById <ImageView> (Resource.Id.img_header_back);

            img_header_back.Click += (sender, e) =>
            {
                this.Finish();
                OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
            };

            var tv_back = FindViewById <TextView> (Resource.Id.tv_back);

            tv_back.Text = "返回";
            var tv_desc = FindViewById <TextView> (Resource.Id.tv_desc);

            //取得上一页面传递过来的值包括是什么类型发送验证码(找回密码\修改支付密码\修改密码)
            var bundle = Intent.Extras;

            sendType    = bundle.GetString("SendType");
            phoneNumber = bundle.GetString("PhoneNumber");


            tv_SendCodeStatusShow = FindViewById <TextView>(Resource.Id.tv_SendCodeStatusShow);
            edit_Phone            = FindViewById <EditText> (Resource.Id.edit_Phone);
            edit_Phone.Text       = phoneNumber;
            if (sendType == "FindPwd")
            {
                tv_desc.Text       = "找回登录密码";
                edit_Phone.Enabled = true;
                edit_Phone.Hint    = "请输入手机号";
            }
            else if (sendType == "ModifyPwd")
            {
                tv_desc.Text       = "修改登录密码";
                edit_Phone.Enabled = false;
                SetPhoneNumberShow();
            }
            else if (sendType == "ModifyPayPwd")
            {
                tv_desc.Text       = "设置支付密码";
                edit_Phone.Enabled = false;
                SetPhoneNumberShow();
            }
            edit_SecurityCode = FindViewById <EditText> (Resource.Id.edit_SecurityCode);
            btn_Send          = FindViewById <Button> (Resource.Id.btn_Send);
            btn_Next          = FindViewById <Button> (Resource.Id.btn_Next);

            //初始化计时器,启动
            mc = new MyCount(this, 60000, 1000);
            //发送验证码
            btn_Send.Click += (sender, e) =>
            {
                tv_SendCodeStatusShow.Visibility = ViewStates.Invisible;
                btn_Send.Enabled = false;
                SendCode();
            };

            edit_SecurityCode.TextChanged += (sender, e) =>
            {
                if (edit_SecurityCode.Text.Length > 0)
                {
                    btn_Next.Enabled = true;
                }
                else
                {
                    btn_Next.Enabled = false;
                }
            };
            //下一步
            btn_Next.Click += (sender, e) =>
            {
                var inputCode = edit_SecurityCode.Text;

                if (string.IsNullOrEmpty(inputCode) || !EldYoungUtil.IsSecurityCode(inputCode))
                {
                    Toast.MakeText(this, "请输入接收到的手机验证码,且不能为空", ToastLength.Short).Show();
                    return;
                }
                if (inputCode != securityCode)
                {
                    Toast.MakeText(this, "输入验证码不正确,请重新填写", ToastLength.Short).Show();
                    return;
                }
                var intent     = new Intent(this, typeof(SetPasswordActivity));
                var nextbundle = new Bundle();
                nextbundle.PutString("SendType", sendType);
                if (sendType == "FindPwd")
                {
                    nextbundle.PutString("PhoneNumber", phoneNumber);
                }
                intent.PutExtras(nextbundle);
                StartActivity(intent);
                if (sendType != "FindPwd")
                {
                    this.Finish();
                }
                ProgressDialogUtil.StopProgressDialog();
            };
            //拨打客服
            var tv_customPhone = FindViewById <TextView>(Resource.Id.tv_customPhone);
            var customPhoneNum = tv_customPhone.Text;

            tv_customPhone.Click += (sender, e) =>
            {
                Intent intent = new Intent(Intent.ActionCall, Android.Net.Uri.Parse("tel:" + customPhoneNum));
                StartActivity(intent);
            };
        }
        /// <summary>
        /// 事件处理程序
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        private void ActionHandler(object sender, EventArgs e)
        {
            var btnAction  = sender as Button;
            var item       = (GetApplyInfoListItem)btnAction.Tag;
            var actionflag = btnAction.GetTag(Resource.Id.ll_action);

            ProgressDialogUtil.StartProgressDialog(activity, "正在处理中...");
            //检测网络连接
            if (!EldYoungUtil.IsConnected(activity))
            {
                Toast.MakeText(activity, "网络连接超时,请检测网路", ToastLength.Short).Show();
                ProgressDialogUtil.StopProgressDialog();
                return;
            }

            examinebundGuardianParam.Ifagreen = actionflag.ToString();
            examinebundGuardianParam.Id       = item.Id;

            if (!requestParams.ContainsKey("eId"))
            {
                requestParams.Add("eId", examinebundGuardianParam.Eid);
            }
            else
            {
                requestParams ["eId"] = examinebundGuardianParam.Eid;
            }

            if (!requestParams.ContainsKey("eifagreen"))
            {
                requestParams.Add("eifagreen", examinebundGuardianParam.Eifagreen);
            }
            else
            {
                requestParams ["eifagreen"] = examinebundGuardianParam.Eifagreen;
            }

            if (!requestParams.ContainsKey("eaction"))
            {
                requestParams.Add("eaction", examinebundGuardianParam.Eaction);
            }
            else
            {
                requestParams ["eaction"] = examinebundGuardianParam.Eaction;
            }

            if (!requestParams.ContainsKey("md5"))
            {
                requestParams.Add("md5", examinebundGuardianParam.Md5);
            }
            else
            {
                requestParams ["md5"] = examinebundGuardianParam.Md5;
            }

            if (!requestParams.ContainsKey("key"))
            {
                requestParams.Add("key", examinebundGuardianParam.Key);
            }
            else
            {
                requestParams ["key"] = examinebundGuardianParam.Key;
            }

            //设置restsharprequest
            if (restSharpRequestHelp == null)
            {
                restSharpRequestHelp = new RestSharpRequestHelp(examinebundGuardianParam.Url, requestParams);
            }
            else
            {
                restSharpRequestHelp.RequestParams = requestParams;
            }
            restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) => {
                if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    var result = response.Content;
                    var examinebundGuardianJson = JsonConvert.DeserializeObject <ExamineBundGuardianJson>(result);
                    if (examinebundGuardianJson.statuscode == "1")
                    {
                        activity.RunOnUiThread(() =>
                        {
                            Toast.MakeText(activity, "处理成功...", ToastLength.Short).Show();
                            ProgressDialogUtil.StopProgressDialog();
                            Remove(item);
                            return;
                        });
                    }
                    else
                    {
                        activity.RunOnUiThread(() =>
                        {
                            Toast.MakeText(activity, "处理失败,稍后在试...", ToastLength.Short).Show();
                            ProgressDialogUtil.StopProgressDialog();
                            return;
                        });
                    }
                }
                else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut)
                {
                    activity.RunOnUiThread(() =>
                    {
                        Toast.MakeText(activity, "网络连接超时,稍后在试...", ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        return;
                    });
                }
                else
                {
                    activity.RunOnUiThread(() =>
                    {
                        Toast.MakeText(activity, response.StatusDescription, ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        return;
                    });
                }
            });
        }
        private void LoadDetailData()
        {
            ProgressDialogUtil.StartProgressDialog(this, "正在加载报警详细数据...");
            if (string.IsNullOrEmpty(alarmId))
            {
                ProgressDialogUtil.StopProgressDialog();
                return;
            }
            //检测网络连接
            if (!EldYoungUtil.IsConnected(this))
            {
                Toast.MakeText(this, "网络连接超时,请检测网路", ToastLength.Short).Show();
                ProgressDialogUtil.StopProgressDialog();
                return;
            }
            alarmInfoDetailParam = new AlarmInfoDetailParam()
            {
                AId = alarmId
            };

            if (!requestParams.ContainsKey("key"))
            {
                requestParams.Add("key", alarmInfoDetailParam.Key);
            }
            else
            {
                requestParams ["eAId"] = alarmInfoDetailParam.Key;
            }
            if (!requestParams.ContainsKey("eAId"))
            {
                requestParams.Add("eAId", alarmInfoDetailParam.EaId);
            }

            if (!requestParams.ContainsKey("eaction"))
            {
                requestParams.Add("eaction", alarmInfoDetailParam.Eaction);
            }
            else
            {
                requestParams ["eaction"] = alarmInfoDetailParam.Eaction;
            }

            if (!requestParams.ContainsKey("md5"))
            {
                requestParams.Add("md5", alarmInfoDetailParam.Md5);
            }
            else
            {
                requestParams ["md5"] = alarmInfoDetailParam.Md5;
            }

            //设置restsharprequest
            if (restSharpRequestHelp == null)
            {
                restSharpRequestHelp = new RestSharpRequestHelp(alarmInfoDetailParam.Url, requestParams);
            }
            else
            {
                restSharpRequestHelp.RequestParams = requestParams;
            }
            //调用webservice
            restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) => {
                if (response.ResponseStatus == ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    var result = response.Content;
                    var alarmdetailInfoJson = JsonConvert.DeserializeObject <SearchAlarmDeatilInfoJson>(result);
                    if (alarmdetailInfoJson.statuscode == "1")
                    {
                        if (alarmdetailInfoJson.data.detail.Count > 0)
                        {
                            var detail = alarmdetailInfoJson.data.detail[0];
                            RunOnUiThread(() =>
                            {
                                tv_detail_alamTime.Text      = string.IsNullOrEmpty(detail.AlarmTime)?string.Empty:Convert.ToDateTime(detail.AlarmTime).ToString("yyyy-MM-dd HH:mm:ss");
                                tv_detail_alarmContent.Text  = EldYoungUtil.FormatStrVaue(detail.AlarmContent);
                                tv_detail_alarmDeviceId.Text = EldYoungUtil.FormatStrVaue(detail.AlarmDeviceId);
                                tv_detail_alarmPosition.Text = EldYoungUtil.FormatStrVaue(detail.AlarmPosition);
                                alarmPosition                    = EldYoungUtil.FormatStrVaue(detail.AlarmPosition);
                                tv_detail_alarmWay.Text          = EldYoungUtil.FormatStrVaue(detail.AlarmWay);
                                tv_detail_cphoneNumberOne.Text   = EldYoungUtil.FormatStrVaue(detail.CPhoneNumberOne);
                                tv_detail_cTrueName.Text         = EldYoungUtil.FormatStrVaue(detail.CTrueName);
                                tv_detail_deviceElectricity.Text = EldYoungUtil.FormatStrVaue(detail.DeviceElectricity);
                                tv_detail_handleUserType.Text    = EldYoungUtil.FormatStrVaue(detail.HandleUserType);
                                tv_detail_remark.Text            = EldYoungUtil.FormatStrVaue(detail.Remark);
                                tv_detail_status.Text            = EldYoungUtil.FormatStrVaue(detail.Status);
                                tv_detail_trueName.Text          = EldYoungUtil.FormatStrVaue(detail.TrueName);
                            });
                        }

                        if (alarmdetailInfoJson.data.handdetail.Count > 0)
                        {
                            var handleDetails = alarmdetailInfoJson.data.handdetail;
                            RunOnUiThread(() =>
                            {
                                lv_handleDetail.Adapter = new AlarmHandleDetailInfoAdapter(this, handleDetails);
                            });
                        }
                        RunOnUiThread(() =>
                        {
                            ProgressDialogUtil.StopProgressDialog();
                        });
                    }
                    else
                    {
                        RunOnUiThread(() =>
                        {
                            Toast.MakeText(this, "获取报警详情信息错误...", ToastLength.Short).Show();
                            ProgressDialogUtil.StopProgressDialog();
                            return;
                        });
                    }
                }
                else if (response.ResponseStatus == ResponseStatus.TimedOut)
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, "网络连接超时,稍后在试...", ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();

                        return;
                    });
                }
                else
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, response.StatusDescription, ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();

                        return;
                    });
                }
            });
        }
Пример #7
0
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="phoneNum">Phone number.</param>
        private void SendSMS(string _phoneNumber)
        {
            ProgressDialogUtil.StartProgressDialog(this, "正在发送验证码...");

            //检测网络连接
            if (!EldYoungUtil.IsConnected(this))
            {
                Toast.MakeText(this, "网络连接超时,请检测网路", ToastLength.Short).Show();
                ProgressDialogUtil.StopProgressDialog();
                return;
            }

            var smsInfoParam = new SmsInfoParam()
            {
                PhoneNumber = phoneNumber, NickName = nickName, PassWord = passWord
            };

            //使用restsharpApi方式

            SetRestRequestParams(smsInfoParam);

            var restSharpRequestHelp = new RestSharpRequestHelp(smsInfoParam.Url, requestParams);

            restSharpRequestHelp.ExcuteAsync((resoponse) => {
                if (resoponse.ResponseStatus == ResponseStatus.Completed && resoponse.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    //获取并解析返回resultJson获取安全码结果值
                    var result  = resoponse.Content;
                    var smsJson = JsonConvert.DeserializeObject <SmsJson>(result);
                    if (smsJson.statuscode == "1")
                    {
                        RunOnUiThread(() => {
                            Intent intent = new Intent(this, typeof(RegisterResultActivity));
                            var bundle    = new Bundle();
                            bundle.PutString("phoneNum", phoneNumber);
                            bundle.PutString("nickName", nickName);
                            bundle.PutString("passWord", passWord);
                            bundle.PutString("securityCode", smsJson.data.ToString());
                            intent.PutExtras(bundle);
                            StartActivity(intent);
                        });
                    }
                    else
                    {
                        RunOnUiThread(() =>
                        {
                            Toast.MakeText(this, smsJson.message, ToastLength.Short).Show();
                        });
                    }
                }
                else if (resoponse.ResponseStatus == ResponseStatus.TimedOut)
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, "网络连接超时", ToastLength.Short).Show();
                    });
                }
                else
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, resoponse.StatusDescription, ToastLength.Short).Show();
                    });
                }
                RunOnUiThread(() =>
                {
                    ProgressDialogUtil.StopProgressDialog();
                    return;
                });
            });
        }
Пример #8
0
        /// <summary>
        /// 发送验证码
        /// </summary>
        private void SendCode()
        {
            ProgressDialogUtil.StartProgressDialog(this, "正在发送验证码...");
            //检测网络连接
            if (!EldYoungUtil.IsConnected(this))
            {
                Toast.MakeText(this, "网络连接超时,请检测网络", ToastLength.Short).Show();
                btn_Send.Enabled = true;
                ProgressDialogUtil.StopProgressDialog();
                return;
            }

            var sendCodeParam = new SendCodeParam()
            {
                PhoneNumberOne = phoneNumber, Type = ""
            };

            //使用restsharpApi方式

            SetRestRequestSendCodeParams(sendCodeParam);

            var restSharpRequestHelp = new RestSharpRequestHelp(sendCodeParam.Url, requestsendcodeParams);

            restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) => {
                if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    //获取并解析返回resultJson获取安全码结果值
                    var result       = response.Content;
                    var sendCodeJson = JsonConvert.DeserializeObject <SendCodeJson>(result);
                    if (sendCodeJson.statuscode == "1")
                    {
                        RunOnUiThread(() => {
                            securityCode = sendCodeJson.data.ToString();
                            ProgressDialogUtil.StopProgressDialog();
                            Toast.MakeText(this, "验证码发送成功", ToastLength.Short).Show();
                            tv_SendCodeStatusShow.Visibility = ViewStates.Visible;
                            mc.Start();
                        });
                    }
                    else
                    {
                        RunOnUiThread(() =>
                        {
                            Toast.MakeText(this, sendCodeJson.message, ToastLength.Short).Show();
                            ProgressDialogUtil.StopProgressDialog();
                            btn_Send.Enabled = true;
                            tv_SendCodeStatusShow.Visibility = ViewStates.Invisible;
                            return;
                        });
                    }
                }
                else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut)
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, "网络连接超时", ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        btn_Send.Enabled = true;
                        tv_SendCodeStatusShow.Visibility = ViewStates.Invisible;
                        return;
                    });
                }
                else
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, response.StatusDescription, ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        btn_Send.Enabled = true;
                        tv_SendCodeStatusShow.Visibility = ViewStates.Invisible;
                        return;
                    });
                }
            });
        }
Пример #9
0
        /// <summary>
        /// 解绑监护人
        /// </summary>
        /// <param name="userId">User identifier.</param>
        private void UnBindGuardian(GuardianInfoListItem item)
        {
            //调用webservice
            ProgressDialogUtil.StartProgressDialog(activity, "正在解绑中...");
            //检测网络连接
            if (!EldYoungUtil.IsConnected(activity))
            {
                Toast.MakeText(activity, "网络连接超时,请检测网路", ToastLength.Short).Show();
                ProgressDialogUtil.StopProgressDialog();
                return;
            }

            unBindGuardianParam.Id = item.Id;
            if (!requestParams.ContainsKey("key"))
            {
                requestParams.Add("key", unBindGuardianParam.Key);
            }
            else
            {
                requestParams ["key"] = unBindGuardianParam.Key;
            }
            if (!requestParams.ContainsKey("eId"))
            {
                requestParams.Add("eId", unBindGuardianParam.Eid);
            }
            else
            {
                requestParams ["eId"] = unBindGuardianParam.Eid;
            }
            if (!requestParams.ContainsKey("eaction"))
            {
                requestParams.Add("eaction", unBindGuardianParam.Eaction);
            }
            else
            {
                requestParams ["eaction"] = unBindGuardianParam.Eaction;
            }

            if (!requestParams.ContainsKey("md5"))
            {
                requestParams.Add("md5", unBindGuardianParam.Md5);
            }
            else
            {
                requestParams ["md5"] = unBindGuardianParam.Md5;
            }
            //设置restsharprequest
            if (restSharpRequestHelp == null)
            {
                restSharpRequestHelp = new RestSharpRequestHelp(unBindGuardianParam.Url, requestParams);
            }
            else
            {
                restSharpRequestHelp.RequestParams = requestParams;
            }
            //调用解绑web服务
            restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) => {
                if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    var result             = response.Content;
                    var unBindGuardianJson = JsonConvert.DeserializeObject <UnBindGuardianJson>(result);
                    if (unBindGuardianJson.statuscode == "1")
                    {
                        if (unBindGuardianJson.data == "1")
                        {
                            activity.RunOnUiThread(() =>
                            {
                                Toast.MakeText(activity, "解绑成功", ToastLength.Short).Show();
                                ProgressDialogUtil.StopProgressDialog();
                                Remove(item);
                                return;
                            });
                        }
                        else
                        {
                            activity.RunOnUiThread(() =>
                            {
                                Toast.MakeText(activity, "解绑失败,稍后在试...", ToastLength.Short).Show();
                                ProgressDialogUtil.StopProgressDialog();
                                return;
                            });
                        }
                    }
                    else
                    {
                        activity.RunOnUiThread(() =>
                        {
                            Toast.MakeText(activity, "解绑失败,稍后在试...", ToastLength.Short).Show();
                            ProgressDialogUtil.StopProgressDialog();
                            return;
                        });
                    }
                }
                else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut)
                {
                    activity.RunOnUiThread(() =>
                    {
                        Toast.MakeText(activity, "网络连接超时,稍后在试...", ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        return;
                    });
                }
                else
                {
                    activity.RunOnUiThread(() =>
                    {
                        Toast.MakeText(activity, response.StatusDescription, ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        return;
                    });
                }
            });
        }
Пример #10
0
        /// <summary>
        /// 申请绑定监护人
        /// </summary>
        /// <param name="item">Item.</param>
        /// <param name="applyMsgContent">Apply message content.</param>
        private void ApplyBindGuardian(SearchGuardianListItem item, string applyMsgContent)
        {
            ProgressDialogUtil.StartProgressDialog(activity, "正在申请中...");
            //检测网络连接
            if (!EldYoungUtil.IsConnected(activity))
            {
                Toast.MakeText(activity, "网络连接超时,请检测网路", ToastLength.Short).Show();
                ProgressDialogUtil.StopProgressDialog();
                return;
            }

            applyBindGuardianParam.GId          = item.UId;
            applyBindGuardianParam.ApplyContent = applyMsgContent;
            if (!requestParams.ContainsKey("key"))
            {
                requestParams.Add("key", applyBindGuardianParam.Key);
            }
            else
            {
                requestParams ["key"] = applyBindGuardianParam.Key;
            }

            if (!requestParams.ContainsKey("eapplycontent"))
            {
                requestParams.Add("eapplycontent", applyBindGuardianParam.EapplyContent);
            }
            else
            {
                requestParams ["eapplycontent"] = applyBindGuardianParam.EapplyContent;
            }

            if (!requestParams.ContainsKey("eUserId"))
            {
                requestParams.Add("eUserId", applyBindGuardianParam.EuserId);
            }
            else
            {
                requestParams ["eUserId"] = applyBindGuardianParam.EuserId;
            }

            if (!requestParams.ContainsKey("egid"))
            {
                requestParams.Add("egid", applyBindGuardianParam.Egid);
            }
            else
            {
                requestParams ["egid"] = applyBindGuardianParam.Egid;
            }

            if (!requestParams.ContainsKey("eaction"))
            {
                requestParams.Add("eaction", applyBindGuardianParam.Eaction);
            }
            else
            {
                requestParams ["eaction"] = applyBindGuardianParam.Eaction;
            }

            if (!requestParams.ContainsKey("md5"))
            {
                requestParams.Add("md5", applyBindGuardianParam.Md5);
            }
            else
            {
                requestParams ["md5"] = applyBindGuardianParam.Md5;
            }
            //设置restsharprequest
            if (restSharpRequestHelp == null)
            {
                restSharpRequestHelp = new RestSharpRequestHelp(applyBindGuardianParam.Url, requestParams);
            }
            else
            {
                restSharpRequestHelp.RequestParams = requestParams;
            }

            restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) => {
                if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    var result            = response.Content;
                    var applyGuardianJson = JsonConvert.DeserializeObject <ApplyForGuardianJson>(result);

                    if (applyGuardianJson.statuscode == "1")
                    {
                        if (applyGuardianJson.data == "1")
                        {
                            activity.RunOnUiThread(() =>
                            {
                                Toast.MakeText(activity, "申请绑定监护人成功", ToastLength.Short).Show();
                                ProgressDialogUtil.StopProgressDialog();

                                return;
                            });
                        }
                        else
                        {
                            activity.RunOnUiThread(() =>
                            {
                                Toast.MakeText(activity, "申请绑定失败,稍后在试...", ToastLength.Short).Show();
                                ProgressDialogUtil.StopProgressDialog();
                                return;
                            });
                        }
                    }
                    else
                    {
                        activity.RunOnUiThread(() =>
                        {
                            Toast.MakeText(activity, "申请绑定失败,稍后在试...", ToastLength.Short).Show();
                            ProgressDialogUtil.StopProgressDialog();
                            return;
                        });
                    }
                }
                else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut)
                {
                    activity.RunOnUiThread(() =>
                    {
                        Toast.MakeText(activity, "网络连接超时,稍后在试...", ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        return;
                    });
                }
                else
                {
                    activity.RunOnUiThread(() =>
                    {
                        Toast.MakeText(activity, response.StatusDescription, ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        return;
                    });
                }
                activity.RunOnUiThread(() =>
                {
                    if (RefreshAction != null)
                    {
                        RefreshAction();
                    }
                });
            });
        }
Пример #11
0
        private void PublishAdvice()
        {
            var adviceTitle = edit_advice_title.Text;

            if (string.IsNullOrEmpty(adviceTitle))
            {
                Toast.MakeText(Activity, "留言标题不能为空,请输入标题", ToastLength.Short).Show();
                return;
            }
            var adviceContent = edit_advice_content.Text;

            if (string.IsNullOrEmpty(adviceContent))
            {
                Toast.MakeText(Activity, "留言内容不能为空,请输入留言内容", ToastLength.Short).Show();
                return;
            }

            ProgressDialogUtil.StartProgressDialog(Activity, "正在保存...");
            //检测网络连接
            if (!EldYoungUtil.IsConnected(Activity))
            {
                Toast.MakeText(Activity, "网络连接超时,请检测网络", ToastLength.Short).Show();
                ProgressDialogUtil.StopProgressDialog();
                return;
            }

            //调用restapi注册,将用户名、密码信息写
            var adviceWriteParam = new AdviceWriteParam()
            {
                UId = Global.Guid, AdviceType = _adviceType, AdviceTitle = adviceTitle, AdviceContent = adviceContent
            };

            if (!requestParams.ContainsKey("key"))
            {
                requestParams.Add("key", adviceWriteParam.Key);
            }
            else
            {
                requestParams ["key"] = adviceWriteParam.Key;
            }

            if (!requestParams.ContainsKey("eaction"))
            {
                requestParams.Add("eaction", adviceWriteParam.Eaction);
            }
            else
            {
                requestParams ["eaction"] = adviceWriteParam.Eaction;
            }

            if (!requestParams.ContainsKey("eUId"))
            {
                requestParams.Add("eUId", adviceWriteParam.Euid);
            }
            else
            {
                requestParams ["eUId"] = adviceWriteParam.Euid;
            }

            if (!requestParams.ContainsKey("eAdviceType"))
            {
                requestParams.Add("eAdviceType", adviceWriteParam.EadviceType);
            }
            else
            {
                requestParams ["eAdviceType"] = adviceWriteParam.EadviceType;
            }

            if (!requestParams.ContainsKey("ePlatformType"))
            {
                requestParams.Add("ePlatformType", adviceWriteParam.EplatformType);
            }
            else
            {
                requestParams ["ePlatformType"] = adviceWriteParam.EplatformType;
            }

            if (!requestParams.ContainsKey("eAdviceTitle"))
            {
                requestParams.Add("eAdviceTitle", adviceWriteParam.EadviceTitle);
            }
            else
            {
                requestParams ["eAdviceTitle"] = adviceWriteParam.EadviceTitle;
            }

            if (!requestParams.ContainsKey("eAdviceContent"))
            {
                requestParams.Add("eAdviceContent", adviceWriteParam.EadviceContent);
            }
            else
            {
                requestParams ["eAdviceContent"] = adviceWriteParam.EadviceContent;
            }

            if (!requestParams.ContainsKey("md5"))
            {
                requestParams.Add("md5", adviceWriteParam.Md5);
            }
            else
            {
                requestParams ["md5"] = adviceWriteParam.Md5;
            }

            var restSharpRequestHelp = new RestSharpRequestHelp(adviceWriteParam.Url, requestParams);

            restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) =>
            {
                if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    //获取并解析返回resultJson获取安全码结果值
                    var result          = response.Content;
                    var adviceWriteJson = JsonConvert.DeserializeObject <AdviceWriteJson>(result);
                    if (adviceWriteJson.statuscode == "1")
                    {
                        Activity.RunOnUiThread(() =>
                        {
                            Toast.MakeText(Activity, "保存成功", ToastLength.Short).Show();
                            ProgressDialogUtil.StopProgressDialog();
                        });
                    }
                    else
                    {
                        Activity.RunOnUiThread(() =>
                        {
                            Toast.MakeText(Activity, adviceWriteJson.message, ToastLength.Short).Show();
                            ProgressDialogUtil.StopProgressDialog();
                            return;
                        });
                    }
                }
                else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut)
                {
                    Activity.RunOnUiThread(() =>
                    {
                        Toast.MakeText(Activity, "网络连接超时,请重试", ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        return;
                    });
                }
                else
                {
                    Activity.RunOnUiThread(() =>
                    {
                        Toast.MakeText(Activity, response.StatusDescription, ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        return;
                    });
                }
            });
        }
Пример #12
0
        /// <summary>
        /// 保存
        /// </summary>
        private void Save()
        {
            var locationthreelevel = edit_locationthreelevel.Text;            //todo:采用选择框赋值
            var locationdetail     = edit_locationdeatil.Text;

            if (string.IsNullOrEmpty(locationthreelevel) || string.IsNullOrEmpty(locationdetail))
            {
                Toast.MakeText(this, "省市区或实际地址不能为空,请输入", ToastLength.Short).Show();
                return;
            }

            var contactAddress = locationthreelevel + locationdetail;

            ProgressDialogUtil.StartProgressDialog(this, "正在保存...");
            //检测网络连接
            if (!EldYoungUtil.IsConnected(this))
            {
                Toast.MakeText(this, "网络连接超时,请检测网络", ToastLength.Short).Show();
                ProgressDialogUtil.StopProgressDialog();
                return;
            }


            var updateMyInfoParam = new UpdateMyInfoParam()
            {
                Uid = Global.MyInfo.UId, ParamType = "ContactAddress", ParamValue = contactAddress
            };

            if (!requestParams.ContainsKey("key"))
            {
                requestParams.Add("key", updateMyInfoParam.Key);
            }
            else
            {
                requestParams ["key"] = updateMyInfoParam.Key;
            }

            if (!requestParams.ContainsKey("eUId"))
            {
                requestParams.Add("eUId", updateMyInfoParam.Euid);
            }
            else
            {
                requestParams ["eUId"] = updateMyInfoParam.Euid;
            }

            if (!requestParams.ContainsKey("eparamType"))
            {
                requestParams.Add("eparamType", updateMyInfoParam.EparamType);
            }
            else
            {
                requestParams ["eparamType"] = updateMyInfoParam.EparamType;
            }

            if (!requestParams.ContainsKey("eparamValue"))
            {
                requestParams.Add("eparamValue", updateMyInfoParam.EparamValue);
            }
            else
            {
                requestParams ["eparamValue"] = updateMyInfoParam.EparamValue;
            }

            if (!requestParams.ContainsKey("md5"))
            {
                requestParams.Add("md5", updateMyInfoParam.Md5);
            }
            else
            {
                requestParams ["md5"] = updateMyInfoParam.Md5;
            }
            var restSharpRequestHelp = new RestSharpRequestHelp(updateMyInfoParam.Url, requestParams);

            restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) =>
            {
                if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    //获取并解析返回resultJson获取安全码结果值
                    var result           = response.Content;
                    var updateMyInfoJson = JsonConvert.DeserializeObject <UpdateMyInfoJson>(result);
                    if (updateMyInfoJson.statuscode == "1")
                    {
                        RunOnUiThread(() =>
                        {
                            Toast.MakeText(this, "保存成功", ToastLength.Short).Show();
                            Global.MyInfo.ContactAddress = contactAddress;
                            ProgressDialogUtil.StopProgressDialog();
                            this.Finish();
                            OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
                        });
                    }
                    else
                    {
                        RunOnUiThread(() =>
                        {
                            Toast.MakeText(this, updateMyInfoJson.message, ToastLength.Short).Show();
                            ProgressDialogUtil.StopProgressDialog();
                            return;
                        });
                    }
                }
                else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut)
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, "网络连接超时,请重试", ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        return;
                    });
                }
                else
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, response.StatusDescription, ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        return;
                    });
                }
            });
        }
Пример #13
0
        /// <summary>
        /// Reister this instance.
        /// </summary>
        private void Reister()
        {
            ProgressDialogUtil.StartProgressDialog(this, "正在注册...");
            //检测网络连接
            if (!EldYoungUtil.IsConnected(this))
            {
                Toast.MakeText(this, "网络连接超时,请检测网路", ToastLength.Short).Show();
                ProgressDialogUtil.StopProgressDialog();
                return;
            }


            //todo:调用restapi注册,将用户名、密码信息写
            var registerInfoParam = new RegisterInfoParam()
            {
                PhoneNumber = phoneNum, NickName = nickName, PassWord = passWord
            };

            //初始化参数
            SetRestRequestParams(registerInfoParam);

            var restSharpRequestHelp = new RestSharpRequestHelp(registerInfoParam.Url, requestParams);

            restSharpRequestHelp.ExcuteAsync((response) => {
                if (response.ResponseStatus == ResponseStatus.Completed)
                {
                    //获取并解析返回resultJson获取Guid结果值
                    if (response.StatusCode == System.Net.HttpStatusCode.OK)
                    {
                        var resultJson   = response.Content;
                        var registerJson = JsonConvert.DeserializeObject <RegisterJson>(resultJson);
                        if (registerJson.statuscode == "1")
                        {
                            Global.MyInfo = registerJson.data.Table[0];
                            var Uid       = Global.MyInfo.UId;
                            Global.Guid   = Uid;
                            //登录成功,将登录guid写入refrence文件
                            sp_userinfo.Edit().PutString(Global.refrence_Guid, Uid).Commit();
                            var guidAsAlias = Uid.Replace("-", "_");
                            //注册用户成功,写极光推送别名,进入主界面
                            _jpushUtil.SetAlias(guidAsAlias);
                            sp_userinfo.Edit().PutString(Global.refrence_UserName, nickName).Commit();
                            sp_userinfo.Edit().PutString(Global.refrence_Password, passWord).Commit();
                            sp_userinfo.Edit().PutBoolean(Global.refrence_Password_Check, true).Commit();
                            RunOnUiThread(() =>
                            {
                                //跳转到功能主界面
                                var intent = new Intent(this, typeof(MainActivity));
                                intent.SetFlags(ActivityFlags.ClearTask | ActivityFlags.NewTask);
                                StartActivity(intent);
                                this.Finish();
                                ProgressDialogUtil.StopProgressDialog();
                                Toast.MakeText(this, "注册成功", ToastLength.Short).Show();
                                OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
                            });
                        }
                        else
                        {
                            //注册失败
                            RunOnUiThread(() =>
                            {
                                Toast.MakeText(this, registerJson.message, ToastLength.Short).Show();
                                ProgressDialogUtil.StopProgressDialog();
                                return;
                            });
                        }
                    }
                }
                else if (response.ResponseStatus == ResponseStatus.TimedOut)
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, "网络连接超时", ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        return;
                    });
                }
                else
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, response.StatusDescription, ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        return;
                    });
                }
            });
        }
Пример #14
0
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="phoneNum">Phone number.</param>
        private void SendSMS(string _phoneNumber)
        {
            ProgressDialogUtil.StartProgressDialog(this, "正在发送验证码...");

            //检测网络连接
            if (!EldYoungUtil.IsConnected(this))
            {
                Toast.MakeText(this, "网络连接超时,请检测网路", ToastLength.Short).Show();
                ProgressDialogUtil.StopProgressDialog();
                return;
            }

            var smsInfoParam = new SmsInfoParam()
            {
                PhoneNumber = phoneNum, NickName = nickName, PassWord = passWord
            };

            //使用restsharpApi方式

            SetRestRequestParams(smsInfoParam);

            var restSharpRequestHelp = new RestSharpRequestHelp(smsInfoParam.Url, requestSmsParams);

            restSharpRequestHelp.ExcuteAsync((response) => {
                if (response.ResponseStatus == ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    //获取并解析返回resultJson获取安全码结果值
                    var resultJson = response.Content;
                    var smsJson    = JsonConvert.DeserializeObject <SmsJson>(resultJson);
                    if (smsJson.statuscode == "1")
                    {
                        RunOnUiThread(() => {
                            securityCode = smsJson.data.ToString();

                            mc.Start();
                            tv_SendCodeStatusShow.Visibility = ViewStates.Visible;
                        });
                    }
                    else
                    {
                        RunOnUiThread(() =>
                        {
                            tv_SendCodeStatusShow.Visibility = ViewStates.Invisible;
                            Toast.MakeText(this, smsJson.message, ToastLength.Short).Show();
                        });
                    }
                }
                else if (response.ResponseStatus == ResponseStatus.TimedOut)
                {
                    RunOnUiThread(() =>
                    {
                        tv_SendCodeStatusShow.Visibility = ViewStates.Invisible;
                        Toast.MakeText(this, "网络连接超时", ToastLength.Short).Show();
                    });
                }
                else
                {
                    RunOnUiThread(() =>
                    {
                        tv_SendCodeStatusShow.Visibility = ViewStates.Invisible;
                        Toast.MakeText(this, response.StatusDescription, ToastLength.Short).Show();
                    });
                }
                RunOnUiThread(() =>
                {
                    ProgressDialogUtil.StopProgressDialog();
                    return;
                });
            });
        }
        private void LoadDetailData()
        {
            ProgressDialogUtil.StartProgressDialog(this, "正在加载用户详细数据...");
            if (string.IsNullOrEmpty(UId))
            {
                return;
            }
            guardianInfoDetailParam = new GuardianDetailInfoParam()
            {
                Id = UId
            };
            if (!requestParams.ContainsKey("key"))
            {
                requestParams.Add("key", guardianInfoDetailParam.Key);
            }
            else
            {
                requestParams ["eId"] = guardianInfoDetailParam.Key;
            }
            if (!requestParams.ContainsKey("eId"))
            {
                requestParams.Add("eId", guardianInfoDetailParam.Eid);
            }

            if (!requestParams.ContainsKey("eaction"))
            {
                requestParams.Add("eaction", guardianInfoDetailParam.Eaction);
            }
            else
            {
                requestParams ["eaction"] = guardianInfoDetailParam.Eaction;
            }

            if (!requestParams.ContainsKey("md5"))
            {
                requestParams.Add("md5", guardianInfoDetailParam.Md5);
            }
            else
            {
                requestParams ["md5"] = guardianInfoDetailParam.Md5;
            }
            //设置restsharprequest
            if (restSharpRequestHelp == null)
            {
                restSharpRequestHelp = new RestSharpRequestHelp(guardianInfoDetailParam.Url, requestParams);
            }
            else
            {
                restSharpRequestHelp.RequestParams = requestParams;
            }
            //调用监护人详情web服务
            restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) => {
                if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    var result = response.Content;
                    var guardianDetailInfoJson = JsonConvert.DeserializeObject <GuardianDetailInfoJson>(result);
                    if (guardianDetailInfoJson.statuscode == "1")
                    {
                        if (guardianDetailInfoJson.data != null && guardianDetailInfoJson.data.Count > 0)
                        {
                            var detailItem = guardianDetailInfoJson.data[0];
                            RunOnUiThread(() =>
                            {
                                tv_TrueName.Text          = FormartDetailResult(detailItem.TrueName);
                                tv_Gender.Text            = FormartDetailResult(detailItem.Gender);
                                tv_Brnl.Text              = FormartDetailResult(detailItem.BRNL);
                                tv_PhoneNumberOne.Text    = FormartDetailResult(detailItem.PhoneNumberOne);
                                tv_IDNumber.Text          = FormartDetailResult(detailItem.IDNumber);
                                tv_ContactAddress.Text    = FormartDetailResult(detailItem.ContactAddress);
                                tv_TelePhoneNumber.Text   = FormartDetailResult(detailItem.TelePhoneNumber);
                                tv_Email.Text             = FormartDetailResult(detailItem.Email);
                                tv_Height.Text            = FormartDetailResult(detailItem.Height);
                                tv_Weight.Text            = FormartDetailResult(detailItem.Weight);
                                tv_HereditaryDisease.Text = FormartDetailResult(detailItem.HereditaryDisease);
                            });
                        }
                        RunOnUiThread(() =>
                        {
                            ProgressDialogUtil.StopProgressDialog();
                        });
                    }
                    else
                    {
                        RunOnUiThread(() =>
                        {
                            Toast.MakeText(this, "获取用户详情信息失败...", ToastLength.Short).Show();
                            ProgressDialogUtil.StopProgressDialog();
                            return;
                        });
                    }
                }
                else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut)
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, "网络连接超时,稍后在试...", ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        return;
                    });
                }
                else
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, response.StatusDescription, ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        return;
                    });
                }
            });
        }
Пример #16
0
        private void Login()
        {
            userNameValue = edit_userName.Text.ToString();
            passwordValue = edit_userPassword.Text.ToString();
            if (string.IsNullOrEmpty(userNameValue) || string.IsNullOrEmpty(passwordValue))
            {
                Toast.MakeText(this, "用户名或密码不能为空,请填写...", ToastLength.Long).Show();
                return;
            }

            if (!EldYoungUtil.IsValidUserName(userNameValue))
            {
                Toast.MakeText(this, "请输入正确规范用户名4-20位,由中英文、数字、下划线组成", ToastLength.Short).Show();
                return;
            }
            if (!EldYoungUtil.IsPassWord(passwordValue))
            {
                Toast.MakeText(this, "请输入正确规范用户名6-20位,建议由字母、数字和符号两种以上组成", ToastLength.Short).Show();
                return;
            }

            ProgressDialogUtil.StartProgressDialog(this, GetString(Resource.String.loginMsg), true);
            //检测网络连接
            if (!EldYoungUtil.IsConnected(this))
            {
                Toast.MakeText(this, "网络连接超时,请检测网络", ToastLength.Short).Show();
                ProgressDialogUtil.StopProgressDialog();
                return;
            }

            //调用restapi service 登录
            var loginInfoParam = new LoginInfoParam()
            {
                LoginName = userNameValue, LoginPwd = passwordValue
            };

            //初始化请求参数
            SetRestRequestParams(loginInfoParam);

            var restSharpRequestHelp = new RestSharpRequestHelp(loginInfoParam.Url, requestParams);

            restSharpRequestHelp.ExcuteAsync((response) => {
                if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    //获取并解析返回resultJson获取安全码结果值
                    var resultJson = response.Content;
                    var loginJson  = JsonConvert.DeserializeObject <LoginJson>(resultJson);
                    if (loginJson.statuscode == "1")
                    {
                        Global.MyInfo = loginJson.data.Table[0];
                        var Uid       = Global.MyInfo.UId;

                        var guidAsAlias = Uid.Replace("-", "_");                       //使用用户guid作为推送别名
                        _jpushUtil.SetAlias(guidAsAlias);
                        //登录成功,且记住用户密码选中,才记录
                        if (cb_passWord.Checked)
                        {
                            sp_userinfo.Edit().PutString(Global.login_UserName, userNameValue).Commit();
                            sp_userinfo.Edit().PutString(Global.login_Password, passwordValue).Commit();
                            sp_userinfo.Edit().PutBoolean(Global.login_Password_Check, true).Commit();
                        }
                        RunOnUiThread(() =>
                        {
                            //跳转到功能主界面
                            var intent = new Intent(this, typeof(MainFragActivity));
                            intent.SetFlags(ActivityFlags.ClearTask | ActivityFlags.NewTask);
                            var bundle = Intent.Extras;
                            if (bundle != null)
                            {
                                intent.PutExtras(bundle);
                            }
                            StartActivity(intent);
                            this.Finish();
                            Toast.MakeText(this, "登录成功", ToastLength.Short).Show();
                            OverridePendingTransition(Android.Resource.Animation.FadeIn, Android.Resource.Animation.FadeOut);
                        });
                    }
                    else
                    {
                        RunOnUiThread(() =>
                        {
                            Toast.MakeText(this, loginJson.message, ToastLength.Short).Show();
                        });
                    }
                }
                else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut)
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, "网络连接超时", ToastLength.Short).Show();
                    });
                }
                else
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, response.StatusDescription, ToastLength.Short).Show();
                    });
                }
                RunOnUiThread(() =>
                {
                    ProgressDialogUtil.StopProgressDialog();

                    return;
                });
            });
        }
Пример #17
0
        /// <summary>
        /// 加载体检详细数据
        /// </summary>
        private void LoadData()
        {
            //身体质量指数
            tv_TestTime.Text = string.IsNullOrEmpty(healthInfoItem.TestTime) ? "-" : Convert.ToDateTime(healthInfoItem.TestTime).ToString("yyyy-MM-dd HH:mm:ss");

            tv_Height.Text = string.IsNullOrEmpty(healthInfoItem.Height) ? "-" : healthInfoItem.Height + "cm/";
            tv_Weight.Text = string.IsNullOrEmpty(healthInfoItem.Weight) ? "-" : healthInfoItem.Weight + "kg";
            if (!string.IsNullOrEmpty(healthInfoItem.Height) && !string.IsNullOrEmpty(healthInfoItem.Weight))
            {
                var bmi = Convert.ToDouble(healthInfoItem.Weight) / ((Convert.ToDouble(healthInfoItem.Height) / 100) * (Convert.ToDouble(healthInfoItem.Height) / 100));
                tv_BMI.Text = string.Format("{0:F}", bmi);                  // bmi.ToString ();
                if (bmi > HealthStand.BMI_High || bmi < HealthStand.BMI_Low)
                {
                    //异常
                    tv_BMI.SetTextColor(Resources.GetColor(Resource.Color.pink));
                    img_BMI_Arraw.Visibility = ViewStates.Visible;
                }
                else
                {
                    img_BMI_Arraw.Visibility = ViewStates.Gone;
                }
            }
            else
            {
                img_BMI_Arraw.Visibility = ViewStates.Gone;
            }

            //血糖
            tv_BloodGlucose.Text = string.IsNullOrEmpty(healthInfoItem.BloodGlucose)?"-":healthInfoItem.BloodGlucose;

            if (!string.IsNullOrEmpty(healthInfoItem.BloodGlucose))
            {
                var bloodGlucose = healthInfoItem.BloodGlucose;

                if (Convert.ToDouble(bloodGlucose) > HealthStand.BloodGlucose_High || Convert.ToDouble(bloodGlucose) < HealthStand.BloodGlucose_Low)
                {
                    tv_BloodGlucose.SetTextColor(Resources.GetColor(Resource.Color.pink));
                    img_BloodGlucose_Arraw.Visibility = ViewStates.Visible;
                }
                else
                {
                    img_BloodGlucose_Arraw.Visibility = ViewStates.Gone;
                }
            }
            else
            {
                img_BloodGlucose_Arraw.Visibility = ViewStates.Gone;
            }

            //血氧
            tv_BloodOxygenParaOne.Text = string.IsNullOrEmpty(healthInfoItem.BloodOxygenParaOne)?"-":healthInfoItem.BloodOxygenParaOne;

            if (!string.IsNullOrEmpty(healthInfoItem.BloodOxygenParaOne))
            {
                var bloodOxygen = healthInfoItem.BloodOxygenParaOne;
                if (Convert.ToDouble(bloodOxygen) > HealthStand.BloodOxygen_High || Convert.ToDouble(bloodOxygen) < HealthStand.BloodOxygen_Low)
                {
                    tv_BloodOxygenParaOne.SetTextColor(Resources.GetColor(Resource.Color.pink));
                    img_BloodOxygenParaOne_Arraw.Visibility = ViewStates.Visible;
                }
                else
                {
                    img_BloodOxygenParaOne_Arraw.Visibility = ViewStates.Gone;
                }
            }
            else
            {
                img_BloodOxygenParaOne_Arraw.Visibility = ViewStates.Gone;
            }

            //血压
            tv_BloodPressureParaOne.Text = string.IsNullOrEmpty(healthInfoItem.BloodPressureParaOne)?"-":healthInfoItem.BloodPressureParaOne;
            tv_BloodPressureParaTwo.Text = string.IsNullOrEmpty(healthInfoItem.BloodPressureParaTwo) ? "-" : healthInfoItem.BloodPressureParaTwo;
            //心率
            tv_HeartRate.Text = string.IsNullOrEmpty(healthInfoItem.HeartRate)?"-":healthInfoItem.HeartRate;

            if (!string.IsNullOrEmpty(healthInfoItem.HeartRate))
            {
                var heartRate = healthInfoItem.HeartRate;
                if (Convert.ToDouble(heartRate) > HealthStand.HeartRate_High || Convert.ToDouble(heartRate) < HealthStand.HeartRate_Low)
                {
                    tv_HeartRate.SetTextColor(Resources.GetColor(Resource.Color.pink));
                    img_HeartRate_Arraw.Visibility = ViewStates.Visible;
                }
                else
                {
                    img_HeartRate_Arraw.Visibility = ViewStates.Gone;
                }
            }
            else
            {
                img_HeartRate_Arraw.Visibility = ViewStates.Gone;
            }

            //肺活量
            tv_BreathCapacity.Text = string.IsNullOrEmpty(healthInfoItem.BreathCapacity)?"-":healthInfoItem.BreathCapacity;

            if (!string.IsNullOrEmpty(healthInfoItem.BreathCapacity))
            {
                var breathCapacity = healthInfoItem.BreathCapacity;
                if (Convert.ToDouble(breathCapacity) > HealthStand.BreathCapacity_High || Convert.ToDouble(breathCapacity) < HealthStand.BreathCapacity_Low)
                {
                    tv_BreathCapacity.SetTextColor(Resources.GetColor(Resource.Color.pink));
                    img_BreathCapacity_Arraw.Visibility = ViewStates.Visible;
                }
                else
                {
                    img_BreathCapacity_Arraw.Visibility = ViewStates.Gone;
                }
            }
            else
            {
                img_BreathCapacity_Arraw.Visibility = ViewStates.Gone;
            }
            //体温
            tv_BodyTemperature.Text = string.IsNullOrEmpty(healthInfoItem.BodyTemperature)?"-":healthInfoItem.BodyTemperature;

            if (!string.IsNullOrEmpty(healthInfoItem.BodyTemperature))
            {
                var bodyTemperature = Convert.ToDouble(healthInfoItem.BodyTemperature);
                if (bodyTemperature > HealthStand.BodyTemperature_High || bodyTemperature < HealthStand.BodyTemperature_Low)
                {
                    tv_BodyTemperature.SetTextColor(Resources.GetColor(Resource.Color.pink));
                    img_BodyTemperature_Arraw.Visibility = ViewStates.Visible;
                }
                else
                {
                    img_BodyTemperature_Arraw.Visibility = ViewStates.Gone;
                }
            }
            else
            {
                img_BodyTemperature_Arraw.Visibility = ViewStates.Gone;
            }
            //总胆固醇
            tv_BloodLipidParaOne.Text = string.IsNullOrEmpty(healthInfoItem.BloodLipidParaOne)?"-":healthInfoItem.BloodLipidParaOne;

            if (!string.IsNullOrEmpty(healthInfoItem.BloodLipidParaOne))
            {
                var bloodLipidParaOne = Convert.ToDouble(healthInfoItem.BloodLipidParaOne);
                if (bloodLipidParaOne > HealthStand.BloodLipidParaOne_High || bloodLipidParaOne < HealthStand.BloodLipidParaOne_Low)
                {
                    tv_BloodLipidParaOne.SetTextColor(Resources.GetColor(Resource.Color.pink));
                    img_BloodLipidParaOne_Arraw.Visibility = ViewStates.Visible;
                }
                else
                {
                    img_BloodOxygenParaOne_Arraw.Visibility = ViewStates.Gone;
                }
            }
            else
            {
                img_BloodLipidParaOne_Arraw.Visibility = ViewStates.Gone;
            }

            //低密度脂蛋白胆固醇

            tv_BloodLipidParaTwo.Text = string.IsNullOrEmpty(healthInfoItem.BloodLipidParaTwo)?"-":healthInfoItem.BloodLipidParaTwo;

            if (!string.IsNullOrEmpty(healthInfoItem.BloodLipidParaTwo))
            {
                var bloodLipidParaTwo = Convert.ToDouble(healthInfoItem.BloodLipidParaTwo);
                if (bloodLipidParaTwo > HealthStand.BloodLipidParaTwo_High || bloodLipidParaTwo < HealthStand.BloodLipidParaTwo_Low)
                {
                    tv_BloodLipidParaTwo.SetTextColor(Resources.GetColor(Resource.Color.pink));

                    img_BloodLipidParaTwo_Arraw.Visibility = ViewStates.Visible;
                }
                else
                {
                    img_BloodLipidParaTwo_Arraw.Visibility = ViewStates.Gone;
                }
            }
            else
            {
                img_BloodLipidParaTwo_Arraw.Visibility = ViewStates.Gone;
            }

            //高密度脂蛋白胆固醇

            tv_BloodLipidParaThree.Text = string.IsNullOrEmpty(healthInfoItem.BloodLipidParaThree)?"-":healthInfoItem.BloodLipidParaThree;

            if (!string.IsNullOrEmpty(healthInfoItem.BloodLipidParaThree))
            {
                var bloodLipidParaThree = Convert.ToDouble(healthInfoItem.BloodLipidParaThree);
                if (bloodLipidParaThree > HealthStand.BloodLipidParaThree_High || bloodLipidParaThree < HealthStand.BloodLipidParaThree_Low)
                {
                    tv_BloodLipidParaThree.SetTextColor(Resources.GetColor(Resource.Color.pink));
                    img_BloodLipidParaThree_Arraw.Visibility = ViewStates.Visible;
                }
                else
                {
                    img_BloodLipidParaThree_Arraw.Visibility = ViewStates.Gone;
                }
            }
            else
            {
                img_BloodLipidParaThree_Arraw.Visibility = ViewStates.Gone;
            }

            //甘油三酯
            tv_BloodLipidParaFour.Text = string.IsNullOrEmpty(healthInfoItem.BloodLipidParaFour)?"-":healthInfoItem.BloodLipidParaFour;

            if (!string.IsNullOrEmpty(healthInfoItem.BloodLipidParaFour))
            {
                var bloodLipidParaFour = Convert.ToDouble(healthInfoItem.BloodLipidParaFour);
                if (bloodLipidParaFour > HealthStand.BloodLipidParaFour_High || bloodLipidParaFour < HealthStand.BloodLipidParaFour_Low)
                {
                    tv_BloodLipidParaFour.SetTextColor(Resources.GetColor(Resource.Color.pink));
                    img_BloodLipidParaFour_Arraw.Visibility = ViewStates.Visible;
                }
                else
                {
                    img_BloodLipidParaFour_Arraw.Visibility = ViewStates.Gone;
                }
            }
            else
            {
                img_BloodLipidParaFour_Arraw.Visibility = ViewStates.Gone;
            }
            //酸碱度
            tv_UrineRoutinePH.Text = string.IsNullOrEmpty(healthInfoItem.UrineRoutinePH)?"-":healthInfoItem.UrineRoutinePH;

            if (!string.IsNullOrEmpty(healthInfoItem.UrineRoutinePH))
            {
                var urineRoutinePh = Convert.ToDouble(healthInfoItem.UrineRoutinePH);
                if (urineRoutinePh > HealthStand.PH_High || urineRoutinePh < HealthStand.PH_Low)
                {
                    tv_UrineRoutinePH.SetTextColor(Resources.GetColor(Resource.Color.pink));
                    img_UrineRoutinePH_Arraw.Visibility = ViewStates.Visible;
                }
                else
                {
                    img_UrineRoutinePH_Arraw.Visibility = ViewStates.Gone;
                }
            }
            else
            {
                img_UrineRoutinePH_Arraw.Visibility = ViewStates.Gone;
            }
            //尿比重
            tv_UrineRoutineSG.Text = string.IsNullOrEmpty(healthInfoItem.UrineRoutineSG)?"-":healthInfoItem.UrineRoutineSG;

            if (!string.IsNullOrEmpty(healthInfoItem.UrineRoutineSG))
            {
                var urineRoutineSg = Convert.ToDouble(healthInfoItem.UrineRoutineSG);
                if (urineRoutineSg > HealthStand.UrineRoutineSG_High || urineRoutineSg < HealthStand.UrineRoutineSG_Low)
                {
                    tv_UrineRoutineSG.SetTextColor(Resources.GetColor(Resource.Color.pink));
                    img_UrineRoutineSG_Arraw.Visibility = ViewStates.Visible;
                }
                else
                {
                    img_UrineRoutineSG_Arraw.Visibility = ViewStates.Gone;
                }
            }
            else
            {
                img_UrineRoutineSG_Arraw.Visibility = ViewStates.Gone;
            }

            //尿胆元
            tv_UrineRoutineURO.Text = string.IsNullOrEmpty(healthInfoItem.UrineRoutineURO)?"-":healthInfoItem.UrineRoutineURO;

            if (!string.IsNullOrEmpty(healthInfoItem.UrineRoutineURO))
            {
                var urineRoutineUro = Convert.ToDouble(healthInfoItem.UrineRoutineURO);
                if (urineRoutineUro > HealthStand.UrineRoutineURO_High || urineRoutineUro < HealthStand.UrineRoutineURO_Low)
                {
                    tv_UrineRoutineURO.SetTextColor(Resources.GetColor(Resource.Color.pink));
                    img_UrineRoutineURO_Arraw.Visibility = ViewStates.Visible;
                }
                else
                {
                    img_UrineRoutineURO_Arraw.Visibility = ViewStates.Gone;
                }
            }
            else
            {
                img_UrineRoutineURO_Arraw.Visibility = ViewStates.Gone;
            }
            //隐血
            tv_UrineRoutineBLO.Text = string.IsNullOrEmpty(healthInfoItem.UrineRoutineBLO)?"-":healthInfoItem.UrineRoutineBLO;
            //白细胞(WBC):(WBC/uL)
            tv_UrineRoutineWBC.Text = string.IsNullOrEmpty(healthInfoItem.UrineRoutineWBC)?"-":healthInfoItem.UrineRoutineWBC;
            //尿蛋白(PRO)
            tv_UrineRoutineRPO.Text = string.IsNullOrEmpty(healthInfoItem.UrineRoutinePRO)?"-":healthInfoItem.UrineRoutinePRO;
            //尿糖(GLU)
            tv_UrineRoutineGLU.Text = string.IsNullOrEmpty(healthInfoItem.UrineRoutineGLU)?"-":healthInfoItem.UrineRoutineGLU;
            RunOnUiThread(() => {
                ProgressDialogUtil.StopProgressDialog();
            });
        }
Пример #18
0
        private void loadData()
        {
            if (btnSearchFlag)
            {
                ProgressDialogUtil.StartProgressDialog(Activity, "正在查询体检信息...", true);
            }
            pageIndex = 1;
            UpdateHealthInfoListParam();

            //调用webservice获取数据
            restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) => {
                if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    var result         = response.Content;
                    var healthInfoJson = JsonConvert.DeserializeObject <SearchHealthInfoJson>(result);
                    if (healthInfoJson.statuscode == "1")
                    {
                        total           = healthInfoJson.data.total;
                        healthInfoLists = healthInfoJson.data.items;

                        Activity.RunOnUiThread(() =>
                        {
                            healthInfoAdapter.Clear();                                    //清空所有数据
                            healthInfoAdapter.AddAll(healthInfoLists);
                            healthInfoAdapter.NotifyDataSetChanged();
                            HasLoadedOnce = true;                                    //加载第一次成功
                        });
                    }
                    else
                    {
                        Activity.RunOnUiThread(() =>
                        {
                            Toast.MakeText(Activity, "获取体检列表信息错误", ToastLength.Short).Show();
                        });
                    }
                }
                else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut)
                {
                    Activity.RunOnUiThread(() =>
                    {
                        Toast.MakeText(Activity, "网络连接超时,稍后在试...", ToastLength.Short).Show();
                    });
                }
                else
                {
                    Activity.RunOnUiThread(() =>
                    {
                        Toast.MakeText(Activity, response.StatusDescription, ToastLength.Short).Show();
                    });
                }
                Activity.RunOnUiThread(() =>
                {
                    if (btnSearchFlag)
                    {
                        ProgressDialogUtil.StopProgressDialog();
                    }
                    myhealthRefreshListView.OnRefreshComplete();
                    IsRefreshing = false;
                });
            });
        }
Пример #19
0
        /// <summary>
        /// 保存
        /// </summary>
        private void Save()
        {
            var fixedPhonePre  = edit_fixedphonePre.Text;
            var fixedPhoneLast = edit_fixedPhoneLast.Text;
            var fixedPhone     = string.Empty;

            if (string.IsNullOrEmpty(fixedPhonePre) || string.IsNullOrEmpty(fixedPhoneLast))
            {
                Toast.MakeText(this, "固定电话不能为空,请输入", ToastLength.Short).Show();
                return;
            }
            else
            {
                fixedPhone = fixedPhonePre + "-" + fixedPhoneLast;
                if (!EldYoungUtil.IsFixedPhone(fixedPhone))
                {
                    Toast.MakeText(this, "请输入规范的固定电话号码", ToastLength.Short).Show();
                    return;
                }
            }

            ProgressDialogUtil.StartProgressDialog(this, "正在保存...");
            //检测网络连接
            if (!EldYoungUtil.IsConnected(this))
            {
                Toast.MakeText(this, "网络连接超时,请检测网络", ToastLength.Short).Show();
                ProgressDialogUtil.StopProgressDialog();
                return;
            }

            //调用restapi注册,将用户名、密码信息写
            var updateMyInfoParam = new UpdateMyInfoParam()
            {
                Uid = Global.Guid, ParamType = "TelePhoneNumber", ParamValue = fixedPhone
            };

            if (!requestParams.ContainsKey("key"))
            {
                requestParams.Add("key", updateMyInfoParam.Key);
            }
            else
            {
                requestParams ["key"] = updateMyInfoParam.Key;
            }

            if (!requestParams.ContainsKey("eUId"))
            {
                requestParams.Add("eUId", updateMyInfoParam.Euid);
            }
            else
            {
                requestParams ["eUId"] = updateMyInfoParam.Euid;
            }

            if (!requestParams.ContainsKey("eparamType"))
            {
                requestParams.Add("eparamType", updateMyInfoParam.EparamType);
            }
            else
            {
                requestParams ["eparamType"] = updateMyInfoParam.EparamType;
            }

            if (!requestParams.ContainsKey("eparamValue"))
            {
                requestParams.Add("eparamValue", updateMyInfoParam.EparamValue);
            }
            else
            {
                requestParams ["eparamValue"] = updateMyInfoParam.EparamValue;
            }

            if (!requestParams.ContainsKey("md5"))
            {
                requestParams.Add("md5", updateMyInfoParam.Md5);
            }
            else
            {
                requestParams ["md5"] = updateMyInfoParam.Md5;
            }
            var restSharpRequestHelp = new RestSharpRequestHelp(updateMyInfoParam.Url, requestParams);

            restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) =>
            {
                if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    //获取并解析返回resultJson获取安全码结果值
                    var result           = response.Content;
                    var updateMyInfoJson = JsonConvert.DeserializeObject <UpdateMyInfoJson>(result);
                    if (updateMyInfoJson.statuscode == "1")
                    {
                        RunOnUiThread(() =>
                        {
                            Toast.MakeText(this, "保存成功", ToastLength.Short).Show();
                            Global.MyInfo.TelePhoneNumber = fixedPhone;
                            ProgressDialogUtil.StopProgressDialog();
                            this.Finish();
                            OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
                        });
                    }
                    else
                    {
                        RunOnUiThread(() =>
                        {
                            Toast.MakeText(this, updateMyInfoJson.message, ToastLength.Short).Show();
                            ProgressDialogUtil.StopProgressDialog();
                            return;
                        });
                    }
                }
                else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut)
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, "网络连接超时,请重试", ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        return;
                    });
                }
                else
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, response.StatusDescription, ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        return;
                    });
                }
            });
        }
Пример #20
0
        private void loadData()
        {
            if (btnSearchFlag)
            {
                ProgressDialogUtil.StartProgressDialog(this, "正在查询报警信息...", true);
            }
            if (string.IsNullOrEmpty(myUserId))
            {
                //未选择任何监护人
                RunOnUiThread(() =>
                {
                    otherAlarmRefreshListView.OnRefreshComplete();
                    if (btnSearchFlag)
                    {
                        ProgressDialogUtil.StopProgressDialog();
                    }
                });
                return;
            }
            pageIndex = 1;
            UpdateAlarmInfoListParam();

            //调用webservice获取数据
            restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) => {
                if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    var result            = response.Content;
                    var alarmlistInfoJson = JsonConvert.DeserializeObject <SearchAlarmInfoJson>(result);
                    if (alarmlistInfoJson.statuscode == "1")
                    {
                        total          = alarmlistInfoJson.data.total;
                        alarmInfoLists = alarmlistInfoJson.data.items;

                        RunOnUiThread(() =>
                        {
                            alarmInfoAdapter.Clear();
                            alarmInfoAdapter.AddAll(alarmInfoLists);
                            alarmInfoAdapter.NotifyDataSetChanged();
                            HasLoadedOnce = true;                            //加载第一次成功
                        });
                    }
                    else
                    {
                        RunOnUiThread(() =>
                        {
                            Toast.MakeText(this, "获取报警列表信息错误", ToastLength.Short).Show();
                        });
                    }
                }
                else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut)
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, "网络连接超时,稍后在试...", ToastLength.Short).Show();
                    });
                }
                else
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, response.StatusDescription, ToastLength.Short).Show();
                    });
                }
                RunOnUiThread(() =>
                {
                    otherAlarmRefreshListView.OnRefreshComplete();
                    IsRefreshing = false;
                    if (btnSearchFlag)
                    {
                        ProgressDialogUtil.StopProgressDialog();
                    }
                });
            });
        }
Пример #21
0
        /// <summary>
        /// 保存
        /// </summary>
        private void Save()
        {
            var birth = edit_birth.Text;

            if (string.IsNullOrEmpty(birth))
            {
                Toast.MakeText(this, "生日不能为空,请选择生日日期", ToastLength.Short).Show();
                return;
            }
            if (Convert.ToDateTime(birth) >= Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")))
            {
                Toast.MakeText(this, "生日应小于当前日期", ToastLength.Short).Show();
                return;
            }
            ProgressDialogUtil.StartProgressDialog(this, "正在保存...");
            //检测网络连接
            if (!EldYoungUtil.IsConnected(this))
            {
                Toast.MakeText(this, "网络连接超时,请检测网络", ToastLength.Short).Show();
                ProgressDialogUtil.StopProgressDialog();
                return;
            }

            //调用restapi注册,将用户名、密码信息写
            var updateMyInfoParam = new UpdateMyInfoParam()
            {
                Uid = Global.Guid, ParamType = "Age", ParamValue = birth
            };

            if (!requestParams.ContainsKey("key"))
            {
                requestParams.Add("key", updateMyInfoParam.Key);
            }
            else
            {
                requestParams ["key"] = updateMyInfoParam.Key;
            }

            if (!requestParams.ContainsKey("eUId"))
            {
                requestParams.Add("eUId", updateMyInfoParam.Euid);
            }
            else
            {
                requestParams ["eUId"] = updateMyInfoParam.Euid;
            }

            if (!requestParams.ContainsKey("eparamType"))
            {
                requestParams.Add("eparamType", updateMyInfoParam.EparamType);
            }
            else
            {
                requestParams ["eparamType"] = updateMyInfoParam.EparamType;
            }

            if (!requestParams.ContainsKey("eparamValue"))
            {
                requestParams.Add("eparamValue", updateMyInfoParam.EparamValue);
            }
            else
            {
                requestParams ["eparamValue"] = updateMyInfoParam.EparamValue;
            }

            if (!requestParams.ContainsKey("md5"))
            {
                requestParams.Add("md5", updateMyInfoParam.Md5);
            }
            else
            {
                requestParams ["md5"] = updateMyInfoParam.Md5;
            }
            var restSharpRequestHelp = new RestSharpRequestHelp(updateMyInfoParam.Url, requestParams);

            restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) =>
            {
                if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    //获取并解析返回resultJson获取安全码结果值
                    var result           = response.Content;
                    var updateMyInfoJson = JsonConvert.DeserializeObject <UpdateMyInfoJson>(result);
                    if (updateMyInfoJson.statuscode == "1")
                    {
                        RunOnUiThread(() =>
                        {
                            Toast.MakeText(this, "保存成功", ToastLength.Short).Show();
                            Global.MyInfo.Age = birth;
                            ProgressDialogUtil.StopProgressDialog();
                            this.Finish();
                            OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
                        });
                    }
                    else
                    {
                        RunOnUiThread(() =>
                        {
                            Toast.MakeText(this, updateMyInfoJson.message, ToastLength.Short).Show();
                            ProgressDialogUtil.StopProgressDialog();
                            return;
                        });
                    }
                }
                else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut)
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, "网络连接超时,请重试", ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        return;
                    });
                }
                else
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, response.StatusDescription, ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        return;
                    });
                }
            });
        }
        private void QuerryBindGuardian(string condition)
        {
            ProgressDialogUtil.StartProgressDialog(this, "正在加载中...");
            //检测网络连接
            if (!EldYoungUtil.IsConnected(this))
            {
                Toast.MakeText(this, "网络连接超时,请检测网络", ToastLength.Short).Show();
                ProgressDialogUtil.StopProgressDialog();
                return;
            }
            searchGuardianParam.Condition = condition;

            if (!requestParams.ContainsKey("econdition"))
            {
                requestParams.Add("econdition", searchGuardianParam.Econdition);
            }
            else
            {
                requestParams ["econdition"] = searchGuardianParam.Econdition;
            }

            if (!requestParams.ContainsKey("eaction"))
            {
                requestParams.Add("eaction", searchGuardianParam.Eaction);
            }
            else
            {
                requestParams ["eaction"] = searchGuardianParam.Eaction;
            }

            if (!requestParams.ContainsKey("md5"))
            {
                requestParams.Add("md5", searchGuardianParam.Md5);
            }
            else
            {
                requestParams ["md5"] = searchGuardianParam.Md5;
            }

            if (!requestParams.ContainsKey("eguid"))
            {
                requestParams.Add("eguid", searchGuardianParam.Eguid);
            }
            else
            {
                requestParams ["eguid"] = searchGuardianParam.Eguid;
            }

            if (!requestParams.ContainsKey("key"))
            {
                requestParams.Add("key", searchGuardianParam.Key);
            }
            else
            {
                requestParams ["key"] = searchGuardianParam.Key;
            }



            //设置restsharprequest
            if (restSharpRequestHelp == null)
            {
                restSharpRequestHelp = new RestSharpRequestHelp(searchGuardianParam.Url, requestParams);
            }
            else
            {
                restSharpRequestHelp.RequestParams = requestParams;
            }

            //调用web服务
            restSharpRequestHelp.ExcuteAsync((RestSharp.IRestResponse response) => {
                if (response.ResponseStatus == RestSharp.ResponseStatus.Completed && response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    var result = response.Content;
                    var searchGardianlistInfoJson = JsonConvert.DeserializeObject <SearchGuardianListJson>(result);
                    if (searchGardianlistInfoJson.statuscode == "1")
                    {
                        RunOnUiThread(() =>
                        {
                            applyGuardianListAdapter.Clear();                            //清空所有数据
                            applyGuardianListAdapter.AddAll(searchGardianlistInfoJson.data);
                            applyGuardianListAdapter.NotifyDataSetChanged();
                            ProgressDialogUtil.StopProgressDialog();
                            HasLoadedOnce = true;
                        });
                    }
                    else
                    {
                        RunOnUiThread(() =>
                        {
                            Toast.MakeText(this, "获取会员信息失败", ToastLength.Short).Show();
                            ProgressDialogUtil.StopProgressDialog();
                            return;
                        });
                    }
                }
                else if (response.ResponseStatus == RestSharp.ResponseStatus.TimedOut)
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, "网络连接超时,稍后在试...", ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        return;
                    });
                }
                else
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(this, response.StatusDescription, ToastLength.Short).Show();
                        ProgressDialogUtil.StopProgressDialog();
                        return;
                    });
                }
            });
        }