using DevExpress.XtraCharts;
|
using DevExpress.XtraEditors;
|
using DevExpress.XtraGrid.Views.BandedGrid;
|
using IStation.Unit;
|
using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using System.Windows.Forms;
|
|
namespace IStation.WinFrmUI.Monitor
|
{
|
public partial class DataListGridCtrl : XtraUserControl
|
{
|
public DataListGridCtrl()
|
{
|
InitializeComponent();
|
this.gridView1.SetNormalView();
|
this.gridView1.OptionsView.ShowDetailButtons = true;
|
this.gridView1.OptionsDetail.ShowDetailTabs = false;
|
this.gridView2.SetNormalView();
|
}
|
|
|
public class CurrentViewModel : Model.StationSignalRecord
|
{
|
public CurrentViewModel() { }
|
public CurrentViewModel(Model.StationSignalRecord rhs) : base(rhs) { }
|
public string Date { get; set; }
|
|
}
|
|
|
private List<CurrentViewModel> _allBindingList = null;
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
public void SetBindingData()
|
{
|
var list = new BLL.MonthSignalRecordPacket().Get();
|
SetBindingData(list);
|
}
|
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
public void SetBindingData(List<Model.MonthSignalRecordPacket> list)
|
{
|
_allBindingList = new List<CurrentViewModel>();
|
if (list != null && list.Any())
|
{
|
foreach (var packet in list)
|
{
|
if (packet.StationSignalRecords == null || !packet.StationSignalRecords.Any())
|
continue;
|
foreach (var stationSignalRecords in packet.StationSignalRecords)
|
{
|
var vm = new CurrentViewModel(stationSignalRecords);
|
vm.Date = packet.Year + "-" + packet.Month;
|
_allBindingList.Add(vm);
|
}
|
}
|
}
|
|
this.currentViewModelBindingSource.DataSource = _allBindingList;
|
}
|
|
|
/// <summary>
|
/// 分析并保存
|
/// </summary>
|
public void AnalysisAndSave()
|
{
|
if (XtraMessageBox.Show("是否重新分析数据?", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) != DialogResult.Yes)
|
return;
|
WaitFrmHelper.ShowWaitForm();
|
var result = new BLL.MonthSignalRecordPacket_Analy().AnalysisAndSave();
|
if (!result)
|
{
|
WaitFrmHelper.HideWaitForm();
|
XtraMessageBox.Show("重新分析失败!");
|
return;
|
}
|
SetBindingData();
|
XtraMessageBox.Show("重新分析成功!");
|
WaitFrmHelper.HideWaitForm();
|
|
}
|
}
|
|
}
|