protected void TableActionButton_Click(Object sender, EventArgs e) { try { var mailingIds = this.GetIdsFromPostedCheckBoxes(); List <Mailing> selectedMailings = Mailing.LoadByIds(mailingIds); Guid actionGuid = TableActionList.SelectedValue.ToGuid(); var tableAction = MailingTableActions.Default.First(runner => runner.Guid == actionGuid); tableAction.Action(selectedMailings, this); } catch (Exception ex) { this.Master.ShowError(ex); } }
//Methods #region Page_Load /// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_PreRender(object sender, EventArgs e) { try { IEnumerable <Mailing> mailings = Mailing.LoadByIds(this.RequestAddOn.Query.MailingIds); var articlesWithAmount = from runner in mailings from runner2 in runner.Sales from runner3 in runner2.SaleItems group runner3 by runner3.InternalArticleNumber into g orderby g.Key select new ArticleWithAmount() { Article = Article.LoadByArticleNumber(g.Key), Amount = g.Sum(y => y.Amount) }; this.SaleItemRepeater.DataSource = articlesWithAmount; this.SaleItemRepeater.DataBind(); } catch { } }