using System;
|
using System.Collections.Generic;
|
namespace IStation.WinFrmUI.Monitor
|
{
|
public partial class SearchHistoryData : DocumentPage
|
{
|
public SearchHistoryData()
|
{
|
InitializeComponent();
|
this.PageTitle.Caption = "查询数据";
|
this.SurfaceGuid = new SurfaceGuid()
|
{
|
Modular = eModular.Basic,
|
Function = this.PageTitle.Caption
|
};
|
}
|
|
//初始化
|
private void SearchHistoryData_Load(object sender, EventArgs e)
|
{
|
WaitFrmHelper.ShowWaitForm();
|
spinEditYear.Text = DateTime.Today.Year.ToString();
|
comboBoxMonth.Text = DateTime.Today.Month.ToString();
|
RefreshList();
|
listBoxDay.SelectedIndex = DateTime.Today.Day - 1;
|
WaitFrmHelper.HideWaitForm();
|
}
|
|
|
private void RefreshList()
|
{
|
int year = Convert.ToInt32(spinEditYear.Text);
|
int month = Convert.ToInt32(comboBoxMonth.Text);
|
|
int day_count = DateTime.DaysInMonth(year, month);
|
listBoxDay.Items.Clear();
|
for (int i = 1; i <= day_count; i++)
|
{
|
listBoxDay.Items.Add(i.ToString());
|
}
|
dict = BLL.AnaPrj.GetExistStatus(year, month);
|
}
|
Dictionary<int, bool> dict = null;
|
|
|
private void listBoxDay_SelectedIndexChanged_1(object sender, EventArgs e)
|
{
|
if (listBoxDay.SelectedIndex < 0)
|
return;
|
if (listBoxDay.Items.Count == 0)
|
return;
|
int year = Convert.ToInt32(spinEditYear.Text);
|
int month = Convert.ToInt32(comboBoxMonth.Text);
|
int day = listBoxDay.SelectedIndex + 1;
|
var choicedata= new DateTime(year, month, day);
|
if (choicedata > DateTime.Now) return;
|
this.resultChartControl1.SetBindingData(choicedata);
|
}
|
//月变化
|
private void comboBoxMonth_SelectedIndexChanged(object sender, EventArgs e)
|
{
|
RefreshList();
|
}
|
//年变化
|
private void spinEditYear_EditValueChanged_1(object sender, EventArgs e)
|
{
|
RefreshList();
|
}
|
|
private void listBoxDay_CustomItemDisplayText_1(object sender, DevExpress.XtraEditors.CustomItemDisplayTextEventArgs e)
|
{
|
if (dict == null)
|
return;
|
if (e.Item == null)
|
return;
|
if (!dict[e.Index + 1])
|
{
|
e.DisplayText = string.Format("{0} (无)", e.Value);
|
}
|
}
|
}
|
|
}
|