ListControl CreateListControl(object UserData) { ListControl LC = (ListControl)Page.LoadControl("~/Controls/ListControl.ascx"); LC.UserData = UserData; return(LC); }
public void CalculateBudget(ListControl LC) { BudgetMonth Month = (BudgetMonth)LC.UserData; LC.Clear(); LC.AddItem(Month.GetName(), ItemColor.Info); float Sum = 0; Transaction[] Transactions = Transaction.Sort(GetTransactionsForMonth(Month)).ToArray(); foreach (var T in Transactions) { Sum += T.Value; ItemColor Clr = ItemColor.Green; if (T.Value > 0) { if (T.Maestro == null) { Clr = ItemColor.Green; } else { Clr = ItemColor.Info; } } else { if (T.Maestro == null) { Clr = ItemColor.Red; } else if (T.Maestro != null) { Clr = ItemColor.Orange; } } LC.AddItem(T.FormatValue(), Clr, T.ID.ToString(), OnTransactionRemove); } LC.AddItem(Transaction.FormatValue(Sum)); LC.AddItem("Available Maestro<br/>999", ItemColor.Info); ///Transaction.FormatValue(999); }
void GenerateExchangeTable(DAL DbDAL, Currency[] Currencies, BudgetSession S) { ListControl Lst = CreateListControl(); Tuple <Currency, float>[] Exchanges = Utils.GetExchange(S.ExchangeCurrency, Currencies); foreach (var Ex in Exchanges) { Lst.AddItem(string.Format("{0} - {1}", Ex.Item1.Code, Ex.Item2)); } TableRow Row = new TableRow(); TableCell Cell = new TableCell(); Cell.Controls.Add(Lst); Row.Cells.Add(Cell); DataTable.Rows.Add(Row); }
ListControl CreateListControl() { ListControl LC = (ListControl)Page.LoadControl("~/Controls/ListControl.ascx"); return(LC); }