private void Refresh() { Valuts = new ObservableCollection <ValutaEntityWraper>(); foreach (var item in Context.GetCurRates(_code, _fromdata, _todata)) { var litem = new ValutaEntityWraper(item); litem.Codes = new ObservableCollection <string>(Codes); Valuts.Add(litem); } }
private void dgEmp_BeginningEdit(object sender, DataGridBeginningEditEventArgs e) { isBeingEdited = true; ValutaEntityWraper emp = e.Row.DataContext as ValutaEntityWraper; if (emp != null) { emp.State = 1; } }
private void dgEmp_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e) { ValutaEntityWraper emp = e.Row.DataContext as ValutaEntityWraper; if (e.EditAction == DataGridEditAction.Cancel) { e.Cancel = false; return; } if (e.EditAction == DataGridEditAction.Commit) { vm.SaveKursFromOutSide(emp); } }
internal void SaveKursFromOutSide(ValutaEntityWraper emp) { Context.SaveKurs(emp.Date, emp.CodeVal, emp.Value); if (Valuts != null) { foreach (var valutaEntityWraper in Valuts) { if (valutaEntityWraper.State == 1) { Context.SaveKurs(valutaEntityWraper.Date, valutaEntityWraper.CodeVal, valutaEntityWraper.Value); } } } Refresh(); OnPropertyChanged("Valuts"); }