//添加一条课程信息
    public bool Add(Bap_Course Bap_Course)
    {
        DatabaseAccess database = new DatabaseAccess();

        String sql = String.Format(@"insert into Bap_Course(Course_Name,Staff_num,Teacher_Name,Department,Hours,Class_Time,Class_Week,Total_Week,Is_Week,Class_Addr,Classes) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}')",
              Bap_Course.Course_Name, Bap_Course.Staff_num, Bap_Course.Teacher_Name, Bap_Course.Department, Bap_Course.Hours,
              Bap_Course.Class_Time, Bap_Course.Class_Week, Bap_Course.Total_Week, Bap_Course.Is_Week, Bap_Course.Class_Addr, Bap_Course.Classes);

        return database.executeUpdate(sql);
    }
 /// <summary>
 /// 插入一条数据到数据库
 /// </summary>
 /// <param name="path">Xpath的对象</param>
 /// <returns></returns>
 public Boolean insert(Xpath path)
 {
     Boolean insert = false;
     DatabaseAccess database = new DatabaseAccess();
     String sql = "insert into xpath(id,websitename,weblanguage,baseurl,cntitle,entitle,unit,types,author,articletype,source,language,journalname,publishtime,levels,recordtype,forbid) values(NewId(),'"
         + path.Websitename + "','" + path.Weblanguage + "','" + path.Baseurl + "','" + path.Cntitle + "','" + path.Entitle + "','" + path.Unit + "','" + path.Types + "','" + path.Author + "','" + path.Articletype + "','" + path.Source + "','" + path.Language + "','" + path.Journalname + "','" + path.Publishtime + "','" + path.Levels + "','" + path.Recordtype + "',0)";
     try {
         insert = database.executeUpdate(sql);
     } catch (Exception e) {
         throw new Exception(e.Message);
     } finally {
         database.close();
     }
     return insert;
 }
 /// <summary>
 /// 更新整个数据的内容
 /// </summary>
 /// <param name="path">xpath的实例</param>
 /// <returns></returns>
 public Boolean update(Xpath path)
 {
     Boolean update = false;
     DatabaseAccess database = new DatabaseAccess();
     string sql = "update xpath set websitename='" + path.Websitename + "',weblanguage='" + path.Weblanguage + "',baseurl='" + path.Baseurl + "',cntitle='" + path.Cntitle + "',entitle='" + path.Entitle + "',unit='" + path.Unit + "',author='" + path.Author + "',types='" + path.Types + "',articletype='" + path.Articletype + "',source='" + path.Source + "',language='" + path.Language + "',journalname='" + path.Journalname + "',publishtime='" + path.Publishtime + "',levels='" + path.Levels + "',recordtype='" + path.Recordtype + "',forbid=" + path.Forbid + " where id='" + path.Id+"'";
     try {
         update = database.executeUpdate(sql);
     } catch (Exception e) {
         throw new Exception(e.Message);
     }
     return update;
 }
 /// <summary>
 /// 更新规则是否启用
 /// </summary>
 /// <param name="ids">id的批量字符串表示形式</param>
 /// <param name="forbid">是否启用1表示启用, 0表示禁止</param>
 /// <returns></returns>
 public Boolean update(string ids,int forbid)
 {
     Boolean update = false;
     DatabaseAccess database = new DatabaseAccess();
     string sql = "update xpath set forbid=" + forbid + " where id in (" + ids + ")";
     try {
         update = database.executeUpdate(sql);
     } catch (Exception e) {
         throw new Exception(e.Message);
     } finally {
         database.close();
     }
     return update;
 }
 /// <summary>
 /// 插入一条新的论文记录到数据库
 /// </summary>
 /// <param name="treatise"></param>
 /// <returns></returns>
 public Boolean insert(Treatise treatise)
 {
     Boolean insert = false;
     DatabaseAccess database = new DatabaseAccess();
     String sql = "insert into treatise (id,articleurl,sourceid,cntitle,entitle,unitname,types,author,articletype,source,language,journalname,publishtime,levels,recordtype) values(NewId(),'"+
        treatise.Articleurl+"','"+treatise.Sourceid+"','"+ treatise.Cntitle + "','" + treatise.Entitle + "','" + treatise.Unitname + "','" + treatise.Types + "','" + treatise.Author + "','" + treatise.Articletype + "','" + treatise.Source + "','" + treatise.Language + "','" + treatise.Journalname + "','" + treatise.Publishtime + "','" + treatise.Levels + "','" + treatise.Recordtype + "')";
     try{
         insert = database.executeUpdate(sql);
     }
     catch (Exception e){
         throw new Exception(e.Message);
     } finally {
         database.close();
     }
     return insert;
 }
    //根据ID保存修改后的课程信息
    public bool SaveById(Bap_Course Bap_Course)
    {
        DatabaseAccess database = new DatabaseAccess();

        String sql = String.Format(@"update Bap_Course set
                        Course_Name='{0}',
                        Staff_num='{1}',
                        Teacher_Name='{2}',
                        Department='{3}',
                        Hours='{4}',
                        Class_Time='{5}',
                        Class_Week='{6}',
                        Total_Week='{7}',
                        Is_Week='{8}',
                        Class_Addr='{9}',
                        Classes='{10}' where id='" + Convert.ToInt32(Bap_Course.Id) + "'",
                                                   Bap_Course.Course_Name,
                                                   Bap_Course.Staff_num,
                                                   Bap_Course.Teacher_Name,
                                                    Bap_Course.Department,
                                                    Bap_Course.Hours,
                                                    Bap_Course.Class_Time,
                                                     Bap_Course.Class_Week,
                                                     Bap_Course.Total_Week,
                                                     Bap_Course.Is_Week,
                                                     Bap_Course.Class_Addr,
                                                     Bap_Course.Classes);

        return database.executeUpdate(sql);
    }