예제 #1
0
        internal bool RemoveNote(OCL.User AccessingUser, OCL.Note CurrentNote)
        {
            try
            {

                if(CurrentNote.CanDelete(AccessingUser))
                {
                    //Remove any attached files
                    if(CurrentNote.HasAttachment)
                    {
                        foreach(OCL.Attachment NA in CurrentNote.FileAttachments)
                        {
                            this.RemoveNoteAttachment(CurrentNote.mvarID, NA.ID);
                        }
                    }

                    string sSQL = "DELETE FROM tblNotes WHERE Id = " + CurrentNote.ID;
                    int numrecs = RF.ExecuteCommandNonQuery(sSQL);
                    if(numrecs < 1)
                        throw new Exception("Failed to delete Note " + CurrentNote.ID +
                            " for unknown reason");
                    else
                        return true;
                }
                return false;
            }
            catch(Exception Err)
            {
                throw new ApplicationException(Err.Message);
            }
        }
예제 #2
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);
            }
        }
예제 #3
0
파일: Oyster.cs 프로젝트: CarverLab/Oyster
 public bool DeleteGroup(OCL.Group TargetGroup, OCL.User AccessingUser, out string ErrorString)
 {
     ErrorString = "";
     try
     {
         if(TargetGroup.CanDelete(AccessingUser))
         {
             Functions F = new Functions();
             F.DeleteGroup(TargetGroup,AccessingUser);
             return true;
         }
         else
         {
             ErrorString = "User does not have access to delete group.";
             return false;
         }
     }
     catch(Exception Err)
     {
         ErrorString = Err.Message;
         return false;
     }
 }
예제 #4
0
        internal bool DeleteGroup(OCL.Group TargetGroup,OCL.User AccessingUser)
        {
            try
            {
                if(TargetGroup.CanDelete(AccessingUser))
                {
                    //Delete all references to items in this group
                    string sSQL = "DELETE FROM tblGroupTokens WHERE GroupID = " + TargetGroup.ID;
                    if(this.ExecuteNonQuery(sSQL) == 0)
                        throw new Exception("Unknown error attempting to remove all items from " + TargetGroup.Description);

                    //Just in case nested groups have been implemented. Delete this group from all other group entries.
                    sSQL = "DELETE FROM tblGroupTokens WHERE ObjectID = " + TargetGroup.ID +
                        " AND ObjectTypeId = " + Convert.ToInt32(OysterObjectType.Group).ToString();
                    this.ExecuteNonQuery(sSQL);

                    sSQL = "Delete FROM tblGroup WHERE ID = " + TargetGroup.ID;
                    if(this.ExecuteNonQuery(sSQL) == 0)
                        throw new Exception("Unknown error attempting to remove group " + TargetGroup.Description);
                    return true;
                }
                else
                {
                    throw new Exception("User does not have access to delete group.");
                }
            }
            catch(Exception Err)
            {
                throw new ApplicationException(Err.Message,Err.InnerException);
            }
        }
예제 #5
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="AccessingUser"></param>
 /// <param name="CurrentNote"></param>
 /// <returns></returns>
 public bool RemoveNote(OCL.User AccessingUser, OCL.Note CurrentNote)
 {
     if((AccessingUser.mvarIsSuperUser)||(CurrentNote.CanDelete(AccessingUser)))
     {
         Functions F = new Functions();
         F.RemoveNote(CurrentNote.ID);
         return true;
     }
     else
         return false;
 }