Exemplo n.º 1
0
        //绑定所属实验室
        protected void LabDropdownlist()
        {
            LabMS.BLL.Lab lab = new LabMS.BLL.Lab();
            List<LabMS.Model.Lab> ParLab = new List<LabMS.Model.Lab>();
            List<LabMS.Model.Lab> SonLab = new List<LabMS.Model.Lab>();
            List<LabMS.Model.Lab> LabTemp = new List<LabMS.Model.Lab>();

            ParLab = lab.GetModelList("Lab_ParentID is null");
            SonLab = lab.GetModelList("Lab_ParentID is not null");
            LabTemp = lab.GetModelList("Lab_ParentID is null");

            int count = ParLab.Count, count1 = SonLab.Count;
            for (int i = 0; i < count; i++)
            {
                int ID = ParLab[i].ID;
                int m = 0;
                for (int j = 0; j < count1; j++)
                {
                    LabMS.Model.Lab labModel = new LabMS.Model.Lab();
                    int ParentID = int.Parse(SonLab[j].Lab_ParentID.ToString());

                    if (ParentID == ID)
                    {
                        labModel.ID = SonLab[j].ID;
                        labModel.Lab_Name = "|-" + SonLab[j].Lab_Name;
                        LabTemp.Insert(i + m + 1, labModel);
                        m++;
                    }
                }
            }
            RespLabDDL.DataSource = LabTemp;
            RespLabDDL.DataBind();
            ListItem item = new ListItem("无", "0");
            RespLabDDL.Items.Insert(0, item);
        }
Exemplo n.º 2
0
 public void bind(string strWhere)
 {
     List<LabMS.Model.Lab> listlabmodule = new
         List<LabMS.Model.Lab>();
     LabMS.BLL.Lab blab = new LabMS.BLL.Lab();
     listlabmodule = blab.GetModelList(strWhere + " order by ID desc ");
     GridViewDic.DataSource = listlabmodule;
     GridViewDic.DataBind();
 }