示例#1
0
        /// <summary>
        /// 根据年份获取月份
        /// </summary>
        /// <param name="year">年份</param>
        /// <returns>月份</returns>
        public static List <KeyValueInfo> GetMonthList(int year)
        {
            List <KeyValueInfo> list = new List <KeyValueInfo>();
            int start = 1;
            int limit = 12;

            if (year == DateTime.Now.Year)  //当年数据
            {
                limit = DateTime.Now.Month; //未指定月份,限定当前年当前月
            }
            else
            {
                limit = 12;
            }

            for (int i = start; i <= limit; i++)
            {
                KeyValueInfo item = new KeyValueInfo();

                item.ID   = i;
                item.Name = i.ToString();

                list.Add(item);
            }

            return(list);
        }
示例#2
0
        /// <summary>
        /// 根据起止年份获取年份列表
        /// </summary>
        /// <param name="startYear">起始年份</param>
        /// <param name="endYear">截止年份</param>
        /// <returns>年份列表</returns>
        public static List <KeyValueInfo> GetYearList(int startYear, int endYear = 0)
        {
            List <KeyValueInfo> list = new List <KeyValueInfo>();

            if (endYear == 0)
            {
                endYear = DateTime.Today.Year;
            }

            for (int i = startYear; i <= endYear; i++)
            {
                KeyValueInfo item = new KeyValueInfo();
                item.ID   = i;
                item.Name = i.ToString();
                list.Add(item);
            }

            return(list);
        }
示例#3
0
        /// <summary>
        /// 获取维度列表
        /// </summary>
        /// <returns>维度列表</returns>
        public static List <KeyValueInfo> GetDimensionList()
        {
            List <KeyValueInfo> list  = new List <KeyValueInfo>();
            KeyValueInfo        item1 = new KeyValueInfo();

            list.Add(new KeyValueInfo()
            {
                ID = AcceptanceYear, Name = "时间类型-年"
            });
            list.Add(new KeyValueInfo()
            {
                ID = AcceptanceMonth, Name = "时间类型-月"
            });
            list.Add(new KeyValueInfo()
            {
                ID = EquipmentType, Name = "设备类型"
            });
            list.Add(new KeyValueInfo()
            {
                ID = AmountType, Name = "资产价值"
            });
            list.Add(new KeyValueInfo()
            {
                ID = UsageTimeType, Name = "使用年限"
            });
            list.Add(new KeyValueInfo()
            {
                ID = OriginType, Name = "设备产地"
            });
            list.Add(new KeyValueInfo()
            {
                ID = DepartmentType, Name = "使用科室"
            });
            list.Add(new KeyValueInfo()
            {
                ID = ManufacturerType, Name = "厂商"
            });

            return(list);
        }