public static bool InsertObjectDocument(int objectID, string objectTypeID, int fileID) { if (fileID <= 0) { throw new ArgumentException("The File ID cannot be equal or less than 0"); } if (objectID <= 0) { throw new ArgumentException("The Object ID cannot be equal or less than 0"); } if (objectTypeID.ToUpper() != GenericObject.ObjectType.Contribuyente.ToString().ToUpper() && objectTypeID.ToUpper() != GenericObject.ObjectType.Inmueble.ToString().ToUpper()) { throw new ArgumentException("The Object Type ID must be Product or Service."); } try { DocumentTableAdapter localAdapter = new DocumentTableAdapter(); localAdapter.InsertObjectDocument(objectID, objectTypeID, fileID); log.Debug("The Document was inserted for the " + objectTypeID.ToUpper() + " with ID " + objectID.ToString()); return(true); } catch (Exception q) { log.Error("An error ocurred trying to insert the Docuemtn for the " + objectTypeID.ToUpper() + " with ID " + objectID.ToString(), q); return(false); } }
public static bool DeleteDocument(int documentID) { if (documentID <= 0) { throw new ArgumentException("The Document ID cannot be equal or less than 0"); } try { DocumentTableAdapter localAdapter = new DocumentTableAdapter(); localAdapter.DeleteDocument(documentID); log.Debug("The Document with ID " + documentID.ToString() + " was deleted."); return(true); } catch (Exception q) { log.Error("An error ocurred trying to delete the Document with ID " + documentID.ToString(), q); return(false); } }