protected void addBtn_Click(object sender, EventArgs e)
 {
     string classTypeStr = Tools.safeUserInput(classTypeTB.Text.Trim().ToString());
     if (classTypeStr.Length < 1)
     {
         MessageBox.Show(this, "课程类别不能为空!");
         return;
     }
     classtype ClassType = new classtype();
     ClassType.name = classTypeStr;
     classtypeBLL ClassTypeBLL = new classtypeBLL();
     try
     {
         ClassTypeBLL.Add(ClassType);
     }
     catch
     {
         MessageBox.Show(this, "添加失败!");
         return;
     }
     finally
     {
     }
     MessageBox.Show(this, "添加成功!");
     GridView1.DataBind();
 }
 /// <summary>
 /// 获得数据列表
 /// </summary>
 public List<GS.Model.classtype> DataTableToList(DataTable dt)
 {
     List<GS.Model.classtype> modelList = new List<GS.Model.classtype>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         GS.Model.classtype model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new GS.Model.classtype();
             if(dt.Rows[n]["id"]!=null && dt.Rows[n]["id"].ToString()!="")
             {
             model.id=Convert.ToInt32(dt.Rows[n]["id"].ToString());
             }
             if(dt.Rows[n]["name"]!=null && dt.Rows[n]["name"].ToString()!="")
             {
             model.name=dt.Rows[n]["name"].ToString();
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }