Exemple #1
0
        public Stream getBlob(string jctnodepropid, string nodeid, int blobdataid, string usenodetypeasplaceholder, string uid, string date)
        {
            BlobDataReturn ret = new BlobDataReturn();

            BlobDataParams blobDataParams = new BlobDataParams();

            blobDataParams.appPath                  = _Context.Request.PhysicalApplicationPath;
            blobDataParams.propid                   = jctnodepropid;
            blobDataParams.nodeid                   = nodeid;
            blobDataParams.Blob.BlobDataId          = blobdataid;
            blobDataParams.usenodetypeasplaceholder = usenodetypeasplaceholder.ToString();
            blobDataParams.date = date;

            var SvcDriver = new CswWebSvcDriver <BlobDataReturn, BlobDataParams>(
                CswWebSvcResourceInitializer: new CswWebSvcResourceInitializerNbt(_Context, null),
                ReturnObj: ret,
                WebSvcMethodPtr: CswNbtWebServiceBinaryData.getBlob,
                ParamObj: blobDataParams
                );

            SvcDriver.run();


            MemoryStream mem     = new MemoryStream();
            BinaryWriter BWriter = new BinaryWriter(mem);

            BWriter.Write(ret.Data.data);
            mem.Position = 0;

            WebOperationContext.Current.OutgoingResponse.Headers.Add("Content-Disposition", "attachment;filename=\"" + ret.Data.Blob.FileName + "\";");
            WebOperationContext.Current.OutgoingResponse.Headers.Add(HttpResponseHeader.ContentType, ret.Data.Blob.ContentType);

            return(mem);
        }
Exemple #2
0
        public BlobDataReturn SaveFile(string propid, int blobdataid, string caption)
        {
            BlobDataReturn ret = new BlobDataReturn();

            if (_Context.Request.Files.Count > 0)
            {
                BlobDataParams blobDataParams = new BlobDataParams();
                blobDataParams.postedFile = _Context.Request.Files[0];
                blobDataParams.propid     = propid;

                blobDataParams.Blob.BlobDataId = blobdataid;
                blobDataParams.Blob.Caption    = caption;

                var SvcDriver = new CswWebSvcDriver <BlobDataReturn, BlobDataParams>(
                    CswWebSvcResourceInitializer: new CswWebSvcResourceInitializerNbt(_Context, null),
                    ReturnObj: ret,
                    WebSvcMethodPtr: CswNbtWebServiceBinaryData.saveFile,
                    ParamObj: blobDataParams
                    );

                SvcDriver.run();
            }

            return(ret);
        }
Exemple #3
0
        public BlobDataReturn clearBlob(BlobDataParams Request)
        {
            BlobDataReturn ret = new BlobDataReturn();

            var SvcDriver = new CswWebSvcDriver <BlobDataReturn, BlobDataParams>(
                CswWebSvcResourceInitializer: new CswWebSvcResourceInitializerNbt(_Context, null),
                ReturnObj: ret,
                WebSvcMethodPtr: CswNbtWebServiceBinaryData.clearBlob,
                ParamObj: Request
                );

            SvcDriver.run();

            return(ret);
        }
Exemple #4
0
        public BlobDataReturn getText()
        {
            BlobDataReturn ret = new BlobDataReturn();

            if (_Context.Request.Files.Count > 0)
            {
                BlobDataParams req = new BlobDataParams()
                {
                    postedFile = _Context.Request.Files[0]
                };

                var SvcDriver = new CswWebSvcDriver <BlobDataReturn, BlobDataParams>(
                    CswWebSvcResourceInitializer: new CswWebSvcResourceInitializerNbt(_Context, null),
                    ReturnObj: ret,
                    WebSvcMethodPtr: CswNbtWebServiceBinaryData.getText,
                    ParamObj: req
                    );

                SvcDriver.run();
            }

            return(ret);
        }