Exemplo n.º 1
0
        public void ExpensesGrid_Loaded(object sender, RoutedEventArgs e)
        {
            if (_projectId != 0)
            {
                grillaGastos.Items.Clear();
                TotalGastos.Text = string.Empty;

                var cadena = db.GetExpenses(_projectId);

                if (cadena.Count != 0)
                {
                    foreach (var item in cadena)
                    {
                        var UnitPrice  = item.UnitPrice.ToString("C");
                        var TotalPrice = item.TotalPrice.ToString("C");
                        var o          = new
                        {
                            item.Id,
                            item.Name,
                            item.Amount,
                            UnitPrice,
                            TotalPrice
                        };

                        grillaGastos.Items.Add(o);
                    }
                }

                TotalGastos.Text = "TOTAL GASTOS / JORNALES:   " + db.CalculateTotalExpenses(_projectId).ToString("C");
            }
        }