Beispiel #1
0
        public async Task <bool> LogoutCleanAsync(IProgressDialog progressDialog)
        {
            APIResult fooAPIResult;

            progressDialog.Title = $"檢查與更新存取權杖";
            bool fooRefreshTokenResult = await RefreshTokenHelper.CheckAndRefreshToken(dialogService, refreshTokenManager, systemStatusManager, appStatus);

            if (fooRefreshTokenResult == false)
            {
                return(false);
            }

            await leaveFormsManager.ReadFromFileAsync();

            leaveFormsManager.Items.Clear();
            await leaveFormsManager.WriteToFileAsync();

            progressDialog.Title = $"回報例外異常資料中";
            await exceptionRecordsManager.ReadFromFileAsync();

            if (exceptionRecordsManager.Items.Count > 0)
            {
                List <ExceptionRecordRequestDTO> fooExceptionRecordRequestDTOList = new List <ExceptionRecordRequestDTO>();
                foreach (var item in exceptionRecordsManager.Items)
                {
                    ExceptionRecordRequestDTO fooExceptionRecordRequestDTO = new ExceptionRecordRequestDTO()
                    {
                        CallStack     = item.CallStack,
                        DeviceModel   = item.DeviceModel,
                        DeviceName    = item.DeviceName,
                        ExceptionTime = item.ExceptionTime,
                        Message       = item.Message,
                        OSType        = item.OSType,
                        OSVersion     = item.OSVersion,
                        User          = new UserDTO()
                        {
                            Id = appStatus.SystemStatus.UserID
                        },
                    };
                    fooExceptionRecordRequestDTOList.Add(fooExceptionRecordRequestDTO);
                }
                fooAPIResult = await exceptionRecordsManager.PostAsync(fooExceptionRecordRequestDTOList);

                if (fooAPIResult.Status != true)
                {
                    await dialogService.DisplayAlertAsync("回報例外異常資料中 發生錯誤", fooAPIResult.Message, "確定");

                    return(false);
                }
            }

            return(true);
        }
        public async Task <bool> RefreshAsync(IProgressDialog progressDialog)
        {
            APIResult fooAPIResult;

            progressDialog.Title = $"檢查與更新存取權杖";
            bool fooRefreshTokenResult = await RefreshTokenHelper.CheckAndRefreshToken(dialogService, refreshTokenManager, systemStatusManager, appStatus);

            if (fooRefreshTokenResult == false)
            {
                return(false);
            }
            //progressDialog.Title = $"回報例外異常資料中";
            //await exceptionRecordsManager.ReadFromFileAsync();
            //if (exceptionRecordsManager.Items.Count > 0)
            //{
            //    List<ExceptionRecordRequestDTO> fooExceptionRecordRequestDTOList = new List<ExceptionRecordRequestDTO>();
            //    foreach (var item in exceptionRecordsManager.Items)
            //    {
            //        ExceptionRecordRequestDTO fooExceptionRecordRequestDTO = new ExceptionRecordRequestDTO()
            //        {
            //            CallStack = item.CallStack,
            //            DeviceModel = item.DeviceModel,
            //            DeviceName = item.DeviceName,
            //            ExceptionTime = item.ExceptionTime,
            //            Message = item.Message,
            //            OSType = item.OSType,
            //            OSVersion = item.OSVersion,
            //            User = new UserDTO() { Id = appStatus.SystemStatus.UserID },
            //        };
            //        fooExceptionRecordRequestDTOList.Add(fooExceptionRecordRequestDTO);
            //    }
            //    fooAPIResult = await exceptionRecordsManager.PostAsync(fooExceptionRecordRequestDTOList);
            //    if (fooAPIResult.Status != true)
            //    {
            //        await dialogService.DisplayAlertAsync("回報例外異常資料中 發生錯誤", fooAPIResult.Message, "確定");
            //        return false;
            //    }
            //}
            progressDialog.Title = $"更新系統最新狀態資料中";
            fooAPIResult         = await systemEnvironmentsManager.GetAsync();

            if (fooAPIResult.Status != true)
            {
                await dialogService.DisplayAlertAsync("更新系統最新狀態資料中 發生錯誤", fooAPIResult.Message, "確定");

                return(false);
            }
            progressDialog.Title = $"更新請假類別代碼資料中";
            fooAPIResult         = await leaveFormTypesManager.GetAsync();

            if (fooAPIResult.Status != true)
            {
                await dialogService.DisplayAlertAsync("更新請假類別代碼資料中 發生錯誤", fooAPIResult.Message, "確定");

                return(false);
            }
            progressDialog.Title = $"更新部門資料中";
            fooAPIResult         = await departmentsManager.GetAsync();

            if (fooAPIResult.Status != true)
            {
                await dialogService.DisplayAlertAsync("更新部門資料中 發生錯誤", fooAPIResult.Message, "確定");

                return(false);
            }
            progressDialog.Title = $"更新通訊群組資料中";
            fooAPIResult         = await commUserGroupsManager.GetAsync();

            if (fooAPIResult.Status != true)
            {
                await dialogService.DisplayAlertAsync("更新部門資料中 發生錯誤", fooAPIResult.Message, "確定");

                return(false);
            }

            return(true);
        }