zoukankan      html  css  js  c++  java
  • .net MVC知识积累,当遇到一个页面有多个数据集合时可以采用哈希表来存贮集合。通过循环来读取数据!

    业务层数据接口

    /// <summary>
    /// a计划
    /// </summary>
    public IManagerPlanRecover MPR { get; set; }

    /// <summary>
    /// b计划
    /// </summary>
    public IManagerPlanNutritionInfo MPNU { get; set; }

    /// <summary>
    /// c计划
    /// </summary>
    public IManagerPsychConPlan IMPCP { get; set; }

    ToDayPlanKFandYyVM todaykfyy = new ToDayPlanKFandYyVM();//实例化一个实体模型来存储数据。

    IDictionary ht = new Hashtable();实例化数据字典,键值对数据。

    IList<PlanNutritionInfo> planrelist = MPNU.GetList(Plnu, 10, 1);数据集合
    ht["plannu"] = planrelist;存贮对象

    IList<PlanRecoverInfo> planrev = MPR.GetList(query, 10, 1);
    ht["planrec"] = planrev;

    IList<PsychConPlanInfo> pslst = IMPCP.GetList(psinfo, 1, 1);
    ht["psych"] = pslst;

     StringBuilder strbuil = new StringBuilder();用字符串存放数据,返回页面显示。

    foreach (DictionaryEntry de in ht)循环数据
    {
    if (de.Key.ToString() == "plannu")
    {
    foreach (PlanNutritionInfo plannutinfo in (de.Value as IList<PlanNutritionInfo>))
    {
    strbuiy.Append(plannutinfo.Weight);
    strbuiy.Append(System.Environment.NewLine);
    }
    todaykfyy.YingYang = strbuiy.ToString();
    }
    else if (de.Key.ToString() == "planrec")
    {
    foreach (PlanRecoverInfo planrec in (de.Value as IList<PlanRecoverInfo>))
    {
    todaykfyy.BasicInfo = planrec.Aim;
    }
    }
    }

  • 相关阅读:
    定时器的应用---查询方式---让8个LED灯,左右各4个来回亮
    单片机实现60s定时器
    单片机不同晶振怎么计算延迟时间?
    573锁存器驱动8段数码管
    51单片机英文引脚等中文对照
    Java【小考】
    viso2010从mysql中导出ER图
    驱动继电器实验
    驱动蜂鸣器的实验
    驱动数码管的实验
  • 原文地址:https://www.cnblogs.com/zjmzone/p/2362681.html
Copyright © 2011-2022 走看看