private void btnViewActiveProcessing_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { using (ProcessStatementsDialogue dlg = new ProcessStatementsDialogue()) { dlg.ViewOnly = true; dlg.ShowDialog(); } }
private void btnProcessStatements_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { using (ProcessStatementsDialogue dlg = new ProcessStatementsDialogue()) { LayoutControlGrid.Validate(); using (var uow = new DevExpress.Xpo.Session()) { XDB.ORG_Company company = null; foreach (XDB.GLX_Account account in this.XPCollection) { switch (IsCustomer) { case true: company = uow.Query <XDB.ORG_Company>().SingleOrDefault(n => n.TypeId.Id == (byte)BL.ORG.ORG_Type.Customer && n.EntityId.EntityId.CodeSub == account.EntityId.CodeSub); break; case false: company = uow.Query <XDB.ORG_Company>().SingleOrDefault(n => n.TypeId.Id == (byte)BL.ORG.ORG_Type.Supplier && n.EntityId.EntityId.CodeSub == account.EntityId.CodeSub); break; } if (account.PrintStatement || account.EmailStatement) { dlg.Statements.Add(new CDS.Client.DataAccessLayer.Types.Statement() { EntityId = account.EntityId.Id, Code = account.EntityId.CodeSub, Name = account.EntityId.Name, Contact = company.AccountsContactName, Email = company.AccountsContactEmail, ShouldPrint = account.PrintStatement, ShouldEmail = account.EmailStatement }); } } } dlg.ShowDialog(); } if (StatementTask != null && StatementTask.Status != System.Threading.Tasks.TaskStatus.RanToCompletion) { Essential.BaseAlert.ShowAlert("Processing statements", "Statements will now be processed in the background.\nClick on \"View Active Processing\" to check progress.", Essential.BaseAlert.Buttons.Ok, Essential.BaseAlert.Icons.Information); btnViewActiveProcessing.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; btnProcessStatements.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; UpdateTimer.Start(); } }