public static string CheckUploadDocumentID(string fileName) { string id; WhiteBears.DatabaseHelper dh = new WhiteBears.DatabaseHelper(); DataRow[] a = dh.RunSelectQuery($"SELECT DocumentId FROM Document WHERE FileName = '{fileName}'"); return(a[0][0].ToString()); }
public static int CheckDocumentVersionDB(string fileName) { WhiteBears.DatabaseHelper dh = new WhiteBears.DatabaseHelper(); DataRow[] a = dh.RunSelectQuery($"SELECT MAX(version) FROM DocumentVersion JOIN Document ON Document.DocumentID = DocumentVersion.DocumentID WHERE FileName ='{fileName}'"); try { return(Convert.ToInt32(a[0][0])); } catch { return(0); } }
public static void ClearDocument(string documentId) { WhiteBears.DatabaseHelper dh = new WhiteBears.DatabaseHelper(); dh.RunDeleteQuery($"DELETE FROM DocumentRole WHERE DocumentId = {documentId}"); dh.RunDeleteQuery($"DELETE FROM Document WHERE DocumentId = {documentId}"); }
public static int DeleteDocumentVersionDB(string documentId, int version) { WhiteBears.DatabaseHelper dh = new WhiteBears.DatabaseHelper(); return(dh.RunDeleteQuery($"DELETE FROM DocumentVersion WHERE DocumentID = {documentId} AND Version = '{version}'")); }
public static int UpdateDocumentRoleDB(string role, string documentId) { WhiteBears.DatabaseHelper dh = new WhiteBears.DatabaseHelper(); return(dh.RunInsertQuery($"INSERT INTO DocumentRole VALUES('{role}','{documentId}', 1)")); }
public static int UpdateDocumentVersionDB(string documentId, int version, string uploaderName) { WhiteBears.DatabaseHelper dh = new WhiteBears.DatabaseHelper(); return(dh.RunInsertQuery($"INSERT INTO DocumentVersion VALUES('{version}','{documentId.ToString()}','{DateTime.Now}','{uploaderName}')")); }
public static int UpdateDocumentDB(string pID, string fileName, string updatedFileName, string uploaderName, string fileExt) { WhiteBears.DatabaseHelper dh = new WhiteBears.DatabaseHelper(); return(dh.RunUpdateQuery($"UPDATE DOCUMENT SET CreationTime='{DateTime.Now}', FileName='{updatedFileName}' WHERE FileName = '{fileName}'")); }
public static int InsertDocumentDB(string pID, string fileName, string uploaderName, string fileExt) { WhiteBears.DatabaseHelper dh = new WhiteBears.DatabaseHelper(); return(dh.RunInsertQuery($"INSERT INTO Document(ProjectID,FileName,Uploader,CreationTime,fileExtension) VALUES('{pID}','{fileName}','{uploaderName}','{DateTime.Now}','{fileExt}')")); }