public Stream ExportProcessDescriptors(WfClientExportProcessDescriptorParams exportParams, string[] processKeys)
        {
            OperationContext.Current.FillContextToOguServiceContext();

            WfExportProcessDescriptorParams serverExportParams = null;

            WfClientExportProcessDescriptorParamsConverter.Instance.ClientToServer(exportParams, ref serverExportParams);

            MemoryStream stream = new MemoryStream();

            WfProcessExporter.ExportProcessDescriptors(serverExportParams, stream, processKeys);

            stream.Seek(0, SeekOrigin.Begin);

            return(stream);
        }
Пример #2
0
        public void ImportProcessTemplateExecutorTest()
        {
            IWfProcessDescriptor processDesp = CreateTestProcessDescriptor();

            WfSaveTemplateExecutor createExecutor = new WfSaveTemplateExecutor(processDesp);

            createExecutor.Execute();

            MemoryStream stream = new MemoryStream();

            WfProcessExporter.ExportProcessDescriptors(new WfExportProcessDescriptorParams(), stream, processDesp.Key);

            stream.Seek(0, SeekOrigin.Begin);

            WfImportTemplateExecutor importTemplateExecutor = new WfImportTemplateExecutor(stream);

            importTemplateExecutor.Execute();

            Assert.AreEqual(1, importTemplateExecutor.ImportedProcesses.Count);
            Assert.AreEqual(processDesp.Key, importTemplateExecutor.ImportedProcesses[0].Key);
        }
Пример #3
0
        //public void ProcessRequest(HttpContext context)
        //{
        //    var roleMode = context.Request.QueryString["roleAsPerson"] == "true" ? true : false;
        //    string[] keys = context.Request["wfProcessKeys"].Split(',');

        //    var bytes = new ZipPackageExporter(keys, roleMode).Export();

        //    context.Response.Clear();
        //    //content type 搞成 xml 为了不弹空页
        //    context.Response.ContentType = MediaTypeNames.Text.Xml;
        //    if (keys.Count() > 1)
        //        context.Response.AppendHeader("content-disposition", string.Format("attachment;fileName= ProcessDescription{0}.zip", DateTime.Now.ToString("yyyy-MM-dd")));
        //    else
        //        context.Response.AppendHeader("content-disposition", string.Format("attachment;fileName={0}.zip", HttpUtility.UrlEncode(keys[0])));

        //    context.Response.BinaryWrite(bytes);
        //    context.Response.End();
        //}

        public void ProcessRequest(HttpContext context)
        {
            var roleMode = context.Request.QueryString["roleAsPerson"] == "true" ? true : false;

            string[] keys = context.Request["wfProcessKeys"].Split(',');

            context.Response.Clear();
            //content type 搞成 xml 为了不弹空页
            context.Response.ContentType = "application/zip";

            if (keys.Count() > 1)
            {
                context.Response.AppendHeader("content-disposition", string.Format("attachment;fileName= ProcessDescription{0}.zip", DateTime.Now.ToString("yyyy-MM-dd")));
            }
            else
            {
                context.Response.AppendHeader("content-disposition", string.Format("attachment;fileName={0}.zip", HttpUtility.UrlEncode(keys[0])));
            }

            byte[] bytes = WfProcessExporter.ExportProcessDescriptors(new WfExportProcessDescriptorParams(roleMode), keys);
            context.Response.BinaryWrite(bytes);

            context.Response.End();
        }