private void SummaryTemplateStock() { int number = _spotDataSource.Count; double totalCap = _spotDataSource.Sum(p => p.MarketCap); double totalWeight = _spotDataSource.Sum(p => p.SettingWeight); tbNumber.Text = string.Format("{0}", number); tbTotalCap.Text = string.Format("{0}", totalCap); tbSettingWeight.Text = string.Format("{0}", totalWeight); }
void HowManyDirectsReport() { IEnumerable <DisplayGreatStats> relations = FamilyTree.Instance.AllIndividuals.Where(x => x.RelationToRoot.Length > 0 && (x.RelationType == Individual.DIRECT || x.RelationType == Individual.DESCENDANT)) .GroupBy(i => (i.RelationToRoot, i.RelationSort)) .Select(r => new DisplayGreatStats(r.Key.RelationToRoot, r.Key.RelationSort, r.Count())); var list = new SortableBindingList <DisplayGreatStats>(relations.ToList()); dgStatistics.DataSource = list; dgStatistics.Columns[0].Width = 180; dgStatistics.Columns[0].SortMode = DataGridViewColumnSortMode.Automatic; dgStatistics.Columns[0].HeaderText = "Relation to Root"; dgStatistics.Columns[1].Visible = false; dgStatistics.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dgStatistics.Columns[1].SortMode = DataGridViewColumnSortMode.Automatic; dgStatistics.Columns[1].HeaderText = "Relation Sort"; dgStatistics.Columns[2].Width = 60; dgStatistics.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dgStatistics.Columns[2].SortMode = DataGridViewColumnSortMode.Automatic; dgStatistics.Columns[2].HeaderText = "Count"; dgStatistics.Sort(dgStatistics.Columns[1], ListSortDirection.Descending); int count = list.Sum(x => x.Count); Text = $"How Many Directs Report - {count} directs"; tsStatusLabel.Text = "Double click to show all individuals with that relationship to root person."; tsStatusLabel.Visible = true; }
private void LoadSales(SaleFilterModel filter) { int count = 0; long elapsed = ClientHelper.PerformFetch(() => { SortableBindingList <SalesView> sales = this.saleController.FetchSaleWithSearch(filter); salesViewBindingSource.DataSource = sales; if (salesViewBindingSource.Count == 0) { salesDetailViewModelBindingSource.DataSource = null; } TotalSalesTextbox.Text = sales.Sum(a => a.TotalAmount).Value.ToString("Php #,##0.00"); count = sales.Count; }); ((MainForm)this.ParentForm).AttachStatus(count, elapsed); }
void CousinsCountReport() { IEnumerable <Tuple <string, int> > relations = FamilyTree.Instance.AllIndividuals.Where(x => x.RelationToRoot.Length > 0).GroupBy(i => i.RelationToRoot) .Select(r => new Tuple <string, int>(r.Key, r.Count())); var list = new SortableBindingList <Tuple <string, int> >(relations.ToList()); dgStatistics.DataSource = list; dgStatistics.Columns[0].Width = 180; dgStatistics.Columns[0].SortMode = DataGridViewColumnSortMode.Automatic; dgStatistics.Columns[0].HeaderText = "Relation to Root"; dgStatistics.Columns[1].Width = 60; dgStatistics.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dgStatistics.Columns[1].SortMode = DataGridViewColumnSortMode.Automatic; dgStatistics.Columns[1].HeaderText = "Count"; dgStatistics.Sort(dgStatistics.Columns[0], ListSortDirection.Ascending); int count = list.Sum(x => x.Item2); Text = $"Cousin Count Report - {count} Individuals"; tsStatusLabel.Text = "Double click to show all individuals with that relationship to root person."; tsStatusLabel.Visible = true; }
private void ComputeTotal() { TotalTextbox.Text = selectedDebits.Sum(a => a.Amount).ToString("N2"); }
private void SetupData(SortableBindingList <Session> list) { dgvSessions.DataSource = list; tbxConCount.Text = SessionList.LongCount().ToString(); tbxConAmount.Text = new TimeSpan(SessionList.Sum(o => o.SessionLength.Ticks)).ToString(@"hh\:mm\:ss"); }