duheng
8 天以前 4de480ec624d3b79ca690dc906e10cd2fbdc9be7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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);
             }
        }
    }
     
}