示例#1
0
        internal bool UploadFile(string sfile, out string EncryptedFileName)
        {
            FTPTransfer FT = new FTPTransfer();
            OCL.Attachments AS = new Attachments();
            try
            {
                FT.ConnectToOysterServer(ServerAddress);
                //FT.ConnectToOysterServer("ome-prototype");
            }
            catch(Exception Err)
            {
                throw new Exception(Err.Message);
            }

            try
            {
                bool bResult = FT.UploadFile(sfile, out EncryptedFileName);
                FT.DisconnectFromOysterServer();
                return bResult;
            }
            catch(Exception Err)
            {
                throw new Exception(Err.Message);
            }
        }
示例#2
0
 /// <summary>
 /// Uploads files to the Oyster System.		/// 
 /// </summary>
 /// <param name="sourcefiles"></param>
 /// <param name="ShowProgress"></param>
 /// <param name="EncryptFileNames"></param>
 /// <returns>
 /// If EncryptFileNames is true then all files will be given GUID Names on the 
 /// Oyster Server and the GUID Names will be returned
 /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 /// Otherwise the original file names will be stored on the 
 /// Oyster Server and the original file names will be returned.
 /// </returns>
 internal string[] UploadFiles(string[] sourcefiles,bool ShowProgress,bool EncryptFileNames)
 {
     FTPTransfer FT = new FTPTransfer();
     OCL.Attachments AS = new Attachments();
     try
     {
         FT.ConnectToOysterServer(ServerAddress);
         //FT.ConnectToOysterServer("ome-prototype");
     }
     catch(Exception Err)
     {
         throw new Exception(Err.Message);
     }
     System.IO.FileInfo[] FI = new System.IO.FileInfo[sourcefiles.Length];
     int i = 0;
     foreach(string CFile in sourcefiles)
     {
         FI[i] = new System.IO.FileInfo(CFile);
         i++;
     }
     string[] EncodedFileNames = new string[1];
     try
     {
         EncodedFileNames = FT.UploadFile(FI,ShowProgress,EncryptFileNames);
     }
     catch(Exception Err)
     {
         throw new Exception(Err.Message);
     }
     return EncodedFileNames;
 }
示例#3
0
        internal void GetNoteAttachment(int[] AttachmentIds, string sDestination,bool ShowProgress)
        {
            FTPTransfer FT = new FTPTransfer();
            try
            {
                FT.ConnectToOysterServer(ServerAddress);
                //FT.ConnectToOysterServer("ome-prototype");
            }
            catch(Exception Err)
            {
                throw new Exception(Err.Message);
            }
            string[] sDest = new string[AttachmentIds.Length];
            string[] sStoredNames = new string[AttachmentIds.Length];

            int i = 0;
            foreach(int AttachmentId in AttachmentIds)
            {
                OCL.Attachment A = this.GetAttachment(AttachmentId);
                sDest[i] = sDestination + @"\" + A.mvarOriginalName;
                sStoredNames[i] = A.StoredName;
                i++;
            }

            FT.DownloadFile(sDest,sStoredNames,ShowProgress);
        }
示例#4
0
        internal void RemoveNoteAttachment(int NoteId, int AttachmentId)
        {
            FTPTransfer FT = new FTPTransfer();
            try
            {
                FT.ConnectToOysterServer(ServerAddress);
            }
            catch(Exception Err)
            {
                throw new Exception(Err.Message);
            }
            Attachment FA = GetAttachment(AttachmentId);

            try
            {
                FT.RemoveFile(FA.StoredName);
            }
            catch(Exception Err)
            {
                throw new Exception(Err.Message);
            }
            string sSQL = "DELETE FROM tblAttachments WHERE Id = " + AttachmentId;

            int records = RF.ExecuteCommand(sSQL);
            records = records;
        }
示例#5
0
 internal void GetNoteAttachment(int AttachmentId, string sDestFolder,bool ShowProgress)
 {
     FTPTransfer FT = new FTPTransfer();
     try
     {
         FT.ConnectToOysterServer(ServerAddress);
         //FT.ConnectToOysterServer("ome-prototype");
     }
     catch(Exception Err)
     {
         throw new Exception(Err.Message);
     }
     OCL.Attachment A = this.GetAttachment(AttachmentId);
     string[] sDestination = new string[1];
     sDestination[0] = sDestFolder + @"\" + A.mvarOriginalName;
     string[] sOriginal = new string[1];
     sOriginal[0] = A.mvarStoredName;
     FT.DownloadFile(sDestination,sOriginal,ShowProgress);
 }
示例#6
0
 internal long GetActualFileSizeOnDisk(string FileName)
 {
     FTPTransfer FT = new FTPTransfer();
     FT.ConnectToOysterServer(ServerAddress);
     long FileSize = FT.GetFileLength(FileName);
     FT.DisconnectFromOysterServer();
     return FileSize;
 }
