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); } }
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; }
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); } }