protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!Page.IsPostBack) { RockContext rockContext = new RockContext(); JiraTopicService jiraTopicService = new JiraTopicService(rockContext); var topics = jiraTopicService .Queryable("JiraTickets") .AsNoTracking() .OrderBy(t => t.Order) .ToList(); topics.ForEach(t => t.JiraTickets = t.JiraTickets.OrderBy(t2 => t.CreatedDateTime).ToList()); var mergeFields = LavaHelper.GetCommonMergeFields(this.RockPage, CurrentPerson); mergeFields.Add("JiraTopics", topics); var output = GetAttributeValue(AttributeKey.LavaTemplate) .ResolveMergeFields( mergeFields, CurrentPerson, GetAttributeValue(AttributeKey.EnabledCommands) ); ltLava.Text = output; } }
/// <summary> /// Binds the grid. /// </summary> private void BindGrid() { RockContext rockContext = new RockContext(); JiraTopicService jiraTopicService = new JiraTopicService(rockContext); var qry = jiraTopicService.Queryable().OrderBy(j => j.Order); gList.SetLinqDataSource(qry); gList.DataBind(); }
protected void btnRefresh_Click(object sender, EventArgs e) { RockContext rockContext = new RockContext(); JiraTopicService jiraTopicService = new JiraTopicService(rockContext); var topics = jiraTopicService.Queryable().ToList(); foreach (var topic in topics) { Task.Run(() => topic.UpdateTickets()); } }
public void Execute(IJobExecutionContext context) { JobDataMap dataMap = context.JobDetail.JobDataMap; RockContext rockContext = new RockContext(); JiraTopicService jiraTopicService = new JiraTopicService(rockContext); var topics = jiraTopicService.Queryable().OrderBy(t => t.Order).ToList(); foreach (var topic in topics) { topic.UpdateTickets(); } context.Result = $"Updated tickets for {topics.Count} Jira topics"; }