Exemplo n.º 1
0
 /// <summary>
 /// 是否可以执行打印命令
 /// </summary>
 /// <returns></returns>
 private bool OnCanExecutePrintCommand()
 {
     if (Equals(EquipmentBrandInfoList, null) || !EquipmentBrandInfoList.Any())
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
        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;
            var result = Utility.Http.HttpClientHelper.PostResponse <OperationResult <PageResult <EquipmentBrandModel> > >(GlobalData.ServerRootUri + "EquipmentBrandInfo/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);
                    EquipmentBrandInfoList = new ObservableCollection <EquipmentBrandModel>(result.Data.Data);
                    TotalCounts            = result.Data.Total;
                }
                else
                {
                    EquipmentBrandInfoList?.Clear();
                    TotalCounts = 0;
                    Application.Current.Resources["UiMessage"] = "未找到数据";
                }
            }
            else
            {
                //操作失败,显示错误信息
                EquipmentBrandInfoList = new ObservableCollection <EquipmentBrandModel>();
                Application.Current.Resources["UiMessage"] = result?.Message ?? "查询设备品牌失败,请联系管理员!";
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 模型数据改变
        /// </summary>
        /// <param name="obj"></param>
        private void dataChanged(EquipmentBrandModel EquipmentBrandModel)
        {
            getPageData(pageRepuestParams.PageIndex, pageRepuestParams.PageSize);
            var tmpModel = EquipmentBrandInfoList.FirstOrDefault(a => a.Id == EquipmentBrandModel.Id);

            this.EquipmentBrandInfo = EquipmentBrandInfoList.FirstOrDefault();
            ////新增、不存在的数据插入到第一行便于查看
            //if (Equals(tmpModel, null))
            //{
            //    this.EnterpriseInfoList.Insert(0, enterpriseModel);
            //    //this.EnterpriseInfoList.Insert(0, enterpriseModel);
            //    EnterpriseInfoList.RemoveAt(this.EnterpriseInfoList.Count - 1);
            //}
            //else
            //{
            //    //修改的更新后置于第一行,便于查看
            //    tmpModel = enterpriseModel;
            //    EnterpriseInfoList.Move(EnterpriseInfoList.IndexOf(tmpModel), 0);
            //    tmpModel = enterpriseModel;
            //}
        }