Esempio n. 1
0
        /// <summary>
        /// 模型数据改变
        /// </summary>
        /// <param name="obj"></param>
        private void dataChanged(EnterpriseModel enterpriseModel)
        {
            getPageData(pageRepuestParams.PageIndex, pageRepuestParams.PageSize);
            var tmpModel = EnterpriseInfoList.FirstOrDefault(a => a.Id == enterpriseModel.Id);

            this.EnterpriseInfo = EnterpriseInfoList.FirstOrDefault();
        }
Esempio n. 2
0
 private void OnPageCountChangedCommand()
 {
     if (EnterpriseInfoList.Any())
     {
         ShowEnterpriseInfoList = EnterpriseInfoList.Skip((PageCount - 1) * pageSize).Take(pageSize).ToObservableCollection <EnterpriseModel>();
     }
 }
Esempio n. 3
0
 private void OnPageSizeChangedCommand()
 {
     if (EnterpriseInfoList.Any())
     {
         TotalPageCount         = (int)Math.Ceiling((decimal)EnterpriseInfoList.Count() / pageSize);
         ShowEnterpriseInfoList = EnterpriseInfoList.Skip((PageCount - 1) * pageSize).Take(pageSize).ToObservableCollection <EnterpriseModel>();
     }
 }
Esempio n. 4
0
        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 <EnterpriseModel> > >(GlobalData.ServerRootUri + "EnterpriseInfo/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())
                {
                    //TotalCounts = result.Data.Total;
                    //Messenger.Default.Send(LoginUser, MessengerToken.LoginSuccess);
                    EnterpriseInfoList = new ObservableCollection <EnterpriseModel>(result.Data.Data);
                    TotalCounts        = result.Data.Total;
                }
                else
                {
                    EnterpriseInfoList?.Clear();
                    TotalCounts = 0;
                    Application.Current.Resources["UiMessage"] = "未找到数据";
                }
            }
            else
            {
                //操作失败,显示错误信息
                EnterpriseInfoList = new ObservableCollection <EnterpriseModel>();
                Application.Current.Resources["UiMessage"] = result?.Message ?? "查询企业信息失败,请联系管理员!";
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 构造函数
        /// </summary>
        public EntSiteInfoAddViewModel()
        {
            ConfirmCommand               = new GalaSoft.MvvmLight.CommandWpf.RelayCommand(OnExecuteConfirmCommand, OnCanExecuteConfirmCommand);
            CancelCommand                = new GalaSoft.MvvmLight.CommandWpf.RelayCommand(OnExecuteCancelCommand);
            PageCountChangedCommand      = new GalaSoft.MvvmLight.CommandWpf.RelayCommand(OnPageCountChangedCommand, OnCanPageCountChangedCommand);
            PageSizeChangedCommand       = new GalaSoft.MvvmLight.CommandWpf.RelayCommand(OnPageSizeChangedCommand, OnCanPageSizeChangedCommand);
            TotalPageCountChangedCommand = new GalaSoft.MvvmLight.CommandWpf.RelayCommand(OnTotalPageCountChangedCommand, OnCanTotalPageCountChangedCommand);
            ComboxSearchCommand          = new GalaSoft.MvvmLight.CommandWpf.RelayCommand(OnSearchChangedCommand, OnCanSearchChangedCommand);
            EnterpriseNameChangedCommand = new GalaSoft.MvvmLight.CommandWpf.RelayCommand(OnEnterpriseNameChangedCommand, OnCanEnterpriseNameChangedCommand);

            PageSizeList = new List <int>()
            {
                5, 10, 20, 50
            };
            getPageData(1, 10000);
            TotalPageCount         = (int)Math.Ceiling((decimal)EnterpriseInfoList.Count() / pageSize);
            ShowEnterpriseInfoList = EnterpriseInfoList.Skip((PageCount - 1) * pageSize).Take(pageSize).ToObservableCollection <EnterpriseModel>();
        }
Esempio n. 6
0
        private void OnSearchChangedCommand()
        {
            if (String.IsNullOrEmpty(ComboboxContent))
            {
                pageRepuestParams.FilterGroup = null;
                getPageData(1, 10000);
                TotalPageCount         = (int)Math.Ceiling((decimal)EnterpriseInfoList.Count() / pageSize);
                PageCount              = 1;
                ShowEnterpriseInfoList = EnterpriseInfoList.Skip((PageCount - 1) * pageSize).Take(pageSize).ToObservableCollection <EnterpriseModel>();
            }
            else
            {
                FilterGroup filterGroup    = new FilterGroup(FilterOperate.Or);
                FilterRule  filterRuleName = new FilterRule("EnterpriseName", ComboboxContent.Trim(), "contains");
                filterGroup.Rules.Add(filterRuleName);

                pageRepuestParams.FilterGroup = filterGroup;
                getPageData(1, 10000);
                TotalPageCount         = (int)Math.Ceiling((decimal)EnterpriseInfoList.Count() / pageSize);
                PageCount              = 1;
                ShowEnterpriseInfoList = EnterpriseInfoList.Skip((PageCount - 1) * pageSize).Take(pageSize).ToObservableCollection <EnterpriseModel>();
            }
        }