/// <summary>
 /// 添加新文章类型
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btn_AddType_Click(object sender, EventArgs e)
 {
     //判断输入是否为空
     if (!String.IsNullOrEmpty(txt_NewType.Text))
     {
         using (TypeDAL dal = new TypeDAL ())
         {
             //判断是否存在类型
             if (dal.GetType(txt_NewType.Text)==null)
             {
                 //实例化新类型
                 szosi.ArticleCollectSystem.Entities.Type type
                     = new Entities.Type()
                     {
                         ID = Guid.NewGuid(),
                         Name = txt_NewType.Text.Trim()
                     };
                 //添加新类型
                 if (dal.AddType(type))
                 {
                     typeList.Add(type);
                     BindTypeList();
                     txt_NewType.Text = "";
                     MessageBox.Show("添加成功!");
                 }
                 else
                 {
                     MessageBox.Show("添加失败!");
                 }
             }
             else
             {
                 MessageBox.Show("类型已存在");
             }
         }
     }
     else
     {
         MessageBox.Show("请输入新类型");
     }
 }
 /// <summary>
 /// 绑定类型列表
 /// </summary>
 private void BindTypeList()
 {
     using (TypeDAL dal = new TypeDAL())
     {
         typeList = dal.GetTypeList();
     }
     //两个combobox
     comb_TypeList.DataSource = typeList;
     comb_TypeList.DisplayMember = "Name";
     comb_TypeList.ValueMember = "ID";
 }