Ejemplo n.º 1
0
        private void SetInfoList(RequestInfoListModel requestInfoListModel)
        {
            loding.Visibility = Visibility.Visible;
            Task.Run(() =>
            {
                ResultJson <ResponseInfoListModel> resultJson = InfoListService.getQuery(requestInfoListModel);

                if (resultJson.code == "20000")
                {
                    List <InfoListModel> newList = ToDataGrid(resultJson.data.addIndex(resultJson.data.data) ?? new List <InfoListModel>());
                    this.Dispatcher.Invoke(() =>
                    {
                        pageControl.DataTote = resultJson.data.total;
                        dataGrid.ItemsSource = newList;
                        loding.Visibility    = Visibility.Hidden;
                    });
                }
                else
                {
                    this.Dispatcher.Invoke(() =>
                    {
                        MessageTips(resultJson.message);
                        dataGrid.ItemsSource = ToDataGrid(new List <InfoListModel>());
                        loding.Visibility    = Visibility.Hidden;
                    });
                }
            });
        }
Ejemplo n.º 2
0
 private void SetInfoList(RequestInfoListModel requestInfoListModel)
 {
     loding.Visibility = Visibility.Visible;
     Task.Run(() =>
     {
         List <InfoListModel> lists = SettingJsonConfig.readData() ?? new List <InfoListModel>();
         if (lists != null)
         {
             if (requestInfoListModel.name != null)
             {
                 lists = lists.Where(u => u.userName.ToString() == requestInfoListModel.name).ToList();
             }
             if (requestInfoListModel.cardNo != null)
             {
                 lists = lists.Where(u => u.cardNo.ToString() == requestInfoListModel.cardNo).ToList();
             }
             if (requestInfoListModel.startTime != null)
             {
                 lists = lists.Where(u => DateTime.Parse(u.createTime) >= DateTime.Parse(requestInfoListModel.startTime)).ToList();
             }
             if (requestInfoListModel.endTime != null)
             {
                 lists = lists.Where(u => DateTime.Parse(u.createTime) <= DateTime.Parse(requestInfoListModel.endTime)).ToList();
             }
             lists.Reverse();
             List <InfoListModel> data = lists.Skip((requestInfoListModel.pageNo - 1) * requestInfoListModel.pageSize).Take(requestInfoListModel.pageSize).ToList();
             //添加序号
             int current = 1;
             Thread.Sleep(250);
             foreach (var item in data)
             {
                 item.index              = current;
                 item.Editor_company     = false;
                 item.Editor_homeAddress = false;
                 current++;
             }
             List <InfoListModel> newlist = ToDataGrid(data);
             this.Dispatcher.Invoke(() =>
             {
                 pageControl.DataTote    = lists.Count();
                 pageControl.CurrentPage = requestInfoListModel.pageNo;
                 dataGrid.ItemsSource    = newlist;
                 loding.Visibility       = Visibility.Hidden;
             });
         }
         else
         {
             this.Dispatcher.Invoke(() =>
             {
                 dataGrid.ItemsSource = null;
                 dataGrid.ItemsSource = new List <InfoListModel>();
                 loding.Visibility    = Visibility.Hidden;
             });
         }
     });
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <returns></returns>
        private void QuerySelect_page(int page)
        {
            RequestInfoListModel requestInfoListModel = new RequestInfoListModel()
            {
                pageNo    = page,
                pageSize  = pageControl.PageSize,
                cardNo    = staticCardNo == "" ? null : staticCardNo,
                name      = staticName == "" ? null : staticName,
                startTime = staticStartTime == "" ? null : staticStartTime,
                endTime   = staticEndTime == "" ? null : staticEndTime
            };

            SetInfoList(requestInfoListModel);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 初始化没有条件
 /// </summary>
 /// <param name="page"></param>
 /// <param name="size"></param>
 /// <returns></returns>
 public static ResultJson <ResponseInfoListModel> getAll(int page, int size)
 {
     try
     {
         string url = UrlModel.ip + UrlModel.nucleic;
         RequestInfoListModel requestLoginModel = new RequestInfoListModel(page, size);
         string result = HttpUrlConfig.GetQuery(url, requestLoginModel);
         ResultJson <ResponseInfoListModel> retStu = JsonConvert.DeserializeObject <ResultJson <ResponseInfoListModel> >(result);
         Logger.Default.Info(result);
         return(retStu);
     }
     catch (Exception ex)
     {
         Logger.Default.Error(ex.Message);
         return(null);
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 条件
        /// </summary>
        /// <param name="page"></param>
        private void QuerySelect_click(int page)
        {
            RequestInfoListModel requestInfoListModel = new RequestInfoListModel()
            {
                pageNo    = page,
                pageSize  = pageControl.PageSize,
                cardNo    = TextBox_CardNo.Text == "" ? null : TextBox_CardNo.Text,
                name      = TextBox_Name.Text == "" ? null : TextBox_Name.Text,
                startTime = dateTimeStart.Text == "" ? null : dateTimeStart.Text,
                endTime   = dateTimeEnd.Text == "" ? null : dateTimeEnd.Text
            };

            SetInfoList(requestInfoListModel);
            //绑定静态值
            staticName      = TextBox_Name.Text;
            staticCardNo    = TextBox_CardNo.Text;
            staticStartTime = dateTimeStart.Text;
            staticEndTime   = dateTimeEnd.Text;
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 条件查询
 /// </summary>
 /// <param name="page"></param>
 /// <param name="size"></param>
 /// <returns></returns>
 public static ResultJson <ResponseInfoListModel> getQuery(RequestInfoListModel re)
 {
     try
     {
         string url    = UrlModel.ip + UrlModel.nucleic;
         string result = HttpUrlConfig.GetQuery(url, re);
         ResultJson <ResponseInfoListModel> retStu = JsonConvert.DeserializeObject <ResultJson <ResponseInfoListModel> >(result);
         Logger.Default.Info(result);
         return(retStu);
     }
     catch (Exception ex)
     {
         Logger.Default.Error(ex.Message);
         return(new ResultJson <ResponseInfoListModel>()
         {
             code = "1", message = "查无结果"
         });
     }
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 回传专用
 /// </summary>
 private void BackList()
 {
     Task.Run(() =>
     {
         try
         {
             List <InfoListModel> allList = new List <InfoListModel>();
             RequestInfoListModel requestInfoListModel = new RequestInfoListModel()
             {
                 pageNo = 1, pageSize = 1
             };
             ResultJson <ResponseInfoListModel> resultJson = InfoListService.getQuery(requestInfoListModel);
             if (resultJson.code == "20000")
             {
                 int times = resultJson.data.total / 1000 + 1;
                 requestInfoListModel.pageSize = 1000;
                 for (int i = 1; i <= times; i++)
                 {
                     requestInfoListModel.pageNo = i;
                     resultJson = InfoListService.getQuery(requestInfoListModel);
                     List <InfoListModel> newList = ToBack(resultJson.data.data ?? new List <InfoListModel>());
                     allList.AddRange(newList);
                 }
                 allList.Reverse();
                 SettingJsonConfig.saveData(allList);
                 this.Dispatcher.Invoke(() => { ShowOK("数据回传完成"); });
                 return;
             }
             else
             {
                 this.Dispatcher.Invoke(() => { ShowOK("数据回传失败,请稍后重试"); });
                 return;
             }
         }
         catch (Exception ex)
         {
             this.Dispatcher.Invoke(() => { ShowOK(ex.Message); });
             return;
         }
     });
 }