private void LoadTypes() { Context.RecordTypes = _templatesManager.GetTemplates().Where(x => x.IsEnabled).Select(x => new RecordTypeInfo { TemplateInfo = x, IsSelected = true, IsEnabled = true }).ToList(); if (_isAppendMode) { var templateIds = _templatesManager.GetTemplates().Select(x => x.Id); var existingTypes = _recordItem.RecordsInfo.Where(x => templateIds.Contains(x.TemplateId)) .Select(x => x.TemplateId).ToList(); foreach (var contextRecordType in Context.RecordTypes) { if (existingTypes.Contains(contextRecordType.TemplateInfo.Id)) { contextRecordType.IsEnabled = false; } else { contextRecordType.IsSelected = false; } } } }
public override void LoadData() { Context = _templatesManager.GetTemplates(true); var mainScreen = ParentScreen as MainViewModel; mainScreen?.UpdateStatus(); }
public HttpResponseMessage ListTemplates() { using (FunctionsTrace.BeginTimedOperation()) { return(Request.CreateResponse(HttpStatusCode.OK, _templatesManager.GetTemplates())); } }
public HttpResponseMessage ListTemplates([FromUri] string runtime) { runtime = getClearRuntime(runtime); using (FunctionsTrace.BeginTimedOperation()) { return(Request.CreateResponse(HttpStatusCode.OK, _templatesManager.GetTemplates(runtime))); } }
public Task <IEnumerable <RecordListInfo> > GetRecords() { return(Task <IEnumerable <RecordListInfo> > .Factory.StartNew(() => { if (!Directory.Exists(Paths.RecordsPath)) { return null; } var dirs = Directory.GetDirectories(Paths.RecordsPath); var records = new List <RecordListInfo>(); var availableTemplatesCount = _templatesManager.GetTemplates().Count(); foreach (var s in dirs) { var recordXmlPath = Path.Combine(s, "record.xml"); var recordInfo = new RecordListInfo(); var record = XmlFileSerializer.Deserialize <Record>(recordXmlPath); foreach (var recordEntry in record.Entries) { UpdateRecordFile(record.RecordDate, recordEntry.FilePath, Path.Combine(s, recordEntry.FilePath)); } record = XmlFileSerializer.Deserialize <Record>(recordXmlPath); var recordItems = record.Entries.Select(recordEntry => new RecordListItemInfo { DisplayName = recordEntry.DisplayName, FilePath = recordEntry.FilePath, TemplateId = recordEntry.TemplateId, IsFilledIn = recordEntry.IsFilledIn, RecordDate = record.RecordDate }) .ToList(); recordInfo.RecordDate = record.RecordDate; recordInfo.RecordsInfo = recordItems; recordInfo.CanAddEntries = recordItems.Count < availableTemplatesCount; recordInfo.RecordId = record.RecordId; records.Add(recordInfo); } return records; })); }
public async Task <IActionResult> Get() { _logger.LogInformation("Getting all templates"); try { var templates = await _templatesManager.GetTemplates(); return(Ok(_mapper.Map <ICollection <Template> >(templates))); } catch (Exception ex) { _logger.LogError($"{_localizer["Failed to get all templates"]}", ex); return(BadRequest()); } }
public HttpResponseMessage ListTemplates([FromUri] string runtime) { runtime = GetClearRuntime(runtime); return(Request.CreateResponse(HttpStatusCode.OK, _templatesManager.GetTemplates(runtime))); }