コード例 #1
0
        private static PropertyInfo[] SortPropertyInfosByReportDictionary(PropertyInfo[] propertyInfos)
        {
            int index = 0;
            var dics  = NormDictionary.GetReportDictionary();

            PropertyInfo[] newPropertyInfos = new PropertyInfo[dics.Keys.Count];
            foreach (var item in dics)
            {
                var property = propertyInfos.FirstOrDefault(n => n.Name == item.Value);
                newPropertyInfos[index] = property;
                index++;
                if (index == dics.Keys.Count)
                {
                    break;
                }
            }
            return(newPropertyInfos);
        }
コード例 #2
0
        private void InitSelectData()
        {
            companies.Add(new Company()
            {
                Id   = 0,
                Name = "全部公司"
            });


            var date = DateTime.Now;

            var year = date.Year;

            years.Add(new YearSelect()
            {
                Id = 0, Name = "每年"
            });
            for (int i = 0; i < 5; i++)
            {
                years.Add(new YearSelect()
                {
                    Id = year - 4 + i, Name = (year - 4 + i) + "年"
                });
            }
            yearSelect.DataSource    = years.Where(n => n.Id != 0).ToList();
            yearSelect.ValueMember   = "Id";
            yearSelect.SelectedIndex = 0;
            yearSelect.DisplayMember = "Name";
            line_Year.DataSource     = years;
            line_Year.ValueMember    = "Id";
            line_Year.DisplayMember  = "Name";
            line_Year.SelectedIndex  = 1;


            months.Add(new MonthSelect()
            {
                Id = 0, Name = "无"
            });
            months.Add(new MonthSelect()
            {
                Id = 1, IsQuarter = true, Name = "第一季度"
            });
            months.Add(new MonthSelect()
            {
                Id = 2, IsQuarter = true, Name = "第二季度"
            });
            months.Add(new MonthSelect()
            {
                Id = 3, IsQuarter = true, Name = "第三季度"
            });
            months.Add(new MonthSelect()
            {
                Id = 4, IsQuarter = true, Name = "第四季度"
            });

            months.Add(new MonthSelect()
            {
                Id = 1, Name = "一月"
            });
            months.Add(new MonthSelect()
            {
                Id = 2, Name = "二月"
            });
            months.Add(new MonthSelect()
            {
                Id = 3, Name = "三月"
            });
            months.Add(new MonthSelect()
            {
                Id = 4, Name = "四月"
            });
            months.Add(new MonthSelect()
            {
                Id = 5, Name = "五月"
            });
            months.Add(new MonthSelect()
            {
                Id = 6, Name = "六月"
            });
            months.Add(new MonthSelect()
            {
                Id = 7, Name = "七月"
            });
            months.Add(new MonthSelect()
            {
                Id = 8, Name = "八月"
            });
            months.Add(new MonthSelect()
            {
                Id = 9, Name = "九月"
            });
            months.Add(new MonthSelect()
            {
                Id = 10, Name = "十月"
            });
            months.Add(new MonthSelect()
            {
                Id = 11, Name = "十一月"
            });
            months.Add(new MonthSelect()
            {
                Id = 12, Name = "十二月"
            });
            monthSelect.DataSource    = months;
            monthSelect.ValueMember   = "Id";
            monthSelect.DisplayMember = "Name";
            monthSelect.SelectedIndex = 0;
            line_Month.DisplayMember  = "Name";
            line_Month.DataSource     = months;
            line_Month.ValueMember    = "Id";
            line_Month.SelectedIndex  = 0;

            var properties = NormDictionary.GetReportDictionary().ToList();

            properties.RemoveAt(0);
            line_Property.DataSource    = properties;
            line_Property.ValueMember   = "value";
            line_Property.DisplayMember = "key";
            line_Property.SelectedIndex = 0;
        }