public ViewResult Index(string year, string month) { if (string.IsNullOrEmpty(year)) { year = DateTime.Now.Year.ToString(); } if (string.IsNullOrEmpty(month)) { month = DateTime.Now.Month.ToString(); } var years = new List <dynamic>(); for (int i = 0; i < 10; i++) { years.Add(new { value = (DateTime.Now.Year - i).ToString(), text = (DateTime.Now.Year - i).ToString() }); } var months = new List <dynamic>(); //for (int i = 1; i <= 12; i++) //{ // months.Add(new { value = i.ToString(), text = (i + "月") }); //} months.Add(new { value = 1, text = ("一月") }); months.Add(new { value = 2, text = ("二月") }); months.Add(new { value = 3, text = ("三月") }); months.Add(new { value = 4, text = ("四月") }); months.Add(new { value = 5, text = ("五月") }); months.Add(new { value = 6, text = ("六月") }); months.Add(new { value = 7, text = ("七月") }); months.Add(new { value = 8, text = ("八月") }); months.Add(new { value = 9, text = ("九月") }); months.Add(new { value = 10, text = ("十月") }); months.Add(new { value = 11, text = ("十一月") }); months.Add(new { value = 12, text = ("十二月") }); ViewData["year"] = new SelectList(years, "value", "text", year); ViewData["month"] = new SelectList(months, "value", "text", month); var user = OperatorProvider.Provider.Current(); var bll = new WorkmeetingBLL(); //var data = bll.GetAttendanceData2(user.DeptId, new DateTime(int.Parse(year), int.Parse(month), 1), new DateTime(int.Parse(year), int.Parse(month), 1).AddMonths(1).AddMinutes(-1)); var data = bll.GetAttendanceData(user.DeptId, int.Parse(year), int.Parse(month)); return(View(data)); }