Exemplo n.º 1
0
        public bool AddNewVersionOfDocumentItem(int documentId, Guid originalItemId, string description, Stream content, string mimeType, string name, DocumentItemCategory uploadMode)
        {
            IItemStorage storage = ItemStorageFactory.Create();
            Guid         itemId  = storage.Save(content);
            Database     db      = DatabaseFactory.CreateDatabase();

            try
            {
                db.ExecuteNonQuery("[Dokumenty].dodajNowaWersjeElementuDokumentu", documentId, itemId, originalItemId, description, mimeType, name, uploadMode);
                return(true);
            }
            catch
            {
                storage.Delete(itemId);
                return(false);
            }
        }
Exemplo n.º 2
0
        public bool AddNewDocumentItem(int documentId, string originalName, string description, Stream content, string mimeType, ref Guid itemGuid, DocumentItemCategory uploadMode)
        {
            IItemStorage storage = ItemStorageFactory.Create();
            Guid         itemId  = storage.Save(content);

            Database db        = DatabaseFactory.CreateDatabase();
            bool     browsable = (mimeType == "image/tiff");

            try
            {
                object res = db.ExecuteScalar("[Dokumenty].[dodajNowyElementDokumentu]", documentId, itemId, originalName, description, mimeType, false, browsable, uploadMode);
                itemGuid = res != null ? (Guid)res : Guid.Empty;
                return(true);
            }
            catch
            {
                storage.Delete(itemId);
                return(false);
            }
        }