private void LoadMethods() { foreach (var item in protocols) { item.Model = protocolService.Get(item.Model.ident); } }
public ReportResult Generate(DateTime from, DateTime to) { try { var events = _protocolService.Get(from, to); var lines = new List <string>(); foreach (var e in events) { var line = new List <string>(); line.Add(e.Id.ToString()); line.Add(e.Created.ToString()); foreach (var keyValuePair in e.Fields) { var value = keyValuePair.Value; line.Add(value.ToString()); } line.Add(e.Description); } var fileSource = string.Join(",", lines); using (var stream = new FileStream($"report {from.Day}.{from.Month}.{from.Year}-{to.Day}.{to.Month}.{to.Year}", FileMode.Create)) { using (var writer = new StreamWriter(stream)) { writer.WriteLine(fileSource); } } } catch (Exception ex) { Log.Error(ex.ToString()); } return(null); }
public void RefreshList() { Application.Current.Dispatcher.BeginInvokeOnMainThread(new Action( () => { if (Parent is ProtocolModelViewModel viewModel) { protocolMethodsFalse = new ObservableCollection <ProtocolMethodViewModel>(protocolMethodService.GetAll() .Select(pm => new ProtocolMethodViewModel(pm, protocolPage) { Parent = this }) .Where(x => x.Model.IsCompleted == false && protocolService.Get(x.Model.ProtocolIdent)?.TeamIdent == Session.CurrentUser?.TeamIdent && viewModel.Model.ident == x.Model.ProtocolIdent)); protocolMethodsTrue = new ObservableCollection <ProtocolMethodViewModel>(protocolMethodService.GetAll() .Select(pm => new ProtocolMethodViewModel(pm, protocolPage) { Parent = this }) .Where(x => x.Model.IsCompleted == true && protocolService.Get(x.Model.ProtocolIdent)?.TeamIdent == Session.CurrentUser?.TeamIdent && viewModel.Model.ident == x.Model.ProtocolIdent)); OnPropertyChanged(nameof(ProtocolMethodsFalse)); OnPropertyChanged(nameof(ProtocolMethodsTrue)); LoadMethods(); } })); IsBusy = false; OnPropertyChanged(nameof(IsBusy)); }