private void UpdateTimer_Tick(object sender, EventArgs e) { try { statements = BL.ApplicationDataContext.Instance.Service.ProcessStatementsUpdate(); pbcPrint.Properties.Maximum = Statements.Count(n => n.ShouldPrint); pbcEmail.Properties.Maximum = Statements.Count(n => n.ShouldEmail); if (BindingSource.DataSource == null) { UpdateTimer.Stop(); Essential.BaseAlert.ShowAlert("Processing statements", "Statements processing complete.", Essential.BaseAlert.Buttons.Ok, Essential.BaseAlert.Icons.Information); this.Close(); } else { lblPrintProgress.Text = string.Format("Printed {0} of {1}", Statements.Count(n => n.HasPrinted.HasValue), Statements.Count(n => n.ShouldPrint)); pbcPrint.EditValue = Statements.Count(n => n.HasPrinted.HasValue); lblEmailProgress.Text = string.Format("Mailed {0} of {1}", Statements.Count(n => n.HasMailed.HasValue), Statements.Count(n => n.ShouldEmail)); pbcEmail.EditValue = Statements.Count(n => n.HasMailed.HasValue); BindingSource.DataSource = statements; grdProgress.RefreshDataSource(); } } catch { UpdateTimer.Stop(); this.Close(); } }
/// <summary> /// Helper routine. Pass it all renames relevant, and it will do all the testing. /// It will return the FULL rename list, including everything you have passed in! /// </summary> /// <param name="other"></param> /// <param name="replaceFirst"></param> /// <returns></returns> protected virtual Tuple <bool, IEnumerable <Tuple <string, string> > > RequiredForEquivalenceForBase(ICMStatementInfo other, Tuple <bool, IEnumerable <Tuple <string, string> > > renames) { if (!renames.Item1) { return(renames); } // We assume this works at this point! var s2 = other as StatementInlineBlockBase; // If the number of statements isn't the same, then this doesn't matter. if (Statements.Count() != s2.Statements.Count()) { return(Tuple.Create(false, Enumerable.Empty <Tuple <string, string> >())); } // Loop through the statements, accumulating renames as we go. foreach (var s in Statements.Zip(s2.Statements, (st1, st2) => Tuple.Create(st1, st2))) { renames = renames .RequireForEquivForExpression(s.Item1 as ICMStatementInfo, s.Item2 as ICMStatementInfo); } // If we make it here, then we are good. The last thing to do before returning the result is to remove // any renames and any declared variables var declaredVariables = s2.DeclaredVariables; return(renames .FilterRenames(i => !declaredVariables.Select(p => p.RawValue).Contains(i.Item1))); }
public void GoNext() { int row = StatementsGrid.Selection?.Row ?? -1; int nextRow = Math.Min(Statements.Count() - 1, row + 1); Logger.Debug($"{nameof(GoNext)}: {row} => {nextRow}"); StatementsGrid.Select(new GridCellRange(nextRow, 0), true); }
public void GoBottom() { if (!Statements.Any()) { return; } Logger.Debug($"{nameof(GoBottom)}"); StatementsGrid.Select(new GridCellRange(Statements.Count() - 1, 0), true); }
private void ProcessStatements(long periodId) { pbcPrint.Properties.Maximum = Statements.Count(n => n.ShouldPrint); pbcEmail.Properties.Maximum = Statements.Count(n => n.ShouldEmail); var task = BL.ApplicationDataContext.Instance.Service.ProcessStatementsAsync(BL.ApplicationDataContext.Instance.LoggedInUser.PersonId, periodId, (long?)ddlPrinter.EditValue, Statements); using (new CDS.Client.Desktop.Essential.UTL.WaitCursor()) { var mainform = Application.OpenForms["MainForm"]; Type typExternal = mainform.GetType(); System.Reflection.PropertyInfo propertyInf = typExternal.GetProperty("StatementTask"); propertyInf.SetValue(mainform, task); } //this.Close(); }