zoukankan      html  css  js  c++  java
  • c# 矿山企业用户 control层 从获取当前登录用户的code 以此作为判断条件 循环找出code对应的数据

     1   public ActionResult Index(ReserveInfoRequest request)
     2         {
     3            
     4             List<string> MineList= this.AccountService.GetPermMineList(this.CookieContext.UserId);
     5 
     6             var result = this.ReserveService.GetReserveList(request);
     7          
     8              List<ReserveInfo> Items = new List<ReserveInfo>();
     9             
    10             foreach (ReserveInfo Reserve in result)
    11             {
    12                 if (MineList[0] == Reserve.MineCode)
    13                 {
    14                     Items.Add(Reserve);
    15                   
    16                  }
    17             }
    18             PagedList<ReserveInfo> pagedlist = new PagedList<ReserveInfo>(Items, 1, 10);
    19            
    20            // result=result.Where(m => MineList.Contains(m.MineCode));
    21 
    22             ReserveInfoRequest NewRequest = new ReserveInfoRequest();
    23             var MineNameList = this.ReserveService.GetReserveList(NewRequest);
    24             //定义ViewBag.MineName
    25             Dictionary<int, String> dictionaryName = new Dictionary<int, string>();
    26             int i = 0;
    27             List<String> mineNameList = new List<String>();
    28             foreach (ReserveInfo yearCheck in MineNameList)
    29             {
    30                 if (!mineNameList.Contains(yearCheck.MineName))
    31                 {
    32                     mineNameList.Add(yearCheck.MineName);
    33                     dictionaryName.Add(i, yearCheck.MineName);
    34                     i++;
    35                 }
    36             }
    37             this.ViewBag.MineName = new SelectList(dictionaryName, "", "value ");
    38 
    39             //定义ViewBag.Year
    40             Dictionary<int, String> dictionaryYear = new Dictionary<int, string>();
    41             int j = 0;
    42             List<String> YearList = new List<String>();
    43             foreach (ReserveInfo reserve in MineNameList)
    44             {
    45                 if (!YearList.Contains(reserve.Year))
    46                 {
    47                     YearList.Add(reserve.Year);
    48                     dictionaryYear.Add(j, reserve.Year);
    49                     j++;
    50                 }
    51             }
    52             this.ViewBag.Year = new SelectList(dictionaryYear, "", "value ");
    53 
    54             return View(pagedlist);
    55         }
  • 相关阅读:
    UVa 1374
    天梯赛L3 004
    redis操作ZSet
    redis操作set集合
    mybatis使用注解开发
    SSM整合之mybatis的别名配置
    mybatis的5.1.10分页插件的使用
    lombok的使用
    JDBC的一个简单工具类
    mybatis的测试
  • 原文地址:https://www.cnblogs.com/ceccf/p/5796944.html
Copyright © 2011-2022 走看看