//绑定所属实验室
        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);
        }
Example #2
0
 /// <summary>
 /// ��������б�
 /// </summary>
 public List<LabMS.Model.Lab> GetModelList(string strWhere)
 {
     DataSet ds = dal.GetList(strWhere);
     List<LabMS.Model.Lab> modelList = new List<LabMS.Model.Lab>();
     int rowsCount = ds.Tables[0].Rows.Count;
     if (rowsCount > 0)
     {
         LabMS.Model.Lab model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new LabMS.Model.Lab();
             if(ds.Tables[0].Rows[n]["ID"].ToString()!="")
             {
                 model.ID=int.Parse(ds.Tables[0].Rows[n]["ID"].ToString());
             }
             model.Lab_Code=ds.Tables[0].Rows[n]["Lab_Code"].ToString();
             model.Lab_Name=ds.Tables[0].Rows[n]["Lab_Name"].ToString();
             model.Lab_Category=ds.Tables[0].Rows[n]["Lab_Category"].ToString();
             model.Lab_Level=ds.Tables[0].Rows[n]["Lab_Level"].ToString();
             if(ds.Tables[0].Rows[n]["Lab_SetupTime"].ToString()!="")
             {
                 model.Lab_SetupTime=DateTime.Parse(ds.Tables[0].Rows[n]["Lab_SetupTime"].ToString());
             }
             model.Lab_InCharge=ds.Tables[0].Rows[n]["Lab_InCharge"].ToString();
             if(ds.Tables[0].Rows[n]["Lab_ProjectNum"].ToString()!="")
             {
                 model.Lab_ProjectNum=int.Parse(ds.Tables[0].Rows[n]["Lab_ProjectNum"].ToString());
             }
             model.Lab_Phone=ds.Tables[0].Rows[n]["Lab_Phone"].ToString();
             model.Lab_State=ds.Tables[0].Rows[n]["Lab_State"].ToString();
             model.Lab_Curriculum=ds.Tables[0].Rows[n]["Lab_Curriculum"].ToString();
             if(ds.Tables[0].Rows[n]["Lab_Summary"].ToString()!="")
             {
                 model.Lab_Summary=int.Parse(ds.Tables[0].Rows[n]["Lab_Summary"].ToString());
             }
             model.Lab_Investment=ds.Tables[0].Rows[n]["Lab_Investment"].ToString();
             model.Lab_Type=ds.Tables[0].Rows[n]["Lab_Type"].ToString();
             model.Lab_Disciplines=ds.Tables[0].Rows[n]["Lab_Disciplines"].ToString();
             model.Lab_AwardLevel=ds.Tables[0].Rows[n]["Lab_AwardLevel"].ToString();
             if(ds.Tables[0].Rows[n]["Lab_StAwardNum"].ToString()!="")
             {
                 model.Lab_StAwardNum=int.Parse(ds.Tables[0].Rows[n]["Lab_StAwardNum"].ToString());
             }
             model.Lab_EnglishName=ds.Tables[0].Rows[n]["Lab_EnglishName"].ToString();
             if(ds.Tables[0].Rows[n]["Lab_ParentID"].ToString()!="")
             {
                 model.Lab_ParentID=int.Parse(ds.Tables[0].Rows[n]["Lab_ParentID"].ToString());
             }
             model.Lab_ApprovalCode=ds.Tables[0].Rows[n]["Lab_ApprovalCode"].ToString();
             model.Lab_Professional=ds.Tables[0].Rows[n]["Lab_Professional"].ToString();
             model.Lab_Statement=ds.Tables[0].Rows[n]["Lab_Statement"].ToString();
             modelList.Add(model);
         }
     }
     return modelList;
 }