示例#7
0
        internal void DownloadRecordingSession(User AccessingUser,RecordingSessions ARS, string sDestination,bool IncludeAttachments, bool ShowProgress)
        {
            FTPTransfer FT = new FTPTransfer();
            try
            {
                FT.ConnectToOysterServer(ServerAddress);
                //FT.ConnectToOysterServer("ome-prototype");
            }
            catch(Exception Err)
            {
                throw new Exception(Err.Message);
            }
            int NumberOfDownloadingFiles = 0;
            foreach(RecordingSession RS in ARS)
            {
                foreach(Recording R in RS.CurrentRecordings(AccessingUser))
                {
                    string peek = R.Description;
                    NumberOfDownloadingFiles++;
                }

                if(IncludeAttachments)
                {
                    foreach(Note N in RS.AllVisibleNotes(AccessingUser))
                    {
                        foreach(Attachment A in N.FileAttachments)
                        {
                            string peek = A.mvarStoredName;
                            NumberOfDownloadingFiles++;
                        }
                    }
                }
            }
            string[] sDest = new string[NumberOfDownloadingFiles];
            string[] sStoredNames = new string[NumberOfDownloadingFiles];

            int i = 0;
            foreach(RecordingSession RS in ARS)
            {
                foreach(Recording R in RS.CurrentRecordings(AccessingUser))
                {

                    string safeName = RenameFile(RS.Description + "_" + R.DisplayName,".wmv",sDestination);
                    sDest[i] = sDestination + @"\" + safeName;
            //					sDest[i] = sDestination + @"\" + R.DisplayName + ".wmv";
                    sStoredNames[i] = R.Description;
                    i++;
                }
                if(IncludeAttachments)
                {
                    foreach(Note N in RS.AllVisibleNotes(AccessingUser))
                    {
                        foreach(Attachment A in N.FileAttachments)
                        {
                            sDest[i] = sDestination + @"\" + A.StoredName;
                            sStoredNames[i] = A.StoredName;
                            i++;
                        }
                    }
                }
            }
            FT.DownloadFile(sDest,sStoredNames,ShowProgress);
        }
示例#8
0
        internal bool DeleteSession(OCL.User AccessingUser,OCL.RecordingSession RS)
        {
            if(!RS.CanDeleteSession(AccessingUser))
            {
                return false;
            }
            try
            {
                string sSQL = "SELECT tblAttachments.StoredName FROM tblAttachments left outer join tblNotes ON tblNotes.Id = tblAttachments.NoteId" +
                    " left outer join tblSession ON tblNotes.SessionId = tblSession.Id WHERE tblSession.Id = " + RS.ID;

                DataSet DS = RF.GetDataSet(sSQL);
                FTPTransfer FT = new FTPTransfer();
                try
                {
                    FT.ConnectToOysterServer(ServerAddress);
                    //FT.ConnectToOysterServer("ome-prototype");
                }
                catch(Exception Err)
                {
                    throw new Exception(Err.Message);
                }
                if(DS.Tables[0].Rows.Count > 0)
                {
                    foreach(DataRow r in DS.Tables[0].Rows)
                    {
                        FT.RemoveFile(Convert.ToString(r[0]));
                    }
                }
                sSQL = "DELETE FROM tblAttachments FROM tblSession,tblNotes WHERE tblNotes.SessionId = tblSession.Id " +
                    "AND tblAttachments.NoteId = tblNotes.Id AND tblSession.Id = " + RS.ID;
                int numrecs = RF.ExecuteCommandNonQuery(sSQL);

                //Remove Recordings
                sSQL = "SELECT tblRecording.Name FROM tblRecording WHERE SessionId = " + RS.ID;
                DS = RF.GetDataSet(sSQL);
                if(DS.Tables[0].Rows.Count > 0)
                {
                    foreach(DataRow r in DS.Tables[0].Rows)
                    {
                        FT.RemoveFile(Convert.ToString(r[0]));
                    }
                }

                //DELETE EVERYTHING!!!
                sSQL = "DELETE FROM tblNotes WHERE tblNotes.SessionId = " + RS.mvarID +
                    "; DELETE FROM tblRecording WHERE tblRecording.SessionId = " + RS.mvarID +
                    "; DELETE FROM tblSession WHERE tblSession.Id = " + RS.mvarID;

                numrecs = RF.ExecuteCommandNonQuery(sSQL);

                if(numrecs > 0)
                    return true;
                else
                    return false;
            }
            catch(Exception Err)
            {
                throw new Exception(Err.Message);
            }
        }
示例#9
0
        internal bool DeleteRecording(OCL.User AccessingUser,OCL.Recording R)
        {
            if(!R.CanDelete(AccessingUser))
            {
                return false;
            }
            try
            {
                FTPTransfer FT = new FTPTransfer();
                try
                {
                    FT.ConnectToOysterServer(ServerAddress);
                    //FT.ConnectToOysterServer("ome-prototype");
                }
                catch(Exception Err)
                {
                    throw new Exception(Err.Message);
                }
                FT.RemoveFile(R.Description);

                string sSQL = "DELETE FROM tblRecording WHERE ID = " + R.ID;
                int numrecs = RF.ExecuteCommandNonQuery(sSQL);
                if(numrecs > 0)
                    return true;
                else
                    return false;
            }
            catch(Exception Err)
            {
                throw new Exception(Err.Message);
            }
        }