示例#1
0
 private async void UploadScoreImage()
 {
     if (_commonHelper.IsNetWorkConnected() == true)
     {
         try
         {
             if (!_localScoreService.CheckTaskStatus(_disId))
             {
                 _commonFun.AlertLongText("请全部结束检查后,再上传数据");
                 return;
             }
             string size = _commonFun.GetFilesSizeOfUpload();
             if (await _commonFun.Confirm("上传文件大小为:" + size + " 以上, 建议在Wifi环境下进行。确定要上传吗?"))
             {
                 try
                 {
                     _commonFun.ShowLoading("上传中...");
                     await _commonFun.UploadLocalFileToServer();
                     await _remoteService.UploadScoreInfo(0);
                     await MasterDataDownloadHelper.DownloadData("1");
                     GetLocalPlans(_disId);
                     _commonFun.HideLoading();
                     _commonFun.AlertLongText("上传完毕");
                 }
                 catch (Exception ex)
                 {
                     _commonFun.AlertLongText("上传异常,请重试");
                     _commonFun.HideLoading();
                 }
                 finally
                 {
                     _commonFun.HideLoading();
                 }
             }
         }
         catch (OperationCanceledException)
         {
             _commonFun.AlertLongText("保存超时,请重试");
         }
         catch (Exception ex)
         {
             _commonFun.AlertLongText("上传失败,请重试");
         }
         finally
         {
             _commonFun.HideLoading();
         }
     }
     else
     {
         _commonFun.AlertLongText("网络连接异常。");
     }
 }
示例#2
0
 private async void UpdateNewVersion()
 {
     try
     {
         if (await _commonFun.Confirm("新的版本已发布,是否更新?"))
         {
             MessagingCenter.Send <IOSVersionInfoDto>(info, "UpdateApp");
         }
     }
     catch
     {
     }
 }
示例#3
0
 private async void UpdateNewVersion()
 {
     try
     {
         if (await _commonFun.Confirm("新的版本已发布,是否更新?"))
         {
             MessagingCenter.Send <IOSVersionInfoDto>(info, "UpdateApp");
             IsDoaning = true;
             info      = null;
         }
     }
     catch (Exception)
     {
     }
 }
        private async void SaveRegistCore()
        {
            if (_commonHelper.IsNetWorkConnected() == true)
            {
                try
                {
                    string size = _commonFun.GetFilesSizeOfUpload();
                    if (await _commonFun.Confirm("上传文件大小为:" + size + "以上, 建议在Wifi环境下进行。确定要上传吗?"))
                    {
                        try
                        {
                            //_commonFun.ShowLoading("上传中...");
                            await _commonFun.UploadLocalFileToServer();

                            await _remoteService.UploadScoreInfo(0);

                            _commonFun.HideLoading();
                            _commonFun.AlertLongText("上传完毕");
                        }
                        catch (Exception)
                        {
                            _commonFun.AlertLongText("上传异常,请重试");
                            _commonFun.HideLoading();
                        }
                        finally
                        {
                            _commonFun.HideLoading();
                        }
                    }
                }
                catch (OperationCanceledException)
                {
                    _commonFun.AlertLongText("保存超时,请重试");
                }
                catch (Exception)
                {
                    _commonFun.AlertLongText("上传异常,请重试");
                }
                finally
                {
                    _commonFun.HideLoading();
                }
            }
            else
            {
                _commonFun.AlertLongText("网络连接异常。");
            }
        }
        private async void DeleteCalendarEvent()
        {
            try
            {
                if (!await _commonFun.Confirm("确定删除吗?"))
                {
                    return;
                }
                var result = await _calendarService.DeleteCalenderPlans(Id.ToString());

                if (result != null)
                {
                    if (result.ResultCode == ResultType.Success)
                    {
                        //_commonFun.AlertLongText("删除成功");
                        await Navigation.PopAsync();

                        MessagingCenter.Send <string>(Convert.ToDateTime(StartDate).ToString("yyyy-MM-dd"), "SearchCalendarData");
                    }
                    else
                    {
                        _commonFun.AlertLongText("保存失败,请重试");
                    }
                }
                else
                {
                    _commonFun.AlertLongText("保存时服务出现错误,,请重试");
                }
            }
            catch (OperationCanceledException)
            {
                _commonFun.HideLoading();
                _commonFun.AlertLongText("请求超时,请重试");
            }
            catch (Exception)
            {
                _commonFun.HideLoading();
            }
            finally
            {
                _commonFun.HideLoading();
            }
        }
