public ActionResult PyScript(Guid id, string report) { var content = DbUtil.Db.ContentOfTypePythonScript(report); if (content == null) { return(Content("no script named " + report)); } if (!content.Contains("BlueToolbarReport")) { return(Content("Missing Call to Query Function 'BlueToolbarReport'")); } if (id == Guid.Empty) { return(Content("Must be run from the BlueToolbar")); } var pe = new PythonEvents(Util.Host); pe.DictionaryAdd("BlueToolbarGuid", id.ToCode()); foreach (var key in Request.QueryString.AllKeys) { pe.DictionaryAdd(key, Request.QueryString[key]); } pe.RunScript(content); return(View(pe)); }
public ActionResult PyScriptForm(string name) { try { var script = FetchPyScriptForm(name); if (!script.HasValue()) { return(Message("no script named " + name)); } var pe = new PythonEvents(Util.Host); foreach (var key in Request.QueryString.AllKeys) { pe.DictionaryAdd(key, Request.QueryString[key]); } pe.Data.pyscript = name; pe.HttpMethod = "get"; pe.RunScript(script); return(View(pe)); } catch (Exception ex) { return(RedirectShowError(ex.Message)); } }
public ActionResult PyScriptForm() { try { var pe = new PythonEvents(Util.Host); foreach (var key in Request.Form.AllKeys) { pe.DictionaryAdd(key, Request.Form[key]); } pe.HttpMethod = "post"; var script = FetchPyScriptForm(pe.Data.pyscript); return(Content(pe.RunScript(script))); } catch (Exception ex) { return(RedirectShowError(ex.Message)); } }
public ActionResult PyScript(string name, string p1, string p2, string v1, string v2) { try { var script = DbUtil.Db.ContentOfTypePythonScript(name); if (!script.HasValue()) { return(Message("no script named " + name)); } if (script.Contains("model.Form")) { return(Redirect("/PyScriptForm/" + name)); } script = script.Replace("@P1", p1 ?? "NULL") .Replace("@P2", p2 ?? "NULL") .Replace("V1", v1 ?? "None") .Replace("V2", v2 ?? "None"); if (script.Contains("@qtagid")) { var id = DbUtil.Db.FetchLastQuery().Id; var tag = DbUtil.Db.PopulateSpecialTag(id, DbUtil.TagTypeId_Query); script = script.Replace("@qtagid", tag.Id.ToString()); } var pe = new PythonEvents(Util.Host); foreach (var key in Request.QueryString.AllKeys) { pe.DictionaryAdd(key, Request.QueryString[key]); } pe.RunScript(script); return(View(pe)); } catch (Exception ex) { return(RedirectShowError(ex.Message)); } }