Beispiel #1
0
        private void btnExport_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string         str             = "Excel (*.xlsx)|*.xlsx";

            saveFileDialog1.Filter = str;
            SaveFileDialog saveFileDialog2 = saveFileDialog1;

            if (saveFileDialog2.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            AlarmInfoListResponse infoListResponse = LocalApi.GetAlarmInfoList(new AlarmInfoListRequest()
            {
                Keyword = this.Keyword, AlarmDateStart = this.AlarmDateStart, AlarmDateEnd = this.AlarmDateEnd, PageNumber = 1, PageSize = int.MaxValue
            });

            if (infoListResponse.IsError)
            {
                return;
            }
            PagedData <AlarmInfoModel> rows = infoListResponse.AlarmInfoModel;
            ExcelExport excelExport         = new ExcelExport();
            DataTable   table = ToDataTable(rows.ToList());

            excelExport.sheetName = "新报警记录";

            excelExport.ExcuteExport(saveFileDialog2.FileName, table);
        }
Beispiel #2
0
        public void RefreshData(int?pageNumber = 1)
        {
            AlarmInfoListResponse alarmInfoListResponse = LocalApi.GetAlarmInfoList(new AlarmInfoListRequest()
            {
                Keyword        = this.Keyword,
                AlarmDateStart = this.AlarmDateStart,
                AlarmDateEnd   = this.AlarmDateEnd,
                PageNumber     = pageNumber.Value,
                CraftsDid      = CraftDID,
                PageSize       = 15
            });

            this.pager.Setup(alarmInfoListResponse.AlarmInfoModel);
            this.dataGrid.ItemsSource = alarmInfoListResponse.AlarmInfoModel;
        }