public ActionResult UploadFile(string completeTask, FormCollection values, HttpPostedFileBase workflowFile) { // Custom computation var oldOid = GetDocumentOid(values["TaskOid"]); if (completeTask == DEPLOY) { string msg = string.Empty; CopyFile(workflowFile, values["TaskParameterSketchWorkflowPath"], ref msg); var workflowFullFileName = GetFullPath(workflowFile, values["TaskParameterSketchWorkflowPath"]); var newOid = DocsDocument.UploadDocument(new DocumentInfo { Owner = User.Identity.Name, DocumentName = Path.GetFileName(workflowFullFileName), Description = "Sketch Workflow", OidDocument = Guid.Parse(oldOid), Path = "/SketchWorkFlows/" }, GetFullPath(workflowFile, values["TaskParameterSketchWorkflowPath"]), DocumentUploadMode.Overwrite ); TasksService.AddWorkflow(new AddWorkflowRequest { WorkflowCode = values["TaskParameterSketchWorkflowCode"].ToString(), ServiceUrl = values["TaskParameterSketchWorkflowUrl"].ToString() + Path.GetFileName(workflowFile.FileName), BindingConfiguration = "BasicHttpBinding_FlowTasks" }); TasksService.SketchWorkflow(new SketchWorkflowRequest { Name = values["TaskParameterSketchWorkflowCode"].ToString(), ChangedBy = User.Identity.Name, Status = SketchStatusType.DeployedProd, XamlxOid = newOid.ToString() }); } else if (completeTask == SEND_BACK) { TasksService.SketchWorkflow(new SketchWorkflowRequest { Name = values["TaskParameterSketchWorkflowCode"].ToString(), ChangedBy = User.Identity.Name, Status = SketchStatusType.SentToSketch, XamlxOid = oldOid }); } // Exit from this area and go back to main control return(RedirectFromArea(completeTask, values)); }
public HttpResponseMessage Save(string fname, [FromBody] string content) { try { //return new HttpResponseMessage(HttpStatusCode.Created); content = content.Replace("\\n", "
").Replace("< ", "<").Replace(" >", ">"); var newOid = DocsDocument.UploadDocument(new DocumentInfo { Owner = User.Identity.Name, DocumentName = fname + ".xamlx", Description = "Sketch Workflow", Path = "/SketchWorkFlows/" }, Encoding.ASCII.GetBytes(content), DocumentUploadMode.Overwrite ); var sketches = TasksService.GetSketchForFilter(new GetSketchForFilterRequest { Name = fname, Statuses = new[] { SketchStatusType.SentToSketch } }); SketchStatusType sketchStatus = sketches.Sketches.Count() > 0 ? SketchStatusType.SentToSketch : SketchStatusType.Saved; TasksService.SketchWorkflow(new SketchWorkflowRequest { Name = fname, ChangedBy = User.Identity.Name, Status = sketchStatus, XamlxOid = newOid.ToString() }); return(new HttpResponseMessage(HttpStatusCode.Created)); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex)); } }
[HttpPost] // public ActionResult SaveWorkflow(string fname, string content) { if (ModelState.IsValid) { content = content.Replace("\\n", "
").Replace("< ", "<").Replace(" >", ">"); var newOid = DocsDocument.UploadDocument(new DocumentInfo { Owner = User.Identity.Name, DocumentName = fname + ".xamlx", Description = "Sketch Workflow", Path = "/SketchWorkFlows/" }, Encoding.ASCII.GetBytes(content), DocumentUploadMode.Overwrite ); var sketches = TasksService.GetSketchForFilter(new GetSketchForFilterRequest { Name = fname, Statuses = new[] { SketchStatusType.SentToSketch } }); SketchStatusType sketchStatus = sketches.Sketches.Count() > 0 ? SketchStatusType.SentToSketch : SketchStatusType.Saved; TasksService.SketchWorkflow(new SketchWorkflowRequest { Name = fname, ChangedBy = User.Identity.Name, Status = sketchStatus, XamlxOid = newOid.ToString() }); return(Json("WorkFlow Saved!")); } return(Json("Error")); }