public ActionResult Index2(int id) { if (id == 1) { List <DataBag> sou = new List <DataBag>(); List <config_file_first_kindModel> list = MyProperty.BJSelect(); int countr = 0; double zq = 0; foreach (config_file_first_kindModel item in list) { List <HumenModel> lhu = hu.SelectById(item.first_kind_id); double sum = 0; List <int> sid = new List <int>(); foreach (HumenModel sl in lhu) { sum += sl.salary_sum; sid.Add(sl.human_id); } DataBag ss = new DataBag() { name = item.first_kind_name, count = lhu.Count, moneysum = sum, id = sid }; countr += ss.count; zq += ss.moneysum; sou.Add(ss); } ViewData["list"] = sou; ViewData["xcz"] = sou.Count; ViewData["countr"] = countr; ViewData["zq"] = zq; ViewData["jg"] = 1; } if (id == 2) { List <DataBag> sou = new List <DataBag>(); List <config_file_second_kindModel> list = MyProperty2.BJSelect(); int countr = 0; double zq = 0; foreach (config_file_second_kindModel item in list) { List <HumenModel> lhu = hu.SelectById2(item.second_kind_id); double sum = 0; List <int> sid = new List <int>(); foreach (HumenModel sl in lhu) { sum += sl.salary_sum; sid.Add(sl.human_id); } DataBag ss = new DataBag() { name = item.second_kind_name, count = lhu.Count, moneysum = sum, id = sid }; countr += ss.count; zq += ss.moneysum; sou.Add(ss); } ViewData["list"] = sou; ViewData["xcz"] = sou.Count; ViewData["countr"] = countr; ViewData["zq"] = zq; ViewData["jg"] = 2; } if (id == 3) { List <DataBag> sou = new List <DataBag>(); List <config_file_third_kindModel> list = MyProperty3.BJSelect(); int countr = 0; double zq = 0; foreach (config_file_third_kindModel item in list) { List <HumenModel> lhu = hu.SelectById3(item.third_kind_id); double sum = 0; List <int> sid = new List <int>(); foreach (HumenModel sl in lhu) { sum += sl.salary_sum; sid.Add(sl.human_id); } DataBag ss = new DataBag() { name = item.third_kind_name, count = lhu.Count, moneysum = sum, id = sid }; countr += ss.count; zq += ss.moneysum; sou.Add(ss); } ViewData["list"] = sou; ViewData["xcz"] = sou.Count; ViewData["countr"] = countr; ViewData["zq"] = zq; ViewData["jg"] = 3; } return(View()); }