public void DeleteFileByFileID(MFile objfiles) { StringBuilder sb = new StringBuilder(); sb.Append("delete from tb_file where fileID=@FileID"); OleDbParameter[] param = { OleDbHelper.GetParameter("@FileID",OleDbType.Integer,4,"fileID",objfiles.ID) }; OleDbHelper.ExecuteSql(sb.ToString(), param); }
public DataTable SelectAllFilesByExamine(MFile objfiles) { StringBuilder sb = new StringBuilder(); sb.Append("select * from tb_file where examine=@Examine order by fileTime desc"); OleDbParameter[] param = { OleDbHelper.GetParameter("@Examine",OleDbType.VarWChar,10,"examine",objfiles.Examine) }; DataTable dt = OleDbHelper.ExecuteDt(sb.ToString(), param); return dt; }
public DataTable SelectAllFilesByAccepter(MFile objfiles) { StringBuilder sb = new StringBuilder(); sb.Append("select * from tb_file where fileAccepter=@FileAccepter order by fileTime desc"); OleDbParameter[] param = { OleDbHelper.GetParameter("@FileAccepter",OleDbType.VarWChar,20,"fileAccepter",objfiles.FileAccepter) }; DataTable dt = OleDbHelper.ExecuteDt(sb.ToString(), param); return dt; }
public DataTable SelectAllFilesByExamineAndAccepter(MFile objfiles) { StringBuilder sb = new StringBuilder(); sb.Append("select * from tb_file where examine=@Examine and fileAccepter=@FileAccepter order by fileTime desc"); SqlParameter[] param = { SQLDbHelper.GetParameter("@Examine",SqlDbType.VarChar,10,"examine",objfiles.Examine), SQLDbHelper.GetParameter("@FileAccepter",SqlDbType.VarChar,20,"fileAccepter",objfiles.FileAccepter) }; DataTable dt = SQLDbHelper.ExecuteDt(sb.ToString(), param); return dt; }
/// <summary> /// 获取全部未接收文件信息自动生成或更新XML文件 /// </summary> public void SelectNotReceivedFilesUpdXml() { DataTable dt = new DataTable(); dt.TableName = "File"; MFile objfiles = new MFile(); objfiles.Examine = "未接收"; dt = files.SelectAllFilesByExamine(objfiles); //实例化一个FileStream对象 FileStream objFs = new FileStream(HttpContext.Current.Server.MapPath("~/Xml/FileInfoXml/NotReceivedFileInfo.xml"), FileMode.Create, FileAccess.Write); DataSet ds = new DataSet(); ds.Tables.Add(dt); //将获取后的数据自动生成或更新xml文件 ds.WriteXml(objFs); //关闭新建对象 objFs.Close(); }
public bool InsertIntoFile(MFile objfiles) { StringBuilder sb = new StringBuilder(); sb.Append("INSERT INTO tb_file (fileSender, fileAccepter, fileTitle, fileTime, fileContent, path, examine, fileName) VALUES(@FileSender,@FileAccepter,@FileTitle,@FileTime,@FileContent,@FilePath,@FileExamine,@FileName)"); OleDbParameter[] param = { OleDbHelper.GetParameter("@FileSender",OleDbType.VarWChar,20,"fileSender",objfiles.FileSender), OleDbHelper.GetParameter("@FileAccepter",OleDbType.VarWChar,20,"fileAccepter",objfiles.FileAccepter), OleDbHelper.GetParameter("@FileTitle",OleDbType.VarWChar,50,"fileTitle",objfiles.FileTitle), OleDbHelper.GetParameter("@FileTime",OleDbType.Date,"fileTime",objfiles.FileTime), OleDbHelper.GetParameter("@FileContent",OleDbType.LongVarWChar,"fileContent",objfiles.FileContent), OleDbHelper.GetParameter("@FilePath",OleDbType.VarWChar,100,"path",objfiles.Path), OleDbHelper.GetParameter("@FileExamine",OleDbType.VarWChar,10,"examine",objfiles.Examine), OleDbHelper.GetParameter("@FileName",OleDbType.VarWChar,50,"fileName",objfiles.FileName) }; bool is_succeed = OleDbHelper.ExecuteSql(sb.ToString(), param); if (is_succeed) return true; else return false; }
public void UpdateFileExaminByFileID(int fileid) { MFile objfiles = new MFile(); objfiles.ID = fileid; objfiles.Examine = "已接收"; file files = new file(); files.UpdateFileExaminByFileID(objfiles); //files.SelectAllFilesInfoUpdXml(); //将NotReceivedFileInfo.xml的fileID节点examine状态改变为"已接收",插入到ReceivedFileInfo.xml //然后将将NotReceivedFileInfo.xml的该节点删除 XmlDocument xmlDocNotRec = new XmlDocument(); xmlDocNotRec.Load(Server.MapPath("~/Xml/FileInfoXml/NotReceivedFileInfo.xml")); XmlNode node1 = xmlDocNotRec.SelectSingleNode("/NewDataSet/Table1[fileID/text()='" + fileid + "']"); node1.ChildNodes[7].InnerText = "已接收"; string strfileID = node1.ChildNodes[0].InnerText; string strfileSender = node1.ChildNodes[1].InnerText; string strfileAccepter = node1.ChildNodes[2].InnerText; string strfileTitle = node1.ChildNodes[3].InnerText; string strfileTime = node1.ChildNodes[4].InnerText; string strfileContent = node1.ChildNodes[5].InnerText; string strpath = node1.ChildNodes[6].InnerText; string strexamine = node1.ChildNodes[7].InnerText; string strfileName = node1.ChildNodes[8].InnerText; node1.ParentNode.RemoveChild(node1); xmlDocNotRec.Save(Server.MapPath("~/Xml/FileInfoXml/NotReceivedFileInfo.xml")); //<Table1> // <fileID>5</fileID> // <fileSender>王春城</fileSender> // <fileAccepter>王春城</fileAccepter> // <fileTitle>项目总结</fileTitle> // <fileTime>2015-06-16T00:00:00+08:00</fileTime> // <fileContent>项目总结项目总结</fileContent> // <path>~/file/项目总结.doc</path> // <examine>已接收</examine> // <fileName>项目总结.doc</fileName> //</Table1> XmlDocument xmlDocRec = new XmlDocument(); xmlDocRec.Load(Server.MapPath("~/Xml/FileInfoXml/ReceivedFileInfo.xml")); XmlNode node2 = xmlDocRec.SelectSingleNode("/NewDataSet"); XmlElement Table1 = xmlDocRec.CreateElement("Table1"); XmlElement fileID = xmlDocRec.CreateElement("fileID"); fileID.InnerText = strfileID; XmlElement fileSender = xmlDocRec.CreateElement("fileSender"); fileSender.InnerText = strfileSender; XmlElement fileAccepter = xmlDocRec.CreateElement("fileAccepter"); fileAccepter.InnerText = strfileAccepter; XmlElement fileTitle = xmlDocRec.CreateElement("fileTitle"); fileTitle.InnerText = strfileTitle; XmlElement fileTime = xmlDocRec.CreateElement("fileTime"); fileTime.InnerText = strfileTime; XmlElement fileContent = xmlDocRec.CreateElement("fileContent"); fileContent.InnerText = strfileContent; XmlElement path = xmlDocRec.CreateElement("path"); path.InnerText = strpath; XmlElement examine = xmlDocRec.CreateElement("examine"); examine.InnerText = strexamine; XmlElement fileName = xmlDocRec.CreateElement("fileName"); fileName.InnerText = strfileName; Table1.AppendChild(fileID); Table1.AppendChild(fileSender); Table1.AppendChild(fileAccepter); Table1.AppendChild(fileTitle); Table1.AppendChild(fileTime); Table1.AppendChild(fileContent); Table1.AppendChild(path); Table1.AppendChild(examine); Table1.AppendChild(fileName); node2.InsertBefore(Table1,node2.FirstChild); //node2.AppendChild(Table1); xmlDocRec.Save(Server.MapPath("~/Xml/FileInfoXml/ReceivedFileInfo.xml")); //xmlDocRec.DocumentElement.AppendChild(node); }
public DataTable SelectFilesByFileID(MFile objfiles) { StringBuilder sb = new StringBuilder(); sb.Append("select * from tb_file where fileID=@FileID"); OleDbParameter[] param = { OleDbHelper.GetParameter("@FileID",OleDbType.Integer,4,"fileID",objfiles.ID) }; DataTable dt = OleDbHelper.ExecuteDt(sb.ToString(), param); return dt; }
public void UpdateFileExaminByFileID(MFile objfiles) { StringBuilder sb = new StringBuilder(); sb.Append("UPDATE tb_file SET examine=@Examine WHERE fileID=@FileID"); OleDbParameter[] param = { OleDbHelper.GetParameter("@Examine",OleDbType.VarWChar,10,"examine",objfiles.Examine), OleDbHelper.GetParameter("@FileID",OleDbType.Integer,4,"fileID",objfiles.ID) }; OleDbHelper.ExecuteSql(sb.ToString(), param); }
public DataTable SelectFilesByFileID(MFile objfiles) { return files.SelectFilesByFileID(objfiles); }
public DataTable SelectAllFilesByExamineAndAccepter(MFile objfiles) { return files.SelectAllFilesByExamineAndAccepter(objfiles); }
public DataTable SelectAllFilesByExamine(MFile objfiles) { return files.SelectAllFilesByExamine(objfiles); }
public bool InsertIntoFile(MFile objfiles) { return files.InsertIntoFile(objfiles); }
public void DeleteFileByFileID(MFile objfiles) { files.DeleteFileByFileID(objfiles); }
public void UpdateFileExaminByFileID(MFile objfiles) { files.UpdateFileExaminByFileID(objfiles); }