示例#6
0
        public TaskListViewModel()
        {
            try
            {
                _tourService = Resolver.Resolve<ITourService>();
                _localScoreService = Resolver.Resolve<ILocalScoreService>();
                _commonFun = Resolver.Resolve<ICommonFun>();
                _commonHelper = Resolver.Resolve<CommonHelper>();
                _remoteService = Resolver.Resolve<IRemoteService>();


                MessagingCenter.Subscribe<TourDistributorDto>(this, "SendShopItem", (obj) =>
                {
                    _disId = obj.DisId;
                    _isChecking = true;
                    _statu = "N";
                    //if (_commonHelper.IsNetWorkConnected() == true)
                    //{
                    //    GetPlans(_disId, "", "", _statu);
                    //}
                    //else
                    //{
                    GetLocalPlans(_disId);
                    //}
                });


                //MessagingCenter.Subscribe<TaskListPage>(this, "RefreshTask", (obj) =>
                //{
                //	if (_disId != 0)
                //	{
                //		GetPlans(_disId);
                //	}
                //});

                MessagingCenter.Subscribe<TaskOfPlanDto>(this, "CheckTask", async (obj) =>
                {
                    if (_isChecking)
                    {
                        //if (_commonHelper.IsNetWorkConnected() == true)
                        //{
                        //    if (obj.TPStatus == "E")
                        //    {
                        //        if (obj.TPType == "C")
                        //        {
                        //            CheckCustomizedTask(obj.TPId, "A", obj.TPStatus);
                        //        }
                        //        else
                        //        {
                        //            CheckPlan(obj.TPId, "A");
                        //        }

                        //    }
                        //    else
                        //    {
                        //        var action = await _commonFun.ShowActionSheet("开始检查", "结束检查");

                        //        if (action == "开始检查")
                        //        {
                        //            if (obj.TPType == "C")// 自定义任务
                        //            {
                        //                CheckCustomizedTask(obj.TPId, "S", obj.TPStatus);
                        //            }
                        //            else
                        //            {
                        //                CheckStartPlan(obj.TPId);
                        //            }
                        //        }
                        //        else if (action == "结束检查")
                        //        {
                        //            if (obj.TPType == "C")// 自定义任务
                        //            {
                        //                CheckCustomizedTask(obj.TPId, "E", obj.TPStatus);
                        //            }
                        //            else
                        //            {
                        //                CheckEndPlan(obj.TPId);
                        //            }

                        //        }
                        //    }
                        //}

                        // 没有网络的状态下
                        if (obj.TPStatus == "E")
                        {
                            if (obj.TPType == "C")
                            {
                                //CheckCustomizedTask(obj.TPId, "A", obj.TPStatus);
                                LocalCheckCustomizedTask(obj.TPId, "A", obj.TPStatus);
                            }
                            else
                            {
                                LocalCheckPlan(obj.TPId, "A");
                            }

                        }
                        else
                        {
                            var action = await _commonFun.ShowActionSheet("开始检查", "结束检查");//, "取消任务");

                            if (action == "开始检查")
                            {
                                if (obj.TPType == "C")// 自定义任务
                                {
                                    //CheckCustomizedTask(obj.TPId, "S", obj.TPStatus);
                                    LocalCheckCustomizedTask(obj.TPId, "S", obj.TPStatus);
                                }
                                else
                                {
                                    LocalCheckStartPlan(obj.TPId);
                                }
                            }
                            else if (action == "结束检查")
                            {
                                if (obj.TPType == "C")// 自定义任务
                                {
                                    //CheckCustomizedTask(obj.TPId, "E", obj.TPStatus);
                                    LocalCheckCustomizedTask(obj.TPId, "E", obj.TPStatus);
                                }
                                else
                                {
                                    LocalCheckEndPlan(obj.TPId);
                                }

                            }
                            else if (action == "取消任务")
                            {
                                if (await _commonFun.Confirm("确定取消该任务吗?"))
                                {
                                    if (obj.TPType == "C")// 自定义任务
                                    {
                                        LocalCheckCustomizedTask(obj.TPId, "C", obj.TPStatus);
                                    }
                                    else
                                    {
                                        LocalClosePlanTask(obj.TPId);
                                    }
                                }
                            }
                        }

                    }
                    else
                    {
                        if (obj.TPType == "C")
                        {
                            CheckCustomizedTask(obj.TPId, "A", obj.TPStatus);
                        }
                        else
                        {
                            CheckPlan(obj.TPId, "");
                        }
                    }
                });

                MessagingCenter.Subscribe<string>(this, "SearchTaskList", (disId) =>
                {
                    _isChecking = true;
                    _statu = "N";

                    GetLocalPlans(Convert.ToInt32(disId));
                });
            }
            catch (Exception)
            {
                _commonFun.AlertLongText("操作异常,请重试。-->TaskListViewModel");
                return;
            }
        }
