Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
 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);
     }
 }
Ejemplo n.º 3
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}");
 }
Ejemplo n.º 4
0
 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}'"));
 }
Ejemplo n.º 5
0
 public static int UpdateDocumentRoleDB(string role, string documentId)
 {
     WhiteBears.DatabaseHelper dh = new WhiteBears.DatabaseHelper();
     return(dh.RunInsertQuery($"INSERT INTO DocumentRole VALUES('{role}','{documentId}', 1)"));
 }
Ejemplo n.º 6
0
 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}')"));
 }
Ejemplo n.º 7
0
 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}'"));
 }
Ejemplo n.º 8
0
 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}')"));
 }