/// <summary> /// 取得分页数据 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> private void getPageData(int pageIndex, int pageSize) { #if DEBUG System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); stopwatch.Start(); #endif pageRepuestParams.SortField = GlobalData.SortField; pageRepuestParams.SortOrder = GlobalData.SortOrder; pageRepuestParams.PageIndex = pageIndex; pageRepuestParams.PageSize = pageSize; //_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); //Console.WriteLine(await (await _httpClient.GetAsync("/api/service/EnterpriseInfo/Get?id='1'")).Content.ReadAsStringAsync()); var result = Utility.Http.HttpClientHelper.PostResponse <OperationResult <PageResult <EntTeamInfoModel> > >(GlobalData.ServerRootUri + "EntTeamInfo/GetEntTeamInfoList", Utility.JsonHelper.ToJson(pageRepuestParams)); #if DEBUG stopwatch.Stop(); Utility.LogHelper.Info("获取班组信息用时(毫秒):" + stopwatch.ElapsedMilliseconds); Utility.LogHelper.Info("班组信息内容:" + Utility.JsonHelper.ToJson(result)); #endif if (!Equals(result, null) && result.Successed) { UiMessage = result?.Message; LogHelper.Info(UiMessage); if (result.Data.Data.Any()) { //TotalCounts = result.Data.Total; //Messenger.Default.Send(LoginUser, MessengerToken.LoginSuccess); EntTeamInfoList = new ObservableCollection <EntTeamInfoModel>(result.Data.Data); TotalCounts = result.Data.Total; } else { EntTeamInfoList?.Clear(); TotalCounts = 0; UiMessage = "未找到数据"; } } else { //操作失败,显示错误信息 EntTeamInfoList = new ObservableCollection <EntTeamInfoModel>(); UiMessage = result?.Message ?? "查询班组信息失败,请联系管理员!"; } }
/// <summary> /// 取得班组信息分页数据 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> private void getEntTeamInfoPageData(int pageIndex, int pageSize) { #if DEBUG System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); stopwatch.Start(); #endif pageRepuestParams.SortField = GlobalData.SortField; pageRepuestParams.SortOrder = GlobalData.SortOrder; pageRepuestParams.PageIndex = pageIndex; pageRepuestParams.PageSize = pageSize; var result = Utility.Http.HttpClientHelper.PostResponse <OperationResult <PageResult <EntTeamInfoModel> > >(GlobalData.ServerRootUri + "EntTeamInfo/GetEntTeamInfoList", Utility.JsonHelper.ToJson(pageRepuestParams)); #if DEBUG stopwatch.Stop(); Utility.LogHelper.Info("获取班组信息数据用时(毫秒):" + stopwatch.ElapsedMilliseconds); Utility.LogHelper.Info("班组信息数据内容:" + Utility.JsonHelper.ToJson(result)); #endif if (!Equals(result, null) && result.Successed) { UiMessage = result?.Message; LogHelper.Info(UiMessage); if (result.Data.Data.Any()) { EntTeamInfoList = new ObservableCollection <EntTeamInfoModel>(result.Data.Data); } else { EntTeamInfoList?.Clear(); UiMessage = "未找到数据"; } } else { //操作失败,显示错误信息 EntTeamInfoList = new ObservableCollection <EntTeamInfoModel>(); UiMessage = result?.Message ?? "查询班组信息数据失败,请联系管理员!"; } }