public SaveCoins(int _Year, double _ECCC, double _Euro, double _Dolars, double _Sek) { IEnumerable <Targets_CoinsDB> List = TargetsCoinsController.Load_Year(_Year); if (List.Count() == 0) { var NewRow = new Targets_CoinsDB { Year = _Year, ECCC = _ECCC, Euro = _Euro, USD = _Dolars, SEK = _Sek, }; TargetsCoinsController.AddValue(NewRow); } else { List.First().ECCC = _ECCC; List.First().Euro = _Euro; List.First().USD = _Dolars; List.First().SEK = _Sek; TargetsCoinsController.UpdateValue(List.First()); } }
public RefreshCoins(int Year) { IEnumerable <Targets_CoinsDB> List = TargetsCoinsController.Load_Year(Year); MainProgram.Self.CoinsView.Clear(); if (List.Count() == 0) { return; } else if (List.Count() == 1) { if (List.First().Year == Year) { MainProgram.Self.CoinsView.GetECCC(List.First().ECCC); MainProgram.Self.CoinsView.GetEuro(List.First().Euro); MainProgram.Self.CoinsView.GetUSD(List.First().USD); MainProgram.Self.CoinsView.GetSEK(List.First().SEK); } } else { MessageBox.Show("Coś za dużo lat!"); } }