private async Task <string> CreateBookSourceAsync(IBaseSource source, string userEmail = null) { var bookSource = source as BookSource; var workName = string.IsNullOrEmpty(bookSource.WorkName) ? string.Empty : $" {bookSource.WorkName} /"; var placeOfPublication = string.IsNullOrEmpty(bookSource.PlaceOfPublication) ? string.Empty : $" - {bookSource.PlaceOfPublication}"; var publishingHouse = string.IsNullOrEmpty(bookSource.PublishingHouse) ? string.Empty : $": {bookSource.PublishingHouse}"; var yearOfPublication = bookSource.YearOfPublication == null ? string.Empty : $", {bookSource.YearOfPublication}."; var numberOfPages = string.IsNullOrEmpty(bookSource.NumberOfPages) ? string.Empty : $" – {bookSource.NumberOfPages} c."; var publishingName = string.IsNullOrEmpty(bookSource.PublishingName) ? string.Empty : $" – ({bookSource.PublishingName})."; var content = $"{bookSource.ParseAuthor()}{workName}" + $"{bookSource.ParseAllAuthors()}{placeOfPublication}" + $"{publishingHouse}{yearOfPublication}" + $"{numberOfPages}{publishingName} – " + $"({bookSource.Series}; {shortPublicationTypes[bookSource.PublicationNumberType]} {bookSource.PeriodicSelectionNumber})"; var newSource = new SourceRecord { Content = content, Type = bookSource.Type }; if (!string.IsNullOrEmpty(userEmail)) { await SaveSourceAsync(newSource, userEmail); } return(content); }
private async void OnSelectedProgramChanged() { //获得节目单,默认使用第一个可用的节目单源 var channel = SelectedProgram.ProgramInfo.Channel; Schedule = await TelevisionService.Instance.GetSchedule(channel); //更新收藏状况 IsCurrentChannelFavourite = CollectionService.Instance.CheckChannel(channel); IsCurrentProgramFavourite = CollectionService.Instance.CheckProgram(SelectedProgram.ProgramInfo); //选择默认来源 var defaultStation = SettingService.Instance.Get("PriorSource", TelevisionService.Instance.TelevisionStations.First().IdentifierName) as string; var defaultSource = SelectedProgram.MediaSources.Where(source => source.StationName.StartsWith(defaultStation)); SelectedSource = defaultSource.Count() == 0 ? SelectedProgram.MediaSources.First() : defaultSource.First(); //展开侧面面板 ToggleSidePanel.RaiseCanExecuteChanged(); if (!_IsSidePanelExpaneded) { _IsSidePanelExpaneded = true; if (Host != null) { VisualStateManager.GoToState(Host, "SideExpanded", true); } else { HostLoaded.Action = (host) => VisualStateManager.GoToState(host, "SideExpanded", true); } } }
protected override void Execute(CodeActivityContext activityContext, IWorkflowContext workflowContext, IOrganizationService crmService, ITracingService tracingService) { try { // Get the Source Record URL string sourceRecordUrl = SourceRecord.Get(activityContext); if (string.IsNullOrEmpty(sourceRecordUrl)) { Message.Set(activityContext, "Source Record URL cannot be empty or null"); return; } // Convert Record URL to ER EntityReference sourceRecordEr = EntityRecordUrlHelpers.ConvertRecordUrLtoEntityReference(sourceRecordUrl, crmService); if (sourceRecordEr == null) { Message.Set(activityContext, "Failed to convert record URL into Entity Reference. Please make sure you provide valid record URL"); return; } var recordId = sourceRecordEr.Id; var annotation_isdocument = true; var query = new QueryExpression(sourceRecordEr.LogicalName); query.Distinct = true; query.ColumnSet.AddColumns("createdon"); query.Criteria.AddCondition($"{sourceRecordEr.LogicalName}id", ConditionOperator.Equal, recordId); var queryAnnotation = query.AddLink("annotation", $"{sourceRecordEr.LogicalName}id", "objectid"); queryAnnotation.EntityAlias = "aa"; queryAnnotation.LinkCriteria.AddCondition("isdocument", ConditionOperator.Equal, annotation_isdocument); queryAnnotation.LinkCriteria.AddCondition("filename", ConditionOperator.NotNull); var results = crmService.RetrieveMultiple(query); if (!results.Entities.Any()) { // No attachments found HasAttachment.Set(activityContext, false); return; } // Attachments found HasAttachment.Set(activityContext, true); IsSuccess.Set(activityContext, true); } catch (Exception ex) { IsSuccess.Set(activityContext, false); Message.Set(activityContext, "An error occurred while check for attachments -" + ex.Message); } }
public void Sour_Rfn() { // TODO Non-standard tag. Apparently exists from FamilyTreeMaker? See Gene.Genie. // 20181025 Current behavior is to store as an 'unknown'. var txt = "0 @S1@ SOUR\n1 RFN blah\n"; var res = ReadIt(txt); Assert.AreEqual(1, res.Count); SourceRecord rec = res[0] as SourceRecord; Assert.IsNotNull(rec); Assert.AreEqual(1, rec.Unknowns.Count); Assert.AreEqual(2, rec.Unknowns[0].Beg); }
private async Task SaveSourceAsync(SourceRecord sourceRecord, string userEmail) { var user = await _unitOfWork.Users.GetUserAsync(userEmail); if (user is null) { throw new NotFoundException($"Cant find user by email: {userEmail}"); } sourceRecord.User = user; await _unitOfWork.Sources.CreateSourceAsync(sourceRecord); await _unitOfWork.CommitAsync(); }
public override void PostCheck(GEDCommon rec) { SourceRecord me = rec as SourceRecord; if (string.IsNullOrWhiteSpace(me.Ident)) // TODO common? { UnkRec err = new UnkRec(); err.Error = UnkRec.ErrorCode.MissIdent; // TODO {Error = "Missing identifier"}; err.Beg = err.End = rec.BegLine; me.Errors.Add(err); } // No required data except Xref id? // TODO Warning: no data provide }
private static void WriteOneSour(StreamWriter file, SourceRecord sourceRecord) { file.WriteLine("0 @{0}@ SOUR", sourceRecord.Ident); if (sourceRecord.Data != null && sourceRecord.Data.Events.Count > 0) { file.WriteLine("1 DATA"); WriteCommon.writeIfNotEmpty(file, "AGNC", sourceRecord.Data.Agency, 2); foreach (var sourEvent in sourceRecord.Data.Events) { file.WriteLine("2 EVEN {0}", sourEvent.Text); WriteCommon.writeIfNotEmpty(file, "DATE", sourEvent.Date, 3); WriteCommon.writeIfNotEmpty(file, "PLAC", sourEvent.Place, 3); } } WriteCommon.writeExtIfNotEmpty(file, "AUTH", sourceRecord.Author, 1); WriteCommon.writeExtIfNotEmpty(file, "TITL", sourceRecord.Title, 1); WriteCommon.writeExtIfNotEmpty(file, "ABBR", sourceRecord.Abbreviation, 1); WriteCommon.writeExtIfNotEmpty(file, "PUBL", sourceRecord.Publication, 1); WriteCommon.writeExtIfNotEmpty(file, "TEXT", sourceRecord.Text, 1); // TODO have 5.5 repository citations been converted to 5.5.1? E.g. SOUR.REPO.MEDI? foreach (var repoCit in sourceRecord.Cits) { if (string.IsNullOrWhiteSpace(repoCit.Xref)) { file.WriteLine("1 REPO"); } else { file.WriteLine("1 REPO @{0}@", repoCit.Xref); } foreach (var callNum in repoCit.CallNums) { file.WriteLine("2 CALN {0}", callNum.Number); WriteCommon.writeIfNotEmpty(file, "MEDI", callNum.Media, 3); } WriteCommon.writeSubNotes(file, repoCit, 2); } WriteCommon.writeRecordTrailer(file, sourceRecord, 1); }
public void Repo_Caln() { // TODO Non-standard tag. Apparently exists from FamilyTreeMaker? See Gene.Genie. Should convert to standard? // 20181025 Current behavior is to store as an 'unknown'. var txt = "0 @S1@ SOUR\n1 CALN blah\n"; var res = ReadIt(txt); Assert.AreEqual(1, res.Count); SourceRecord rec = res[0] as SourceRecord; Assert.IsNotNull(rec); Assert.AreEqual(1, rec.Unknowns.Count); Assert.AreEqual(2, rec.Unknowns[0].Beg); // TODO consider? //Assert.AreEqual(1,rec.Cits.Count); //Assert.AreEqual(1, rec.Cits[0].CallNums.Count); //Assert.AreEqual("blah", rec.Cits[0].CallNums[0].Number); }
private async Task <string> CreateElectronicSourceAsync(IBaseSource source, string userEmail = null) { var electronicSource = source as ElectronicSource; var publication = string.IsNullOrEmpty(electronicSource.Publication) ? string.Empty : $" // {electronicSource.Publication}"; var yearOfPulication = electronicSource.YearOfPublication == null ? string.Empty : $". – {electronicSource.YearOfPublication}."; var content = $"{electronicSource.ParseAuthor()}{electronicSource.WorkName} [Електронний ресурс]{electronicSource.ParseAllAuthors()}{publication}{yearOfPulication}" + $" – Режим доступу до ресурсу: {electronicSource.LinkToSource}"; var newSource = new SourceRecord { Content = content, Type = electronicSource.Type }; if (!string.IsNullOrEmpty(userEmail)) { await SaveSourceAsync(newSource, userEmail); } return(content); }
/// <summary> /// 在前台创建录播任务 /// </summary> public DownloadToken StartRecording(Channel channel, SourceRecord source, DateTimeOffset startTime, TimeSpan span) { // 注册相关信息 string identifer = channel.UniqueId + source.StationName + startTime.ToString("yyMMddHHmmss"); var schedule = RecordScheduleManager.CreateSchedule(identifer, source.Source.AbsoluteUri, startTime, span); var token = new DownloadToken() { Channel = channel, Source = source.StationName, LinkedSchedule = schedule }; _TaskList.Add(schedule.Key, token); TaskList.Add(token); // 开始任务 var diff = startTime.Subtract(DateTimeOffset.Now); if (diff > TimeSpan.FromMinutes(15)) { RecordScheduleManager.LaunchSchedule(schedule); new MessageDialog("由于系统原因,后台定时任务的精度为15分钟,为保证录下您指定的时间段,将提前15分钟开始录制,请预留足够的硬盘空间", "提示").ShowAsync(); } else { if (diff <= TimeSpan.Zero) { RecordScheduleManager.LaunchRecording(schedule); } else { // TODO: 由于ThreadPoolTimer会受到程序进入后台的影响,因此可以考虑在这里改用后台任务强行等待 new MessageDialog("由于系统不支持15分钟内的后台定时任务,请您在录制开始前将本程序保持开启并避免最小化!开始后即可关闭程序", "提示").ShowAsync(); ThreadPoolTimer.CreateTimer((timer) => RecordScheduleManager.LaunchRecording(schedule), diff); } } return(token); }
private async Task <string> CreatePeriodicalSourceAsync(IBaseSource source, string userEmail = null) { var periodicalSource = source as PeriodicalSource; var publication = string.IsNullOrEmpty(periodicalSource.Publication) ? string.Empty : $" // {periodicalSource.Publication}"; var yearOfPulication = periodicalSource.YearOfPublication == null ? string.Empty : $". – {periodicalSource.YearOfPublication}."; var periodicSelectionNumber = periodicalSource.PeriodicSelectionNumber == null ? string.Empty : $" – №{periodicalSource.PeriodicSelectionNumber}."; var pages = string.IsNullOrEmpty(periodicalSource.Pages) ? string.Empty : $" – C. {periodicalSource.Pages}."; var content = $"{periodicalSource.ParseAuthor()}{periodicalSource.WorkName}{periodicalSource.ParseAllAuthors()}{publication}{yearOfPulication}" + $"{periodicSelectionNumber}{pages}"; var newSource = new SourceRecord { Content = content, Type = periodicalSource.Type }; if (!string.IsNullOrEmpty(userEmail)) { await SaveSourceAsync(newSource, userEmail); } return(content); }
private async void OnSelectedProgramChanged() { //获得节目单,默认使用第一个可用的节目单源 var channel = SelectedProgram.ProgramInfo.Channel; Schedule = await TelevisionService.Instance.GetSchedule(channel); //更新收藏状况 IsCurrentChannelFavourite = CollectionService.Instance.CheckChannel(channel); LoveCurrentChannel.RaiseCanExecuteChanged(); IsCurrentProgramFavourite = CollectionService.Instance.CheckProgram(SelectedProgram.ProgramInfo); LoveCurrentProgram.RaiseCanExecuteChanged(); //选择默认来源 SelectedSource = SelectedProgram.MediaSources.First(); //展开侧面面板 ToggleSidePanel.RaiseCanExecuteChanged(); if (!_IsSidePanelExpaneded) { _IsSidePanelExpaneded = true; VisualStateManager.GoToState(Host, "SideExpanded", true); } }
private async Task <string> CreateDissertationSourceAsync(DissertationSource source, string userEmail = null) { var dissertationSource = source as DissertationSource; ValidateDissertationSource(dissertationSource); var placeOfPublication = string.IsNullOrEmpty(dissertationSource.PlaceOfPublication) ? string.Empty : $" - {dissertationSource.PlaceOfPublication}"; var yearOfPublication = dissertationSource.YearOfPublication == null ? string.Empty : $", {dissertationSource.YearOfPublication}"; var numberOfPages = dissertationSource.NumberOfPages == null ? string.Empty : $". - {dissertationSource.NumberOfPages} с"; var content = $"{dissertationSource.ParseAuthor()}{dissertationSource.WorkName}{dissertationSource.GetScientificDegree()}{dissertationSource.GetSpecialty()}" + $"{dissertationSource.ParseAllAuthors()}{placeOfPublication}{yearOfPublication}{numberOfPages}."; var newSource = new SourceRecord { Content = content, Type = dissertationSource.Type }; if (!string.IsNullOrEmpty(userEmail)) { await SaveSourceAsync(newSource, userEmail); } return(content); }
public RecordDialog(Channel channel, SourceRecord source) : this() { _channel = channel; _source = source; }
public async Task CreateSourceAsync(SourceRecord source) { await sources.AddAsync(source); }
public Result(SourceRecord source, ReverseGeocodeResult result) { Source = source; GeocodeResult = result; }