Exemplo n.º 1
0
        /// <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 = "LastUpdatedTime";
            pageRepuestParams.SortOrder = "desc";

            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 <ModuleManagerModel> > >(GlobalData.ServerRootUri + "ModuleManager/PageData", 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)
            {
                Application.Current.Resources["UiMessage"] = result?.Message;
                LogHelper.Info(Application.Current.Resources["UiMessage"].ToString());
                if (result.Data.Data.Any())
                {
                    ModuleManagerInfoList = new ObservableCollection <ModuleManagerModel>(result.Data.Data);
                    foreach (var data in ModuleManagerInfoList)
                    {
                        ParentComboxData parentComboxData = new ParentComboxData();
                        parentComboxData.ParentId = data.Id.ToString();
                        parentComboxData.Name     = data.Name;
                        if (data.ParentId == null)
                        {
                            ParentComboxInfoList.Add(parentComboxData);
                        }
                    }
                    int TotalCounts = result.Data.Total;
                }
                else
                {
                    ModuleManagerInfoList?.Clear();
                    Application.Current.Resources["UiMessage"] = "未找到数据";
                }
            }
            else
            {
                //操作失败,显示错误信息
                ModuleManagerInfoList = new ObservableCollection <ModuleManagerModel>();
                Application.Current.Resources["UiMessage"] = result?.Message ?? "查询模块信息失败,请联系管理员!";
            }
        }
Exemplo n.º 2
0
        public override void OnParamterChanged(object parameter)
        {
            this.ModuleManagerModel = parameter as ModuleManagerModel;


            if (ModuleManagerModel.ParentId != null)
            {
                getPageData(1, 1000000);
                getFunctionPageData(1, 1000000);
                SelectCheckedFunctions();
                this.ParentComboxInfo = ParentComboxInfoList.Where(x => x.ParentId.Equals(ModuleManagerModel.ParentId.ToString())).FirstOrDefault();
            }
        }