示例#7
0
        private async void SavePsw()
        {
            try
            {
                if (string.IsNullOrWhiteSpace(OldPassword))
                {
                    _commonFun.AlertLongText("请输入旧密码。");
                    return;
                }
                else if (OldPassword != CommonContext.Account.Password)
                {
                    _commonFun.AlertLongText("旧密码输入有误,请重新输入。");
                    return;
                }
                else if (string.IsNullOrWhiteSpace(NewPassword))
                {
                    _commonFun.AlertLongText("请输入新密码。");
                    return;
                }
                else if (string.IsNullOrWhiteSpace(ConfirmPassword))
                {
                    _commonFun.AlertLongText("请输入确认密码。");
                    return;
                }
                else if (NewPassword != ConfirmPassword)
                {
                    _commonFun.AlertLongText("新密码与确认密码不一致,请确认。");
                    return;
                }
                if (await _commonFun.Confirm("确认修改密码吗?"))
                {
                    if (_commonHelper.IsNetWorkConnected() == true)
                    {
                        try
                        {
                            _commonFun.ShowLoading("变更中...");

                            var result = await _accountService.UpdatePsw(CommonContext.Account.UserId, NewPassword);

                            if (result.ResultCode == Module.ResultType.Success)
                            {
                                _commonFun.HideLoading();
                                //_commonFun.AlertLongText("变更完毕。 ");
                                //_commonFun.ExistSystem();
                                OldPassword     = "";
                                NewPassword     = "";
                                ConfirmPassword = "";
                                Device.BeginInvokeOnMainThread(async() =>
                                {
                                    await Navigation.PopAsync();
                                    _commonFun.AlertLongText("变更完毕。");
                                });
                            }
                            else
                            {
                                _commonFun.HideLoading();
                                _commonFun.AlertLongText("提交失败,请重试。 " + result.Msg);
                                return;
                            }
                        }
                        catch (OperationCanceledException)
                        {
                            _commonFun.HideLoading();
                            _commonFun.AlertLongText("请求超时。");
                            return;
                        }
                        catch (Exception)
                        {
                            _commonFun.HideLoading();
                            return;
                        }
                        finally
                        {
                            _commonFun.HideLoading();
                        }
                    }
                    else
                    {
                        _commonFun.AlertLongText("网络连接异常。");
                        return;
                    }
                }
            }
            catch (Exception)
            {
                _commonFun.AlertLongText("操作异常,请重试。-->ChangePasswordViewModel");
                return;
            }
        }