コード例 #1
0
        private void ModifySpecificContent(IFolder node, HttpPostedFile file, string path)
        {
            ContentFacade contentFacade = new ContentFacade();

            contentFacade.Load(path);
            if (contentFacade.CurrentContent != null)
            {
                BinaryField bf = contentFacade.CurrentContent.Fields["Binary"] as BinaryField;
                if (bf != null)
                {
                    BinaryData bd = CreateBinaryData(file);
                    bf.SetData(bd);
                }
            }
            contentFacade.CurrentContent.Save();
        }
コード例 #2
0
        private void CreateSpecificContent(HttpContext context, string contentTypeName, IFolder parentNode, HttpPostedFile postedFile)
        {
            ContentFacade contentFacade = new ContentFacade();

            contentFacade.CreateNew(contentTypeName, ((Node)parentNode));

            if (CheckAllowedContentType(parentNode as GenericContent, contentFacade.CurrentContent.ContentHandler, context))
            {
                // set name
                ShortTextField sf = contentFacade.CurrentContent.Fields["Name"] as ShortTextField;
                var            fn = System.IO.Path.GetFileName(postedFile.FileName);
                sf.SetData(fn);

                // set binary
                BinaryData  b  = CreateBinaryData(postedFile);
                BinaryField bf = contentFacade.CurrentContent.Fields["Binary"] as BinaryField;

                bf.SetData(b);

                contentFacade.CurrentContent.Save();
            }
        }
コード例 #3
0
ファイル: UploadHandler.cs プロジェクト: maxpavlov/FlexNet
        private void CreateSpecificContent(HttpContext context, string contentTypeName, IFolder parentNode, HttpPostedFile postedFile)
        {
            ContentFacade contentFacade = new ContentFacade();
            contentFacade.CreateNew(contentTypeName,((Node)parentNode));

            if (CheckAllowedContentType(parentNode as GenericContent, contentFacade.CurrentContent.ContentHandler, context))
            {
                // set name
                ShortTextField sf = contentFacade.CurrentContent.Fields["Name"] as ShortTextField;
                var fn = System.IO.Path.GetFileName(postedFile.FileName);
                sf.SetData(fn);

                // set binary
                BinaryData b = CreateBinaryData(postedFile);
                BinaryField bf = contentFacade.CurrentContent.Fields["Binary"] as BinaryField;

                bf.SetData(b);

                contentFacade.CurrentContent.Save();
            }
        }
コード例 #4
0
ファイル: UploadHandler.cs プロジェクト: maxpavlov/FlexNet
        private void ModifySpecificContent(IFolder node, HttpPostedFile file, string path)
        {
            ContentFacade contentFacade = new ContentFacade();
            contentFacade.Load(path);
            if (contentFacade.CurrentContent != null)
            {
                BinaryField bf = contentFacade.CurrentContent.Fields["Binary"] as BinaryField;
                if (bf != null)
                {
                    BinaryData bd = CreateBinaryData(file);
                    bf.SetData(bd);
                }
            }
            contentFacade.CurrentContent.Save();

        }