public ActionResult RunScript(string name, string parameter = null, string title = null) { var content = DbUtil.Db.ContentOfTypeSql(name); if (content == null) { return(Content("no content")); } var cs = User.IsInRole("Finance") ? Util.ConnectionStringReadOnlyFinance : Util.ConnectionStringReadOnly; var cn = new SqlConnection(cs); cn.Open(); var d = Request.QueryString.AllKeys.ToDictionary(key => key, key => Request.QueryString[key]); var p = new DynamicParameters(); foreach (var kv in d) { p.Add("@" + kv.Key, kv.Value); } string script = ScriptModel.RunScriptSql(parameter, content, p, ViewBag); if (script.StartsWith("Not Authorized")) { return(Message(script)); } ViewBag.Report = name; ViewBag.Name = title ?? $"{name.SpaceCamelCase()} {parameter}"; if (script.Contains("pagebreak")) { ViewBag.report = PythonModel.PageBreakTables(DbUtil.Db, script, p); return(View("RunScriptPageBreaks")); } ViewBag.Url = Request.Url?.PathAndQuery; var rd = cn.ExecuteReader(script, p, commandTimeout: 1200); ViewBag.ExcelUrl = Request.Url?.AbsoluteUri.Replace("RunScript/", "RunScriptExcel/"); return(View(rd)); }
private IHandlebars RegisterHelpers(PictureDirectoryController ctl) { var handlebars = PythonModel.RegisterHelpers(DbUtil.Db); handlebars.RegisterHelper("SmallUrl", (w, ctx, args) => { GetPictureUrl(ctx, w, ctx.SmallId, Picture.SmallMissingMaleId, Picture.SmallMissingFemaleId, Picture.SmallMissingGenericId); }); handlebars.RegisterHelper("MediumUrl", (w, ctx, args) => { GetPictureUrl(ctx, w, ctx.MediumId, Picture.MediumMissingMaleId, Picture.MediumMissingFemaleId, Picture.MediumMissingGenericId); }); handlebars.RegisterHelper("ImagePos", (w, ctx, args) => { w.Write(ctx.X != null || ctx.Y != null ? $"{ctx.X ?? 0}% {ctx.Y ?? 0}%" : "top"); }); handlebars.RegisterHelper("IfAccess", (w, opt, ctx, args) => { if (HasAccess) { opt.Template(w, (object)ctx); } else { opt.Inverse(w, (object)ctx); } }); handlebars.RegisterHelper("PagerTop", (w, ctx, args) => { w.Write(ViewExtensions2.RenderPartialViewToString(ctl, "PagerTop", this)); }); handlebars.RegisterHelper("PagerBottom", (w, ctx, args) => { w.Write(ViewExtensions2.RenderPartialViewToString(ctl, "PagerBottom", this)); }); handlebars.RegisterHelper("PagerHidden", (w, ctx, args) => { w.Write(ViewExtensions2.RenderPartialViewToString(ctl, "PagerHidden", this)); }); handlebars.RegisterHelper("SortBirthday", (w, ctx, args) => { w.Write(SortLink("Birthday")); }); handlebars.RegisterHelper("SortName", (w, ctx, args) => { w.Write(SortLink("Name")); }); handlebars.RegisterHelper("CityStateZip", (w, ctx, args) => { w.Write(Util.FormatCSZ4(ctx.City, ctx.St, ctx.Zip)); }); handlebars.RegisterHelper("BirthDay", (w, ctx, args) => { var dob = (string)ctx.DOB; w.Write(dob.ToDate().ToString2("m")); }); return(handlebars); }
public ActionResult RunScript(string name, string parameter = null, string title = null) { var m = new SqlScriptModel(CurrentDatabase); var sql = m.FetchScript(name); if (sql == null) { return(Message("no sql script named " + name)); } if (!SqlScriptModel.CanRunScript(sql)) { return(Message("Not Authorized to run this script")); } var p = m.FetchParameters(); var pSql = m.AddParametersForSql(parameter, sql, p, ViewBag); ViewBag.Report = name; ViewBag.Name = title ?? $"{name.SpaceCamelCase()} {parameter}"; if (sql.Contains("pagebreak")) { ViewBag.report = PythonModel.PageBreakTables(CurrentDatabase, sql, p); return(View("RunScriptPageBreaks")); } ViewBag.Url = Request.Url?.PathAndQuery; string html; using (var cn = CurrentDatabase.ReadonlyConnection()) { cn.Open(); var rd = cn.ExecuteReader(sql, p, commandTimeout: 1200); ViewBag.ExcelUrl = Request.Url?.AbsoluteUri.Replace("RunScript/", "RunScriptExcel/"); html = GridResult.Table(rd, ViewBag.Name2); } return(View(new HtmlHolder { html = html })); }
public string Table() { string result = ""; using (var cn = db.ReadonlyConnection()) { var p = Parameters(); var sql = Sql(); if (sql.Contains("@userid")) { p.Add("@userid", Util.UserId); } if (sql.Contains("pagebreak")) { return(PythonModel.PageBreakTables(db, sql, p)); } var rd = cn.ExecuteReader(sql, p); result = GridResult.Table(rd, Name2, 2000); } return(result); }
private void AddQuestions(PythonModel pe) { if (pe.DataHas("ExtraQuestion")) { return; } if (ExtraQuestion == null || ExtraQuestion.Count == 0) { return; } var questions = new DynamicData(); pe.DictionaryAdd("ExtraQuestion", questions); foreach (var dict in ExtraQuestion) { foreach (var q in dict) { questions.AddValue(q.Key, q.Value); } } }
private void AddMenuItems(PythonModel pe) { if (pe.DataHas("MenuItem")) { return; } if (MenuItem == null) { return; } var menuitems = new DynamicData(); pe.DictionaryAdd("MenuItem", menuitems); foreach (var dict in MenuItem) { foreach (var q in dict) { menuitems.AddValue(q.Key, q.Value ?? 0); } } }
private void AddText(PythonModel pe) { if (pe.DataHas("TextQuestion")) { return; } if (Text == null || Text.Count == 0) { return; } var textquestions = new DynamicData(); pe.DictionaryAdd("TextQuestion", textquestions); foreach (var dict in Text) { foreach (var q in dict) { textquestions.AddValue(q.Key, q.Value); } } }
public bool TryRunPython(int pid) { var ev = Organization.GetExtra(DbUtil.Db, OrgId, "OrgMembersPageScript"); if (!ev.HasValue()) { return(false); } var script = DbUtil.Db.ContentOfTypePythonScript(ev); if (!script.HasValue()) { return(false); } var pe = new PythonModel(Util.Host); pe.Data.OrgId = OrgId; pe.Data.PeopleId = pid; Results = pe.RunScript(script); return(true); }
public void RenderTemplateTest() { var model = new PythonModel(db); model.Data.header = new { DateFrom = "10/17/2019", DateTo = "11/27/2019" }; model.Data.results = new dynamic[] { new { trans_date = new DateTime(2019, 11, 13), Payment_Type = "CC", OrganizationName = "Test Template Org", account_code = "1234-567890", Amount = 99.95, total_amt = 102938.67 }, new { trans_date = new DateTime(2019, 11, 14), Payment_Type = "ACH", OrganizationName = "Some Other Org", account_code = "1234-XXXXXX", Amount = 109, total_amt = 360 } }; var result = model.RenderTemplate(Resources.RenderTemplateTest); result.ShouldBe(Resources.RenderTemplateResults); }
public string Table() { var cs = DbUtil.Db.CurrentUser.InRole("Finance") ? Util.ConnectionStringReadOnlyFinance : Util.ConnectionStringReadOnly; var cn = new SqlConnection(cs); var p = Parameters(); var sql = Sql(); if (sql.Contains("@userid")) { p.Add("@userid", Util.UserId); } if (sql.Contains("pagebreak")) { return(PythonModel.PageBreakTables(DbUtil.Db, sql, p)); } var rd = cn.ExecuteReader(sql, p); return(GridResult.Table(rd, Name2, 2000)); }
public void RunPyScript() { var content = CurrentDatabase.ContentOfTypePythonScript(Report); if (content == null) { throw new Exception("no script named " + Report); } if (!CanRunScript(content)) { throw new Exception("Not Authorized to run this script"); } if (!content.Contains("BlueToolbarReport") && !content.Contains("@BlueToolbarTagId")) { throw new Exception("Missing Call to Query Function 'BlueToolbarReport'"); } if (Id == Guid.Empty) { throw new Exception("Must be run from the BlueToolbar"); } var pe = new PythonModel(CurrentDatabase.Host); pe.DictionaryAdd("BlueToolbarGuid", Id.ToCode()); foreach (var key in HttpContextFactory.Current.Request.QueryString.AllKeys) { pe.DictionaryAdd(key, HttpContextFactory.Current.Request.QueryString[key]); } pe.RunScript(content); Results = pe.Output; CurrentDatabase.LogActivity($"Run Python script: {Report}", pid: CurrentDatabase.UserPeopleId, uid: CurrentDatabase.UserId); }
public ActionResult TestScript() { //var id = DbUtil.Db.ScratchPadQuery(@"MemberStatusId = 10[Member] AND LastName = 'C*'"); var file = Server.MapPath("~/test.py"); var logFile = $"RunPythonScriptInBackground.{DateTime.Now:yyyyMMddHHmmss}"; string host = Util.Host; #if false HostingEnvironment.QueueBackgroundWorkItem(ct => { var pe = new PythonModel(host); //pe.DictionaryAdd("OrgId", "89658"); pe.DictionaryAdd("LogFile", logFile); PythonModel.ExecutePythonFile(file, pe); }); return(View("RunPythonScriptProgress")); #else var pe = new PythonModel(host); pe.DictionaryAdd("LogFile", logFile); ViewBag.Text = PythonModel.ExecutePython(file, pe, fromFile: true); return(View("Test")); #endif }
private string RunScript() { if (person == null) { return(GetNoPersonMessage()); } var m = new PythonModel(CurrentDatabase); var script = CurrentDatabase.ContentOfTypePythonScript(action.ScriptName); if (!script.HasValue()) { return(GetError($"Script name {action.ScriptName} not found")); } m.DictionaryAdd("ToNumber", To); m.DictionaryAdd("ToGroupId", row.ToGroupId); m.DictionaryAdd("FromNumber", From); m.DictionaryAdd("Message", Body); m.DictionaryAdd("PeopleId", row.FromPeopleId); m.DictionaryAdd("Name", person.Name); m.DictionaryAdd("First", person.FirstName); m.DictionaryAdd("Last", person.LastName); var msg = Util.PickFirst( m.RunScript(script).Trim(), action.ReplyMessage, action.DefaultMessage); row.ActionResponse = DoReplacments(msg); CurrentDatabase.SmsReceiveds.InsertOnSubmit(row); CurrentDatabase.SubmitChanges(); SendNotices(); if (msg.Equal("NONE")) { return(String.Empty); } return(row.ActionResponse); }
private ActionResult PyScriptFormPost(string name) { try { var pe = new PythonModel(Util.Host); ScriptModel.GetFilesContent(pe); foreach (var key in Request.Form.AllKeys) { pe.DictionaryAdd(key, Request.Form[key]); } pe.HttpMethod = "post"; var ret = ScriptModel.Run(name, pe); if (ret.StartsWith("REDIRECT=")) { return(Redirect(ret.Substring(9).trim())); } return(Content(ret)); } catch (Exception ex) { return(RedirectShowError(ex.Message)); } }
public ActionResult PyScript(string name, string p1, string p2, string v1, string v2) { #if DEBUG #else try { #endif var script = CurrentDatabase.ContentOfTypePythonScript(name); if (!script.HasValue()) { return(Message("no script named " + name)); } if (!ScriptModel.CanRunScript(script)) { return(Message("Not Authorized to run this script")); } if (Regex.IsMatch(script, @"model\.Form\b")) { 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 = CurrentDatabase.FetchLastQuery().Id; var tag = CurrentDatabase.PopulateSpecialTag(id, DbUtil.TagTypeId_Query); script = script.Replace("@qtagid", tag.Id.ToString()); } ViewBag.report = name; ViewBag.url = Request.Url?.PathAndQuery; if (script.Contains("Background Process Completed")) { var logFile = $"RunPythonScriptInBackground.{DateTime.Now:yyyyMMddHHmmss}"; ViewBag.LogFile = logFile; var qs = Request.Url?.Query; var host = Util.Host; HostingEnvironment.QueueBackgroundWorkItem(ct => { var qsa = HttpUtility.ParseQueryString(qs ?? ""); var pm = new PythonModel(CurrentDatabase); pm.DictionaryAdd("LogFile", logFile); foreach (string key in qsa) { pm.DictionaryAdd(key, qsa[key]); } string result = pm.RunScript(script); if (result.HasValue()) { pm.LogToContent(logFile, result); } }); return(View("RunPythonScriptProgress")); } var pe = new PythonModel(CurrentDatabase); if (script.Contains("@BlueToolbarTagId")) { var id = CurrentDatabase.FetchLastQuery().Id; pe.DictionaryAdd("BlueToolbarGuid", id.ToCode()); } foreach (var key in Request.QueryString.AllKeys) { pe.DictionaryAdd(key, Request.QueryString[key]); } pe.Output = ScriptModel.Run(name, pe); if (pe.Output.StartsWith("REDIRECT=")) { var a = pe.Output.SplitStr("=", 2); return(Redirect(a[1].TrimEnd())); } return(View(pe)); #if DEBUG #else } catch (Exception ex) { return(RedirectShowError(ex.Message)); } #endif }
private void BuildDynamicData(PythonModel pe, OrganizationMember om) { pe.DictionaryAdd("PeopleId", PeopleId ?? 0); pe.DictionaryAdd("OrganizationId", om.OrganizationId); var notifyIds = DbUtil.Db.StaffPeopleForOrg(om.OrganizationId); pe.DictionaryAdd("OnlineNotifyId", notifyIds[0].PeopleId); pe.DictionaryAdd("OnlineNotifyEmail", notifyIds[0].EmailAddress); pe.DictionaryAdd("OnlineNotifyName", notifyIds[0].Name); var props = typeof(OnlineRegPersonModel).GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (var pi in props.Where(vv => vv.CanRead && vv.CanWrite)) { switch (pi.Name) { case "ExtraQuestion": AddQuestions(pe); break; case "Text": AddText(pe); break; case "YesNoQuestion": AddYesNo(pe); break; case "option": AddDropDownOptions(pe); break; case "Checkbox": AddCheckboxes(pe); break; case "MenuItem": AddMenuItems(pe); break; case "ScriptResults": if (ScriptResults.HasValue()) { pe.DictionaryAdd(pi.Name, ScriptResults); } break; case "memberus": if (memberus) { pe.DictionaryAdd("MemberUs", memberus); } break; case "otherchurch": if (otherchurch) { pe.DictionaryAdd("OtherChurch", otherchurch); } break; case "LoggedIn": pe.DictionaryAdd(pi.Name, LoggedIn); break; case "FirstName": pe.DictionaryAdd(pi.Name, FirstName); break; case "LastName": pe.DictionaryAdd(pi.Name, LastName); break; } } }
public override void ExecuteResult(ControllerContext context) { var t = PythonModel.HtmlTable(rd); t.RenderControl(new HtmlTextWriter(context.HttpContext.Response.Output)); }
public Dictionary <Person, string> NoticesToSend() { var leaderNotices = new Dictionary <Person, string>(); const int days = 36; var olist = FetchOrgs().Select(oo => oo.OrganizationId).ToList(); var alist = (from p in DbUtil.Db.RecentAbsents(null, null, days) where olist.Contains(p.OrganizationId) select p).ToList(); var mlist = (from r in DbUtil.Db.LastMeetings(null, null, days) where olist.Contains(r.OrganizationId) select r).ToList(); var plist = (from om in DbUtil.Db.ViewOrganizationLeaders where olist.Contains(om.OrganizationId) group om.OrganizationId by om.PeopleId into leaderlist select leaderlist).ToList(); PythonModel.RegisterHelpers(DbUtil.Db); var template = HandlebarsDotNet.Handlebars.Compile(Resource1.RecentVisitsAbsents); var sb = new StringBuilder("Notices sent to:</br>\n<table>\n"); foreach (var p in plist) { var leader = DbUtil.Db.LoadPersonById(p.Key); var orgids = p.ToList(); var meetings = (from m in mlist where orgids.Contains(m.OrganizationId) let visitors = DbUtil.Db.OrgVisitorsAsOfDate(m.OrganizationId, m.Lastmeeting, true).ToList() let absents = (from a in alist where a.OrganizationId == m.OrganizationId select a).ToList() let org = DbUtil.Db.LoadOrganizationById(m.OrganizationId) select new { m.MeetingId, m.OrganizationId, LastMeeting = m.Lastmeeting.ToString2("g"), OrgName = Organization.FormatOrgName(m.OrganizationName, m.LeaderName, m.Location), m.LeaderName, ConsecutiveAbsentsThreshold = org.ConsecutiveAbsentsThreshold ?? 2, HasAbsents = absents.Any(), Absents = (from a in absents orderby a.Lastmeeting descending select new { a.PeopleId, a.Consecutive, a.Name2, HasHomePhone = a.HomePhone.HasValue(), HomePhone = a.HomePhone.FmtFone("H"), HasCellPhone = a.CellPhone.HasValue(), CellPhone = a.CellPhone.FmtFone("C"), HasEmail = a.EmailAddress.HasValue(), a.EmailAddress, MostRecentMeeting = a.Mostrecentmeeting.ToString2("d"), a.LeaderName, a.OrganizationName, LastMeeting = a.Lastmeeting.ToString2("d"), }).ToList(), HasVisits = visitors.Any(), Visits = (from a in visitors select new { a.PeopleId, a.LastName, a.PreferredName, LastAttended = a.LastAttended.ToString2("d"), HasHomePhone = a.HomePhone.HasValue(), HomePhone = a.HomePhone.FmtFone("H"), HasCellPhone = a.CellPhone.HasValue(), CellPhone = a.CellPhone.FmtFone("C"), HasEmail = a.Email.HasValue(), a.Email, }).ToList(), }).ToList(); foreach (var m in meetings) { sb.Append($"<tr><td>{leader.Name}</td><td>{m.OrgName}</td><td>{m.LastMeeting:g}</td></tr>\n"); } leaderNotices.Add(leader, template(meetings)); } sb.Append("</table>\n"); noticelist = sb.ToString(); return(leaderNotices); }
public ActionResult VoteLinkSg(string id, string message, bool?confirm, FormCollection formCollection) { var li = new LinkInfo(votelinkSTR, confirmSTR, id); if (li.error.HasValue()) { return(Message(li.error)); } try { var smallgroup = li.a[4]; if (!li.oid.HasValue) { throw new Exception("orgid missing"); } if (!li.pid.HasValue) { throw new Exception("peopleid missing"); } var q = (from pp in DbUtil.Db.People where pp.PeopleId == li.pid let org = DbUtil.Db.Organizations.SingleOrDefault(oo => oo.OrganizationId == li.oid) let om = DbUtil.Db.OrganizationMembers.SingleOrDefault(oo => oo.OrganizationId == li.oid && oo.PeopleId == li.pid) select new { p = pp, org, om }).Single(); if (q.org == null && DbUtil.Db.Host == "trialdb") { var oid = li.oid + Util.TrialDbOffset; q = (from pp in DbUtil.Db.People where pp.PeopleId == li.pid let org = DbUtil.Db.Organizations.SingleOrDefault(oo => oo.OrganizationId == oid) let om = DbUtil.Db.OrganizationMembers.SingleOrDefault(oo => oo.OrganizationId == oid && oo.PeopleId == li.pid) select new { p = pp, org, om }).Single(); } if (q.org == null) { throw new Exception("org missing, bad link"); } if ((q.org.RegistrationTypeId ?? RegistrationTypeCode.None) == RegistrationTypeCode.None) { throw new Exception("votelink is no longer active"); } if (q.om == null && q.org.Limit <= q.org.RegLimitCount(DbUtil.Db)) { throw new Exception("sorry, maximum limit has been reached"); } if (q.om == null && (q.org.RegistrationClosed == true || q.org.OrganizationStatusId == OrgStatusCode.Inactive)) { throw new Exception("sorry, registration has been closed"); } var setting = DbUtil.Db.CreateRegistrationSettings(li.oid.Value); if (IsSmallGroupFilled(setting, li.oid.Value, smallgroup)) { throw new Exception("sorry, maximum limit has been reached for " + smallgroup); } var omb = OrganizationMember.Load(DbUtil.Db, li.pid.Value, li.oid.Value) ?? OrganizationMember.InsertOrgMembers(DbUtil.Db, li.oid.Value, li.pid.Value, MemberTypeCode.Member, Util.Now, null, false); if (q.org.AddToSmallGroupScript.HasValue()) { var script = DbUtil.Db.Content(q.org.AddToSmallGroupScript); if (script != null && script.Body.HasValue()) { try { var pe = new PythonModel(Util.Host, "RegisterEvent", script.Body); pe.instance.AddToSmallGroup(smallgroup, omb); } catch (Exception) { } } } omb.AddToGroup(DbUtil.Db, smallgroup); li.ot.Used = true; DbUtil.Db.SubmitChanges(); DbUtil.LogActivity($"{votelinkSTR}{confirmSTR}: {smallgroup}", li.oid, li.pid); if (confirm == true) { var subject = Util.PickFirst(setting.Subject, "no subject"); var msg = Util.PickFirst(setting.Body, "no message"); msg = APIOrganization.MessageReplacements(DbUtil.Db, q.p, q.org.DivisionName, q.org.OrganizationId, q.org.OrganizationName, q.org.Location, msg); msg = msg.Replace("{details}", smallgroup); var NotifyIds = DbUtil.Db.StaffPeopleForOrg(q.org.OrganizationId); try { DbUtil.Db.Email(NotifyIds[0].FromEmail, q.p, subject, msg); // send confirmation } catch (Exception ex) { DbUtil.Db.Email(q.p.FromEmail, NotifyIds, q.org.OrganizationName, "There was a problem sending confirmation from org: " + ex.Message); } DbUtil.Db.Email(q.p.FromEmail, NotifyIds, q.org.OrganizationName, $"{q.p.Name} has registered for {q.org.OrganizationName}<br>{smallgroup}<br>(from votelink)"); } } catch (Exception ex) { DbUtil.LogActivity($"{votelinkSTR}{confirmSTR}Error: {ex.Message}", li.oid, li.pid); return(Message(ex.Message)); } return(Message(message)); }
public Dictionary <Person, string> NoticesToSend() { var leaderNotices = new Dictionary <Person, string>(); var olist = FetchOrgs().Select(oo => oo.OrganizationId).ToList(); var cn = new SqlConnection(Util.ConnectionString); cn.Open(); var orgs = string.Join(",", olist); var alist = cn.Query <RecentAbsentsInfo>("RecentAbsentsSP2", new { orgs }, commandType: CommandType.StoredProcedure, commandTimeout: 600).ToList(); var mlist = (from r in DbUtil.Db.LastMeetings(orgs) where olist.Contains(r.OrganizationId) select r).ToList(); var plist = (from om in DbUtil.Db.ViewOrganizationLeaders where olist.Contains(om.OrganizationId) group om.OrganizationId by om.PeopleId into leaderlist select leaderlist).ToList(); PythonModel.RegisterHelpers(DbUtil.Db); var template = HandlebarsDotNet.Handlebars.Compile(Resource1.RecentVisitsAbsents); var sb = new StringBuilder("Notices sent to:</br>\n<table>\n"); foreach (var p in plist) { var leader = DbUtil.Db.LoadPersonById(p.Key); var orgids = p.ToList(); var meetings = (from m in mlist where orgids.Contains(m.OrganizationId) let visitors = DbUtil.Db.OrgVisitorsAsOfDate(m.OrganizationId, m.Lastmeeting, true).ToList() let absents = (from a in alist where a.OrganizationId == m.OrganizationId select a).ToList() let org = DbUtil.Db.LoadOrganizationById(m.OrganizationId) select new { m.MeetingId, m.OrganizationId, m.Lastmeeting, OrgName = Organization.FormatOrgName(m.OrganizationName, m.LeaderName, m.Location), m.LeaderName, ConsecutiveAbsentsThreshold = org.ConsecutiveAbsentsThreshold ?? 2, HasAbsents = absents.Any(), Absents = (from a in absents orderby a.LastAttend descending select new { a.PeopleId, a.Consecutive, a.Name2, HomePhone = a.HomePhone.FmtFone(), CellPhone = a.CellPhone.FmtFone(), a.EmailAddress, a.LeaderName, a.OrganizationName, a.OtherAttends, a.LastAttend }).ToList(), HasVisits = visitors.Any(), Visits = (from a in visitors select new { a.PeopleId, a.LastName, a.PreferredName, a.LastAttended, HomePhone = a.HomePhone.FmtFone(), CellPhone = a.CellPhone.FmtFone(), a.Email, }).ToList(), }).ToList(); foreach (var m in meetings) { sb.Append($"<tr><td>{leader.Name}</td><td>{m.OrgName}</td><td>{m.Lastmeeting:g}</td></tr>\n"); } leaderNotices.Add(leader, template(meetings)); } sb.Append("</table>\n"); noticelist = sb.ToString(); return(leaderNotices); }
public ActionResult TestScript(string script) { return(Content(PythonModel.RunScript(Util.Host, script))); }
public PythonScriptModel(CMSDataContext db) { Db = db; pythonModel = new PythonModel(db); }
public static HtmlString Markdown(string text) { var output = PythonModel.Markdown(text); return(new HtmlString(output)); }
public ActionResult TestScript() { var text = System.IO.File.ReadAllText(Server.MapPath("ttt.py")); return(Content(PythonModel.RunScript(Util.Host, text))); }