///<summary> ///根据--文献主题-得到文献信息 ///</param name=""></param> ///<returns></returns> public DataSet FindDocumentatByTopic(DocumentatManage documentatmanage, string tbName) { SqlParameter[] prams = { data.MakeInParam("@topic", SqlDbType.VarChar, 100, "%" + documentatmanage.Topic + "%"), }; return(data.RunProcReturn("select * from tb_documentat where topic like @topic", prams, tbName)); }
///<summary> ///根据--文献关键词--得到文献信息 ///</param name=""></param> ///<returns></returns> public DataSet FindDocumentatByKeyWord(DocumentatManage documentatmanage, string tbName) { SqlParameter[] prams = { data.MakeInParam("@keyword", SqlDbType.VarChar, 100, "%" + documentatmanage.KeyWord + "%"), }; return(data.RunProcReturn("select * from tb_documentat where keyword like @keyword", prams, tbName)); }
///<summary> ///根据--文献作者-得到文献信息 ///</param name=""></param> ///<returns></returns> public DataSet FindDocumentatByAuthor(DocumentatManage documentatmanage, string tbName) { SqlParameter[] prams = { data.MakeInParam("@author", SqlDbType.VarChar, 50, "%" + documentatmanage.Author + "%"), }; return(data.RunProcReturn("select * from tb_documentat where author like @author", prams, tbName)); }
/// <summary> /// 删除--文献信息 /// </summary> /// <param name="documentatmanage"></param> /// <returns></returns> public int DeleteDocumentat(DocumentatManage documentatmanage) { SqlParameter[] prams = { data.MakeInParam("@title", SqlDbType.VarChar, 100, documentatmanage.Title), }; return(data.RunProc("delete from tb_documentat where title=@title", prams)); }
/// <summary> /// 每下载一次文献就将文献的下载次数加一 /// </summary> /// <param name="bookmanage"></param> /// <returns></returns> public int UpdateDownloads(DocumentatManage documentatmanage) { SqlParameter[] prams = { data.MakeInParam("@title", SqlDbType.VarChar, 100, documentatmanage.Title), data.MakeInParam("@downloads", SqlDbType.Int, 8, documentatmanage.Downloads), }; return(data.RunProc("update tb_documentat set downloads=@downloads where title=@title", prams)); }
protected void Page_Load(object sender, EventArgs e) { DocumentatManage documentatmanage = new DocumentatManage(); documentatmanage.Title = Request["title"]; DataSet documentatmanageds = documentatmanage.FindDocumentatByTitle(documentatmanage, "tb_documentat"); if (documentatmanageds.Tables[0].Rows.Count < 0) { Response.Redirect("~/404/404.html"); } string filepath = documentatmanageds.Tables[0].Rows[0][13].ToString(); int filedowns = Convert.ToInt32(documentatmanageds.Tables[0].Rows[0][9].ToString()); documentatmanage.Downloads = filedowns + 1; documentatmanage.UpdateDownloads(documentatmanage); Response.Redirect(filepath); }
///<sumary> ///修改--文献信息 ///</summary> ///<param name=""></param> ///<returns></returns> public int UpdateDocumentat(DocumentatManage documentatmanage) { SqlParameter[] prams = { data.MakeInParam("@title", SqlDbType.VarChar, 100, documentatmanage.Title), data.MakeInParam("@content", SqlDbType.VarChar, 1000, documentatmanage.Content), data.MakeInParam("@keyword", SqlDbType.VarChar, 100, documentatmanage.KeyWord), data.MakeInParam("@author", SqlDbType.VarChar, 50, documentatmanage.Author), data.MakeInParam("@topic", SqlDbType.VarChar, 100, documentatmanage.Topic), data.MakeInParam("@summary", SqlDbType.VarChar, 1000, documentatmanage.Summary), data.MakeInParam("@references", SqlDbType.VarChar, 1000, documentatmanage.References), data.MakeInParam("@source", SqlDbType.VarChar, 50, documentatmanage.source), data.MakeInParam("@type", SqlDbType.VarChar, 50, documentatmanage.Type), data.MakeInParam("@downloads", SqlDbType.Int, 8, documentatmanage.Downloads), data.MakeInParam("@uploadtime", SqlDbType.DateTime, 8, documentatmanage.Uploadtime), data.MakeInParam("@upload", SqlDbType.VarChar, 50, documentatmanage.Upload), data.MakeInParam("@check", SqlDbType.VarChar, 50, documentatmanage.Check), data.MakeInParam("@path", SqlDbType.VarChar, 100, documentatmanage.Path), }; return(data.RunProc("update tb_documentat set title=@title,content=@content,keyword=@keyword,author=@author,topic=@topic,summary=@summary" + ",references=@references,source=@source,type=@type,downloads=@downloads,uploadtime=@uploadtime,upload=@upload,check=@check,path=@path", prams)); }
/// <summary> /// 添加--文献信息 /// </summary> /// <param name="bookmanage"></param> /// <returns></returns> public int AddDocumentat(DocumentatManage documentatmanage) { SqlParameter[] prams = { data.MakeInParam("@title", SqlDbType.VarChar, 100, documentatmanage.Title), data.MakeInParam("@content", SqlDbType.VarChar, 1000, documentatmanage.Content), data.MakeInParam("@keyword", SqlDbType.VarChar, 100, documentatmanage.KeyWord), data.MakeInParam("@author", SqlDbType.VarChar, 50, documentatmanage.Author), data.MakeInParam("@topic", SqlDbType.VarChar, 100, documentatmanage.Topic), data.MakeInParam("@summary", SqlDbType.VarChar, 1000, documentatmanage.Summary), data.MakeInParam("@references", SqlDbType.VarChar, 1000, documentatmanage.References), data.MakeInParam("@source", SqlDbType.VarChar, 50, documentatmanage.source), data.MakeInParam("@type", SqlDbType.VarChar, 50, documentatmanage.Type), data.MakeInParam("@downloads", SqlDbType.Int, 4, documentatmanage.Downloads), data.MakeInParam("@uploadtime", SqlDbType.DateTime, 8, documentatmanage.Uploadtime), data.MakeInParam("@upload", SqlDbType.VarChar, 50, documentatmanage.Upload), data.MakeInParam("@check", SqlDbType.VarChar, 50, documentatmanage.Check), data.MakeInParam("@path", SqlDbType.VarChar, 100, documentatmanage.Path), }; return(data.RunProc("INSERT INTO tb_documentat (title,content,keyword,author,topic,summary,references,source,type,downloads,uploadtime,upload,check,path) " + "VALUES (@title,@content,@keyword,author,@topic,@summary,@references,@source,@type,@downloads,@uploadtime,@upload,@check,@path)", prams)); }