public SalesMonthModel(byte month, SalesMonthModel previousModel) { _resultItems.CollectionChanged += _resultItems_CollectionChanged; _previousModel = previousModel; _month = month; Renew(); }
static public void ShowDialog(SalesMonthModel month) { ListViewModel vm = new ListViewModel(month); ListView v = new ListView(); v.DataContext = vm; vm.ShowDialogBox(); }
/// <summary> /// Constructor /// </summary> /// <param name="month">this month</param> /// <param name="previousModel">data of last month</param> public SalesMonthModel(SalesDataContext dataContext, byte month, SalesMonthModel previousModel) { _resultItems.CollectionChanged += _resultItems_ColectionChanged; _dataContext = dataContext; _previousModel = previousModel; _month = month; Renew(); }
public static void Renew() { _monthItems.Clear(); SalesMonthModel prev = null; for (byte month = 1; month <= 12; month++) { SalesMonthModel item = new SalesMonthModel(month, prev); _monthItems.Add(item); prev = item; } }
/// <summary> /// Initiarize 12 months data. /// </summary> public static void Renew() { _monthItems.Clear(); SalesMonthModel prev = null; // there is no data for first month(january) for (byte month = 1; month <= 12; month++) { SalesMonthModel item = new SalesMonthModel(_dataContext, month, prev); _monthItems.Add(item); prev = item; // set the modified "item" data for previous month sales data of next month. } }
/// <summary> /// constructor /// </summary> /// <param name="monthModel"></param> private ListViewModel(SalesMonthModel monthModel) { _model = monthModel; }