public void Update(Periodical periodical) { var current = GetBook(periodical.Id); current.PublishingHouse = context.PublishingHouses.Find(periodical.PublishingHouse.Id); context.Entry(current).CurrentValues.SetValues(periodical); }
private void InitPeriodical() { var p1 = new Periodical { Name = "Мурзилка", Foundation = new DateTime(1924, 06, 16), IsPublished = true, ISSN = "0132-1943", Type = PeriodicalType.magazine, PublishingHouse = context.PublishingHouses.Local.ElementAtOrDefault(0) }; var p2 = new Periodical { Name = "Фитиль", Foundation = new DateTime(1962, 07, 4), IsPublished = false, ISSN = "7777-8888", Type = PeriodicalType.newsreel, PublishingHouse = context.PublishingHouses.Local.ElementAtOrDefault(1) }; context.Periodicals.Add(p1); context.Periodicals.Add(p2); }
public ActionResult Create([Bind(Include = "Id,Name,Time_period_sec,LCode")] Periodical periodical) { if (User.Identity.Name == "") { throw new Exception("Access not denid"); } if (db.StaffPersons.Where(p => p.UserName == User.Identity.Name).First().AccessType != "Administrator") { throw new Exception("Access not denid"); } periodical.CreateUserName = periodical.ModifyUserName = User.Identity.Name; periodical.CreateDate = periodical.ModifyDate = DateTime.UtcNow; if (ModelState.IsValid) { db.Periodicals.Add(periodical); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(periodical)); }
public void TriggerPayloadPeriodicalNullTest() { Periodical periodical = new Periodical(); periodical = null; TriggerPayload periodicalpayload = new TriggerPayload(periodical); }
public PeriodicalDto(Periodical periodical) { Id = periodical.Id; Name = periodical.Name; Description = periodical.Description; Themes = periodical.Themes.ToDto().ToList(); }
public ActionResult DeleteConfirmed(int id) { Periodical periodical = (Periodical)db.ItemBases.Find(id); db.ItemBases.Remove(periodical); db.SaveChanges(); return(RedirectToAction("Index")); }
public int Create(Periodical periodical) { if (periodical != null && _unitOfWork.PeriodicalRepository.GetById(periodical.Id) == null) { _unitOfWork.PeriodicalRepository.Add(periodical); _unitOfWork.Save(); } return(periodical.Id); }
public ActionResult Edit([Bind(Include = "Id,Year,Title,Amount,Publisher,Version,Author")] Periodical periodical) { if (ModelState.IsValid) { db.Entry(periodical).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(periodical)); }
public bool Delete(Periodical deletedPeriodical) { if (deletedPeriodical != null && _unitOfWork.PeriodicalRepository.GetById(deletedPeriodical.Id) == null) { _unitOfWork.PeriodicalRepository.Delete(deletedPeriodical); _unitOfWork.Save(); return(true); } return(false); }
public bool Edit(Periodical editedPeriodical) { if (editedPeriodical != null && _unitOfWork.PeriodicalRepository.GetById(editedPeriodical.Id) == null) { _unitOfWork.PeriodicalRepository.Update(editedPeriodical); _unitOfWork.Save(); return(true); } return(false); }
public void WriteBook(string filename) { // Creates a new XmlSerializer. XmlSerializer mySerializer = new XmlSerializer(typeof(Library)); // Writing the file requires a StreamWriter. TextWriter myStreamWriter = new StreamWriter(filename); /* Creates an XmlSerializerNamespaces and adds prefixes and * namespaces to be used. */ XmlSerializerNamespaces myNamespaces = new XmlSerializerNamespaces(); myNamespaces.Add("books", "http://wwww.cpandl.com"); myNamespaces.Add("magazines", "http://www.proseware.com"); // Creates an instance of the class to be serialized. Library myLibrary = new Library(); // Creates two book objects. Book b1 = new Book(); b1.Title = "My Book Title"; b1.Author = "An Author"; b1.ISBN = "000000000"; b1.Publisher = "Microsoft Press"; Book b2 = new Book(); b2.Title = "Another Book Title"; b2.Author = "Another Author"; b2.ISBN = "00000001"; b2.Publisher = "Another Press"; /* Creates an array using the objects, and sets the Books property * to the array. */ Book[] myBooks = { b1, b2 }; myLibrary.Books = myBooks; // Creates two Periodical objects. Periodical per1 = new Periodical(); per1.Title = "My Magazine Title"; Periodical per2 = new Periodical(); per2.Title = "Another Magazine Title"; // Sets the Periodicals property to the array. Periodical[] myPeridocials = { per1, per2 }; myLibrary.Periodicals = myPeridocials; // Serializes the myLibrary object. mySerializer.Serialize(myStreamWriter, myLibrary, myNamespaces); myStreamWriter.Close(); }
public ActionResult Create([Bind(Include = "Id,Year,Title,Amount,Publisher,Version,Author")] Periodical periodical) { if (ModelState.IsValid) { db.ItemBases.Add(periodical); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(periodical)); }
public IEnumerable <ITextUnit> GetTextUnits(ComponentPart componentPart, Template template, Citation citation, out bool handled) { handled = false; if (componentPart == null) { return(null); } if (citation == null || citation.Reference == null) { return(null); } Periodical periodical = citation.Reference.Periodical; if (periodical == null) { return(null); } PeriodicalFieldElement periodicalFieldElement = componentPart.Elements.OfType <PeriodicalFieldElement>().FirstOrDefault() as PeriodicalFieldElement; if (periodicalFieldElement == null) { return(null); } bool found = false; TextUnitCollection textUnits = periodicalFieldElement.GetTextUnits(citation, template); if (textUnits == null) { return(null); } foreach (ITextUnit textUnit in textUnits) { if (textUnit.Text.Contains(" ")) { found = true; textUnit.Text = textUnit.Text.Replace(" ", "\u00A0"); } } if (found) { componentPart.Elements.ReplaceItem(periodicalFieldElement, textUnits.TextUnitsToLiteralElements(componentPart)); } return(null); }
private void Button_Click(object sender, RoutedEventArgs e) { var button = sender as Button; var tag = button.Tag as string; var tagInt = Convert.ToInt32(tag); switch (tagInt) { case 0: //Нажата кнопка "Добавить новое издание" addPeriodicalWindow = new AddPeriodicalWindow(); addPeriodicalWindow.DataChanged += AddPeriodicalWindow_DataChanged; addPeriodicalWindow.ShowDialog(); break; case 1: //Нажата кнопка "Добавить новый выпуск для выбранного издания" if (PeriodicalsDataGrid.SelectedItem != null) { Periodical currentPeriodical = (Periodical)PeriodicalsDataGrid.SelectedItem; addPeriodicalIssueWindow = new AddPeriodicalIssueWindow(currentPeriodical); addPeriodicalIssueWindow.DataChanged += AddPeriodicalIssueWindow_DataChanged; addPeriodicalIssueWindow.ShowDialog(); } else { MessageBox.Show("Выберите периодическое издание в таблице слева"); } break; case 2: //Нажата кнопка "Добавить экземпляр для выбранного издания и выпуска" if (PeriodicalIssuesDataGrid.SelectedItem != null) { PeriodicalIssue currentPeriodicalIssue = (PeriodicalIssue)PeriodicalIssuesDataGrid.SelectedItem; addPeriodicalItemWindow = new AddPeriodicalItemWindow(currentPeriodicalIssue); addPeriodicalItemWindow.DataChanged += AddPeriodicalItemWindow_DataChanged; addPeriodicalItemWindow.ShowDialog(); } else { MessageBox.Show("Выберите периодическое издание в таблице слева и выпуск периодического издания в таблице справа"); } break; case 3: //Нажата кнопка "Назад" Close(); break; } }
private void UpdatePeriodicalIssuesDataGrid() { const string GetIssuesByPeriodicalIDSqlQuery = "select * from [Coursework_2018].[dbo].[PeriodicalIssue] where PeriodicalID=@id"; if (PeriodicalsDataGrid.SelectedItem != null) { Periodical currentPeriodical = (Periodical)PeriodicalsDataGrid.SelectedItem; using (TheContext db = new TheContext()) { var periodicalIssues = db.PeriodicalIssues.SqlQuery(GetIssuesByPeriodicalIDSqlQuery, new SqlParameter("@id", currentPeriodical.PeriodicalID)).ToList(); PeriodicalIssuesDataGrid.ItemsSource = periodicalIssues; } } }
// GET: Periodicals/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Periodical periodical = (Periodical)db.ItemBases.Find(id); if (periodical == null) { return(HttpNotFound()); } return(View(periodical)); }
public static void ModifyCurrentReference(Reference reference, Periodical thePeriodical, string theYearString, string theVolumeString, string theNumberString, string thePagesString) { reference.Periodical = thePeriodical; reference.Year = theYearString; reference.Volume = theVolumeString; reference.Number = theNumberString; reference.PageRange = thePagesString; if (string.IsNullOrEmpty(reference.Date)) { reference.Date = theYearString; } reference.CustomField1 = ""; reference.CustomField2 = ""; }
public ActionResult DeleteConfirmed(int id) { if (User.Identity.Name == "") { throw new Exception("Access not denid"); } if (db.StaffPersons.Where(p => p.UserName == User.Identity.Name).First().AccessType != "Administrator") { throw new Exception("Access not denid"); } Periodical periodical = db.Periodicals.Find(id); db.Periodicals.Remove(periodical); db.SaveChanges(); return(RedirectToAction("Index")); }
//Метод для заполнения таблицы 'Типы периодических изданий' тестовыми значениями private void AutoInsertPeriodicals() { string[] typePeriodicals = new string[] { "Газета", "Журнал", "Ежегодник" , "Научный журнал", "Календари", "Реферативный сборник", "Библиографический указатель" , "Информационный бюллетень", "Справочник", "Литературный журнал" }; using (MailContext context = new MailContext()) { Periodical periodical = new Periodical(); foreach (string tp in typePeriodicals) { periodical.type_Edition = tp; context.Periodicals.Add(periodical); context.SaveChanges(); } } }
public void SetJson(string json) { var deserRes = JsonConvert.DeserializeObject <IEnumerable <GetPeriodicalResponseModel> >(json); if (deserRes == null) { return; } foreach (var periodical in deserRes) { db.PublishingHouses.Create(periodical.PublishingHouse); Periodical clearPeriodical = mapper.Map <Periodical>(periodical); int newPeriodicalId = db.Periodicals.Create(clearPeriodical); clearPeriodical = db.Periodicals.GetPeriodical(newPeriodicalId); foreach (var pe in periodical.PeriodicalEditions) { pe.Periodical = clearPeriodical; pe.Periodical_Id = newPeriodicalId; db.PeriodicalEditions.Create(pe); } } db.Save(); }
// GET: Periodicals/Edit/5 public ActionResult Edit(int?id) { if (User.Identity.Name == "") { throw new Exception("Access not denid"); } if (db.StaffPersons.Where(p => p.UserName == User.Identity.Name).First().AccessType != "Administrator") { throw new Exception("Access not denid"); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Periodical periodical = db.Periodicals.Find(id); if (periodical == null) { return(HttpNotFound()); } return(View(periodical)); }
public static void Main() { #region UserVariable string journalUrl = @"http://journal-abbreviations.library.ubc.ca/dump.php"; // URL for journal list text file #endregion if (Program.ProjectShells.Count == 0) { return; //no project open } Project activeProject = Program.ActiveProjectShell.Project; List <Periodical> journalCollection = new List <Periodical>(); string completeList; try { // Get list of journals from website Cursor.Current = Cursors.WaitCursor; DebugMacro.WriteLine("Reading list of journals from " + journalUrl); WebClient client = new WebClient(); Stream stream = client.OpenRead(journalUrl); StreamReader streamReader = new StreamReader(stream); completeList = streamReader.ReadToEnd(); } catch (Exception e) { Cursor.Current = Cursors.Default; DebugMacro.WriteLine("Could not read file from " + journalUrl + ": " + e.Message); return; } // split into individual Journals int counter = 0; int refCounter = 0; try { Cursor.Current = Cursors.WaitCursor; // prepare data completeList = Regex.Match(completeList, @"(<tbody>.*?<\\/tbody)").ToString(); completeList = Regex.Replace(completeList, @"\\/", @"/"); MatchCollection journals = Regex.Matches(completeList, "(?<=<tr>).*?(?=</tr>)"); DebugMacro.WriteLine("{0} journal entries found.", journals.Count.ToString()); DebugMacro.WriteLine("Parsing entries ..."); foreach (Match journalAndAbbrev in journals) { string journalTitle = String.Empty; string abbreviation1 = String.Empty; // this one should have full stops string abbreviation2 = String.Empty; // this one shouldn't string abbreviation3; // this one should be any all uppercase acronym after a colon in JournalTitl MatchCollection journalData = Regex.Matches(journalAndAbbrev.ToString(), "(?<=<td>).*?(?=</td>)"); if (journalData.Count < 2) { continue; } abbreviation1 = journalData[0].Value; journalTitle = Regex.Replace(journalData[1].Value, @"\bfur\b", "für"); // generate abbreviation2 by removing full stops from abbreviation1 string[] abbreviation1Words = abbreviation1.Split(' '); for (int i = 0; i < abbreviation1Words.Length; i++) { abbreviation1Words[i] = abbreviation1Words[i].TrimEnd('.'); } abbreviation2 = String.Join(" ", abbreviation1Words); // try to establish Abbreviation3 abbreviation3 = Regex.Match(journalTitle, @"(?:: )[A-Z]{2,6}$").ToString(); Periodical journal = new Periodical(activeProject, journalTitle); if (!String.IsNullOrEmpty(abbreviation1)) { journal.StandardAbbreviation = abbreviation1; } if (!String.IsNullOrEmpty(abbreviation2)) { journal.UserAbbreviation1 = abbreviation2; } if (!String.IsNullOrEmpty(abbreviation3)) { journal.UserAbbreviation2 = abbreviation3; } journalCollection.Add(journal); } DialogResult updateReferences = MessageBox.Show( @"Would you like to update journal information for references in current selection (all references if no selection is active)?", "Citavi Macro", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); // update references that have identical titles if (updateReferences == DialogResult.Yes) { List <Reference> references = Program.ActiveProjectShell.PrimaryMainForm.GetFilteredReferences(); foreach (Reference reference in references) { if (reference.Periodical == null) { continue; } if (journalCollection.Any(item => item.Name == reference.Periodical.Name) && !String.IsNullOrEmpty(reference.Periodical.Name)) { reference.Periodical = journalCollection.Where(item => item.Name == reference.Periodical.Name).FirstOrDefault(); refCounter++; } } activeProject.Periodicals.AddRange(journalCollection); } else { activeProject.Periodicals.AddRange(journalCollection); } } catch (Exception e) { Cursor.Current = Cursors.Default; DebugMacro.WriteLine("An error occurred importing the journal data: " + e.ToString()); return; } finally { Cursor.Current = Cursors.Default; var saveOptions = new DesktopDatabaseSaveOptions(); saveOptions.ForceMultiUserUpdate = true; activeProject.Save(saveOptions); Cursor.Current = Cursors.Default; if (journalCollection != null) { MessageBox.Show(journalCollection.Count.ToString() + " journal(s) were imported (not counting duplicates)\n " + refCounter.ToString() + " reference(s) were changed.", "Citavi", MessageBoxButtons.OK, MessageBoxIcon.Information); journalCollection = null; } } } //end Main()
public static void CreateNewReference(Project activeProject, IList <Person> organizationsList, Reference reference, Periodical thePeriodical, string theYearString, string theVolumeString, string theNumberString, string thePagesString) { Reference newReference = new Reference(activeProject, ReferenceType.CourtDecision, ""); newReference.Organizations.Add(organizationsList[0]); newReference.Title = reference.Title; newReference.CitationKey = reference.CitationKey; newReference.Periodical = thePeriodical; newReference.Date = reference.Date; newReference.Year = theYearString; newReference.Volume = theVolumeString; newReference.SpecificField2 = reference.SpecificField2; newReference.Number = theNumberString; newReference.PageRange = thePagesString; newReference.CustomField4 = reference.CustomField4; activeProject.References.Add(newReference); }
public static void ParseReporters(Project project, List <Reference> listSelectedReferences) { string stringDateIn = string.Empty; DateTime dateTimeDate; string stringDateTimeYear = string.Empty; string stringDateTimeMonth = string.Empty; string stringDateTimeDay = string.Empty; string stringDateOut = string.Empty; CultureInfo provider = CultureInfo.InvariantCulture; List <string> neutralReportersCanadaList = new List <string> { "SCC", "CSC", "FC", "CF", "FCA", "CAF", "TCC", "CTC", "CMAC", "CACM", "Comp. Trib.", "Trib. Comp.", "CHRT", "TCDP", "PSSRB", "ABCA", "ABQB", "ABPC", "ABASC", "BCCA", "BCSC", "BCPC", "BCHRT", "BCSECCOM", "MBCA", "MBQB", "MBPC", "NBCA", "NBQB", "NBPC", "NFCA", "NLSCTD", "NSCA", "NSSC", "NSSF", "NSPC", "NSUARB", "NSBS", "NWTCA", "NWTSC", "NWTTC", "NUCJ", "NUCA", "ONCA", "ONSC", "ONCJ", "ONSWIAT", "ONLSAP", "ONLSHP", "PESCAD", "PESCTD", "QCCA", "QCSC", "QCCP", "QCTP", "CMQC", "QCCRT", "SKCA", "SKQB", "SKPC", "SKAIA", "YKCA", "YKSC", "YKTC", "YKSM", "YKYC", // Not actual Canadian Neutral Reporters, but reporters that follow the same format "S.L.T.", "S.C. (H.L.)" }; foreach (Reference reference in listSelectedReferences) { if (reference.ReferenceType == ReferenceType.CourtDecision) { stringDateIn = reference.Date; string[] formats = new string[] { "dd MMMM yyyy", "d MMMM yyyy", "d MMM yyyy", "d MMM yy", "yyyy MMMM dd", "yyyy MMMM d", "dd/MM/yyyy", "d/MM/yyyy", "d/M/yyyy" }; if (DateTime.TryParseExact(stringDateIn, formats, CultureInfo.InvariantCulture, //TODO: may be you want CultureInfo.CurrentCulture DateTimeStyles.AssumeLocal, out dateTimeDate)) { stringDateTimeYear = dateTimeDate.Year.ToString(); if (dateTimeDate.Month > 9) { stringDateTimeMonth = dateTimeDate.Month.ToString(); } else { stringDateTimeMonth = "0" + dateTimeDate.Month.ToString(); } if (dateTimeDate.Day > 9) { stringDateTimeDay = dateTimeDate.Day.ToString(); } else { stringDateTimeDay = "0" + dateTimeDate.Day.ToString(); } stringDateOut = stringDateTimeYear + "-" + stringDateTimeMonth + "-" + stringDateTimeDay; reference.Date = stringDateOut; } else { // log error: parsing fails } string jurisdiction = string.Empty; Periodical newPeriodical = new Periodical(project, ""); IList <Person> organizationsList = reference.Organizations as IList <Person>; Person court = organizationsList.FirstOrDefault(); if (court != null) { jurisdiction = court.LastNameForSorting; } string thePreferredReporterString = reference.CustomField1; string theAdditionalReporterString = reference.CustomField2; reference.Title = reference.Title.Replace(" v ", " v. "); reference.Title = reference.Title.Replace("Inc", "Inc."); reference.Title = reference.Title.Replace("Ltd", "Ltd."); reference.Title = reference.Title.Replace("Plc", "Plc."); reference.Title = reference.Title.Replace("..", "."); List <string> thePreferredReporterList = reference.CustomField1.Split(new string[] { " and ", "; " }, StringSplitOptions.None).ToList(); List <string> theAdditionalReporterList = reference.CustomField1.Split(new string[] { " and ", "; " }, StringSplitOptions.None).ToList(); List <string> theParallelReporterList = reference.TitleSupplement.Split(new string[] { " and ", "; " }, StringSplitOptions.None).ToList(); List <string> allReportersList = thePreferredReporterList.Concat(theAdditionalReporterList).Concat(theParallelReporterList).ToList(); int i = 0; foreach (string theReporterString in allReportersList) { if (string.IsNullOrEmpty(theReporterString)) { continue; } string thePagesString = String.Empty; string thePeriodicalString = String.Empty; string theNumberString = String.Empty; string theYearString = String.Empty; string theVolumeString = String.Empty; string theYearOrVolumeString = String.Empty; List <string> theReporterList = theReporterString.Split(new string[] { " " }, StringSplitOptions.None).ToList(); List <string> thePeriodicalList = new List <string>(); List <string> theYearVolumeNumberAndPagesList = new List <string>(); foreach (string substring in theReporterList) { if (IsPeriodical(substring)) { thePeriodicalList.Add(substring); } else { theYearVolumeNumberAndPagesList.Add(substring); } } thePeriodicalString = String.Join(" ", thePeriodicalList); bool neutralReporterCanadaBool = neutralReportersCanadaList.Any(thePeriodicalString.Contains); if (neutralReporterCanadaBool) { theYearString = theYearVolumeNumberAndPagesList.FirstOrDefault(); } else { theYearOrVolumeString = theYearVolumeNumberAndPagesList.FirstOrDefault(); if (IsDateYear(theYearOrVolumeString)) { theYearOrVolumeString = theYearVolumeNumberAndPagesList[1]; } if (IsYear(theYearOrVolumeString)) { Regex regex = new Regex("\\[([0-9]*?)\\]"); var v = regex.Match(theYearOrVolumeString); theYearString = v.Groups[1].ToString(); } else { theVolumeString = theYearOrVolumeString; } } if (theYearVolumeNumberAndPagesList.Count > 2 && !IsDateYear(theYearOrVolumeString)) { theNumberString = theYearVolumeNumberAndPagesList[1]; } thePagesString = theYearVolumeNumberAndPagesList.LastOrDefault(); List <string> messageList = new List <string> { "i: [", i.ToString(), "]\n", "Reporters: ", String.Join(", ", allReportersList), "\n", "Periodical: ", thePeriodicalString, "\n", "Periodical Year: ", theYearString, "\n", "Periodical Volume: ", theVolumeString, "\n", "Periodical Number: ", theNumberString, "\n", "Pages: ", thePagesString }; Periodical thePeriodical = new Periodical(project, thePeriodicalString); foreach (Periodical periodical in project.Periodicals) { if (thePeriodicalString == periodical.StandardAbbreviation) { thePeriodical = periodical; break; } } if (i == 0) { MessageBox.Show(String.Join("", messageList)); if (reference.Periodical == null) { ModifyCurrentReference(reference, thePeriodical, theYearString, theVolumeString, theNumberString, thePagesString); } else { CreateNewReference(project, organizationsList, reference, thePeriodical, theYearString, theVolumeString, theNumberString, thePagesString); } } else { MessageBox.Show(String.Join("", messageList)); CreateNewReference(project, organizationsList, reference, thePeriodical, theYearString, theVolumeString, theNumberString, thePagesString); } i = i + 1; } // end foreach (string theReporterString in allReportersList) reference.TitleSupplement = ""; } } }
private void Button_Click(object sender, RoutedEventArgs e) { var button = sender as Button; var tag = button.Tag as string; var tagInt = Convert.ToInt32(tag); switch (tagInt) { case 0: //Нажата кнопка "Искать периодическое издание по названию" if (PeriodicalNameTextBox.Text != "") { using (TheContext db = new TheContext()) { var periodicals = db.Periodicals.SqlQuery( "select * from[Coursework_2018].[dbo].[Periodical] where PeriodicalName like @name", new SqlParameter("@name", $"%{PeriodicalNameTextBox.Text}%") ).ToList(); PeriodicalsDataGrid.ItemsSource = periodicals; } } else { //Вывод окна с сообщением и вывод в DataGrid всей периодики из БД MessageBoxResult result = MessageBox.Show("Введите данные для поиска."); AllPeriodicals(); } PeriodicalItemsDataGrid.ItemsSource = null; PeriodicalIssuesDataGrid.ItemsSource = null; break; case 1: //Нажата кнопка "Искать выпуск периодического издания по номеру" if (IssueNumberTextBox.Text != "") { if (PeriodicalsDataGrid.SelectedItem != null) { using (TheContext db = new TheContext()) { Periodical currentPeriodical = (Periodical)PeriodicalsDataGrid.SelectedItem; List <PeriodicalIssue> periodicalIssues = null; bool flag = true; try { periodicalIssues = db.PeriodicalIssues.SqlQuery( @"select * from [Coursework_2018].[dbo].[PeriodicalIssue] where PeriodicalID=@periodicalID and IssueNumber=@issueNumber", new SqlParameter("@periodicalID", currentPeriodical.PeriodicalID), new SqlParameter("@issueNumber", Convert.ToInt32(IssueNumberTextBox.Text)) ).ToList(); } catch (FormatException) { flag = false; IssueNumberTextBox.Text = ""; MessageBox.Show("Номер выпуска должен быть числом."); } if (flag == true) { PeriodicalIssuesDataGrid.ItemsSource = periodicalIssues; } } } else { MessageBoxResult result = MessageBox.Show("Выберите периодическое издание."); } } else { //Вывод окна с сообщением и вывод в DataGrid всей периодики из БД MessageBoxResult result = MessageBox.Show("Введите данные для поиска."); AllPeriodicals(); } PeriodicalItemsDataGrid.ItemsSource = null; break; case 2: //Нажата кнопка "Назад" Close(); break; } }
public static void Run(PeriodicalList periodicalList) { var project = periodicalList.Project; var journalUrl = @"http://ftp.ncbi.nih.gov/pubmed/J_Entrez.txt"; // URL for journal list text file var journalCollection = new List <Periodical>(); string completeList; try { Cursor.Current = Cursors.WaitCursor; using (var webClient = new WebClient2() { Timeout = 60000 }) { using (var stream = webClient.OpenRead(journalUrl)) { using (var streamReader = new StreamReader(stream)) { completeList = streamReader.ReadToEnd(); } } } } catch (Exception e) { Cursor.Current = Cursors.Default; MessageBox.Show(periodicalList, ImportJournalsResources.PubMedMacroReadErrorMessage.FormatString(journalUrl, e.Message), periodicalList.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { Cursor.Current = Cursors.WaitCursor; var entrySplitters = new string[] { @"--------------------------------------------------------" }; var individualJournalEntries = completeList.Split(entrySplitters, StringSplitOptions.RemoveEmptyEntries).ToList(); var counter = 0; var splitEntry = new Regex(@"^(?:JrId: )(?<JournalId>\d+?)(?:\nJournalTitle: )(?<JournalTitle>.*?)(?:\nMedAbbr: )(?<Abbreviation2>.*?)(?:\nISSN \(Print\): )(?<IssnPrint>.*?)(?:\nISSN \(Online\): )(?<IssnOnline>.*?)(?:\nIsoAbbr: )(?<Abbreviation1>.*?)(?:\nNlmId: )(?<NlmId>.*?)$", RegexOptions.CultureInvariant | RegexOptions.Compiled | RegexOptions.Multiline); foreach (string journalEntry in individualJournalEntries) { counter++; string journalTitle; string abbreviation1; string abbreviation2; string abbreviation3; string issnPrint; string issnOnline; string nlmId; var match = splitEntry.Match(journalEntry); journalTitle = match.Groups["JournalTitle"].Value; abbreviation1 = match.Groups["Abbreviation1"].Value; abbreviation2 = match.Groups["Abbreviation2"].Value; issnPrint = match.Groups["IssnPrint"].Value; issnOnline = match.Groups["IssnOnline"].Value; nlmId = match.Groups["NlmId"].Value; if (string.IsNullOrEmpty(abbreviation1)) { abbreviation1 = abbreviation2; } if (!abbreviation1.Contains(".") && !String.IsNullOrEmpty(abbreviation1)) { var journalTitleWords = journalTitle.ToLowerInvariant().Split(new char[] { ' ', '.', ';', ',', ':', '&', '-' }, StringSplitOptions.RemoveEmptyEntries); var abbreviation1Words = abbreviation1.Split(' '); var abbreviation1WithFullStops = new List <string>(); foreach (var word in abbreviation1Words) { if (word.StartsWith("(") || word.EndsWith(")")) { abbreviation1WithFullStops.Add(word); } else if (!Array.Exists(journalTitleWords, x => x == word.ToLowerInvariant())) { abbreviation1WithFullStops.Add(word + "."); } else { abbreviation1WithFullStops.Add(word); } } abbreviation1 = string.Join(" ", abbreviation1WithFullStops); } abbreviation3 = Regex.Match(journalTitle, @"(?:: )[A-Z]{2,6}$").ToString(); var journal = new Periodical(project, journalTitle); if (!string.IsNullOrEmpty(abbreviation1)) { journal.StandardAbbreviation = abbreviation1; } if (!string.IsNullOrEmpty(abbreviation2)) { journal.UserAbbreviation1 = abbreviation2; } if (!string.IsNullOrEmpty(abbreviation3)) { journal.UserAbbreviation2 = abbreviation3; } if (!string.IsNullOrEmpty(issnPrint) && IssnValidator.IsValid(issnPrint)) { journal.Issn = issnPrint; } else if (!string.IsNullOrEmpty(issnOnline) && IssnValidator.IsValid(issnOnline)) { journal.Issn = issnOnline; } if (!string.IsNullOrEmpty(issnPrint) && IssnValidator.IsValid(issnPrint) && !string.IsNullOrEmpty(issnOnline) && IssnValidator.IsValid(issnOnline)) { journal.Notes = "ISSN (Online): " + issnOnline; } if (!string.IsNullOrEmpty(nlmId)) { journal.Notes = journal.Notes + "\nNlmID: " + nlmId; } journalCollection.Add(journal); } project.Periodicals.AddRange(journalCollection); } catch (Exception exception) { Cursor.Current = Cursors.Default; journalCollection = null; MessageBox.Show(periodicalList, ImportJournalsResources.MacroImportingErrorMessage.FormatString(exception.Message), periodicalList.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { Cursor.Current = Cursors.Default; if (journalCollection != null) { MessageBox.Show(periodicalList, ImportJournalsResources.PubMedMacroResultMessage.FormatString(journalCollection.Count.ToString()), periodicalList.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); journalCollection = null; } } }
public static void Main() { if (Program.ProjectShells.Count == 0) { return; //no project open } Project activeProject = Program.ActiveProjectShell.Project; string fileName = null; List <Periodical> journalCollection = new List <Periodical>(); try { // Dialog zum Auswählen des gewünschten Ordners einblenden OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Text Dateien (*.txt)|*.txt|Alle Dateien (*.*)|*.*"; openFileDialog.Title = "Wählen Sie die zu importierende Zeitschriften-Datei aus (Text-Format)"; if (openFileDialog.ShowDialog() == DialogResult.OK) { fileName = openFileDialog.FileName; } else { return; } //Hourglass or other wait cursor Cursor.Current = Cursors.WaitCursor; Encoding enc = GetFileEncoding(fileName); StreamReader streamReader = new StreamReader(fileName, enc); string journalList = streamReader.ReadToEnd(); streamReader.Close(); //We check for certain non-printable chars to ensure we are dealing with a "text file" Regex testRegex = new Regex("[\x00-\x1f-[\t\n\r]]", RegexOptions.CultureInvariant | RegexOptions.Compiled); if (testRegex.IsMatch(journalList)) { //this is most likely not a textfile Cursor.Current = Cursors.Default; MessageBox.Show("Diese Datei enthält ungültige Zeichen und kann daher nicht importiert werden.", "Citavi", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } Regex matchRegex = new Regex( @"^(?<FullName>[^#=;|\t\n]+?)(?: *[#=;|\t] *(?<Abbreviation1>[^#=;|\t\n]*))?(?: *[#=;|\t] *(?<Abbreviation2>[^#=;|\t\n]*))?(?: *[#=;|\t] *(?<Abbreviation3>[^#=;|\t\n]*))?(?: *[#=;|\t] *(?<ISSN>[^#=;|\t\n]*))??$", RegexOptions.CultureInvariant | RegexOptions.Compiled | RegexOptions.Multiline //IMPORTANT! ); //// Capture all matches in the journalList MatchCollection ms = matchRegex.Matches(journalList); //MessageBox.Show("Insgesamt sind " + ms.Count.ToString() + " Treffer gefunden worden."); foreach (Match m in ms) { if (string.IsNullOrEmpty(m.Groups["FullName"].Value)) { continue; } Periodical journal = new Periodical(activeProject, m.Groups["FullName"].Value); if (!string.IsNullOrEmpty(m.Groups["Abbreviation1"].Value)) { journal.StandardAbbreviation = m.Groups["Abbreviation1"].Value; } if (!string.IsNullOrEmpty(m.Groups["Abbreviation2"].Value)) { journal.UserAbbreviation1 = m.Groups["Abbreviation2"].Value; } if (!string.IsNullOrEmpty(m.Groups["Abbreviation3"].Value)) { journal.UserAbbreviation2 = m.Groups["Abbreviation3"].Value; } string sISSN = ""; if (!string.IsNullOrEmpty(m.Groups["ISSN"].Value)) { sISSN = m.Groups["ISSN"].Value; if (IsValidISSN(sISSN)) { journal.Issn = sISSN; } } journalCollection.Add(journal); } activeProject.Periodicals.AddRange(journalCollection); //activeProject.Journals.AddRangeBound(journalCollection); } catch (Exception exception) { Cursor.Current = Cursors.Default; MessageBox.Show(exception.ToString(), "Citavi", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { Cursor.Current = Cursors.Default; if (journalCollection != null) { MessageBox.Show("Es wurde(n) " + journalCollection.Count.ToString() + " Zeitschrift(en) eingelesen. \n(Dubletten wurden unterdrückt.)", "Citavi", MessageBoxButtons.OK, MessageBoxIcon.Information); journalCollection = null; } } } //end Main()
public IEnumerable <ITextUnit> GetTextUnits(ComponentPart componentPart, Template template, Citation citation, out bool handled) { //Change this to .PeriodSpace, .PeriodOnly, .SpaceOnly or .NoPeriodNoSpace if required //[1] Period/space (Intl. J. History) - DEFAULT //[2] Space only (Intl J History) //[3] Period only (Intl.J.Histry) //[4] No period, no space (IntlJHistory) PeriodicalAbbreviationOutputStyle outputStyle = PeriodicalAbbreviationOutputStyle.SpaceOnly; handled = false; if (citation == null) { return(null); } Reference reference = citation.Reference; if (reference == null) { return(null); } if (!citation.Reference.HasCoreField(ReferenceTypeCoreFieldId.Periodical)) { return(null); } Periodical periodical = reference.Periodical; if (periodical == null) { return(null); } if (componentPart == null) { return(null); } if (componentPart.Elements == null || componentPart.Elements.Count == 0) { return(null); } var firstPeriodicalFieldElement = componentPart.Elements.FirstOrDefault <IElement>(element => element is PeriodicalFieldElement) as PeriodicalFieldElement; if (firstPeriodicalFieldElement == null) { return(null); } PeriodicalNameUsage nameUsage = firstPeriodicalFieldElement.PeriodicalNameUsage; if (nameUsage == PeriodicalNameUsage.Name) { return(null); //if the PeriodicalFieldElement is set to ignore abbreviations, we exit here } if (nameUsage == PeriodicalNameUsage.UserAbbreviation2) { return(null); //ditto für UserAbbreviation2, Abkürzung 3 } string abbreviation = String.Empty; string periodicalName = periodical.Name; #region Determine Abbreviation if (nameUsage == PeriodicalNameUsage.StandardAbbreviation) { if (!string.IsNullOrEmpty(periodical.StandardAbbreviation)) { //Wenn das gewählte Feld [Abkürzung 1 bzw. 2] bei einer Zeitschrift gefüllt ist, muss das Skript nicht tätig werden, //sondern der Eintrag wird einfach ausgegeben. return(null); } else if (!string.IsNullOrEmpty(periodical.UserAbbreviation1)) { //Wenn das gewählte Feld [Abkürzung 1 bzw. 2] bei einer Zeitschrift leer ist, das gegenläufige Abkürzungsfeld (1 vs. 2) aber gefüllt, //dann soll das Skript das entsprechende Format generieren. abbreviation = periodical.UserAbbreviation1; } } else if (nameUsage == PeriodicalNameUsage.UserAbbreviation1) { if (!string.IsNullOrEmpty(periodical.UserAbbreviation1)) { //Wenn das gewählte Feld [Abkürzung 1 bzw. 2] bei einer Zeitschrift gefüllt ist, muss das Skript nicht tätig werden, //sondern der Eintrag wird einfach ausgegeben. return(null); } else if (!string.IsNullOrEmpty(periodical.StandardAbbreviation)) { abbreviation = periodical.StandardAbbreviation; } } #endregion //Wenn beide Felder Abkürzung 1 und 2 leer sind, kann und darf das Skript nicht tätig werden. //Wenn dann die Checkbox "Automatisch zurückfallen auf den nächsten verfügbaren Namen" aktiviert ist, wird der vollständige Zeitschriftenname ausgegeben. //Wenn nicht, hängt das Verhalten ja davon ab, ob bei der Komponente das Häkchen vor "Dieses Feld darf nicht leer sein" gesetzt ist, //dementsprechend erscheint ggf. ein Hinweistext oder eben auch nicht. if (string.IsNullOrEmpty(abbreviation)) { return(null); } string[] periodicalNameWords = periodicalName.ToLowerInvariant().Split(new char[] { ' ', '.', ';', ',', ':', '&', '-' }, StringSplitOptions.RemoveEmptyEntries); string[] abbreviationWords = abbreviation.Split(new string[] { " ", " ", " " }, StringSplitOptions.RemoveEmptyEntries); //string[] abbreviationWords = abbreviation.Split(' '); if (!abbreviation.Contains(".")) { List <string> abbreviationWithFullStops = new List <string>(); foreach (string word in abbreviationWords) { if (word.StartsWith("(") || word.EndsWith(")")) { abbreviationWithFullStops.Add(word); } else if (!Array.Exists(periodicalNameWords, x => x == word.ToLowerInvariant())) { abbreviationWithFullStops.Add(word + "."); } else { abbreviationWithFullStops.Add(word); } } abbreviationWords = abbreviationWithFullStops.ToArray(); } string[] wordsWithoutPeriod = new String[abbreviationWords.Length]; abbreviationWords.CopyTo(wordsWithoutPeriod, 0); for (int i = 0; i < wordsWithoutPeriod.Length; i++) { wordsWithoutPeriod[i] = wordsWithoutPeriod[i].TrimEnd('.'); } var outputTextElement = new LiteralElement(componentPart, abbreviation); outputTextElement.FontStyle = firstPeriodicalFieldElement.FontStyle; switch (outputStyle) { case PeriodicalAbbreviationOutputStyle.PeriodOnly: outputTextElement.Text = string.Join("", abbreviationWords); break; case PeriodicalAbbreviationOutputStyle.PeriodSpace: outputTextElement.Text = string.Join(" ", abbreviationWords); break; case PeriodicalAbbreviationOutputStyle.SpaceOnly: outputTextElement.Text = string.Join(" ", wordsWithoutPeriod); break; case PeriodicalAbbreviationOutputStyle.NoPeriodNoSpace: outputTextElement.Text = string.Join("", wordsWithoutPeriod); break; } componentPart.Elements.ReplaceItem(firstPeriodicalFieldElement, outputTextElement); return(null); }
public static void Run(PeriodicalList periodicalList) { var journalUrl = @"http://journal-abbreviations.library.ubc.ca/dump.php"; var project = periodicalList.Project; var journalCollection = new List <Periodical>(); string completeList; try { Cursor.Current = Cursors.WaitCursor; using (var webClient = new WebClient()) { using (var stream = webClient.OpenRead(journalUrl)) { using (var streamReader = new StreamReader(stream)) { completeList = streamReader.ReadToEnd(); } } } } catch (Exception e) { Cursor.Current = Cursors.Default; MessageBox.Show(periodicalList, ImportJournalsResources.PubMedMacroReadErrorMessage.FormatString(journalUrl, e.Message), periodicalList.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var refCounter = 0; try { Cursor.Current = Cursors.WaitCursor; completeList = Regex.Match(completeList, @"(<tbody>.*?<\\/tbody)").ToString(); completeList = Regex.Replace(completeList, @"\\/", @"/"); var journals = Regex.Matches(completeList, "(?<=<tr>).*?(?=</tr>)"); foreach (var journalAndAbbrev in journals) { var journalTitle = string.Empty; var abbreviation1 = string.Empty; // this one should have full stops var abbreviation2 = string.Empty; // this one shouldn't var abbreviation3 = string.Empty; // this one should be any all uppercase acronym after a colon in JournalTitl var journalData = Regex.Matches(journalAndAbbrev.ToString(), "(?<=<td>).*?(?=</td>)"); if (journalData.Count < 2) { continue; } abbreviation1 = journalData[0].Value; journalTitle = Regex.Replace(journalData[1].Value, @"\bfur\b", "für"); // generate abbreviation2 by removing full stops from abbreviation1 var abbreviation1Words = abbreviation1.Split(' '); for (int i = 0; i < abbreviation1Words.Length; i++) { abbreviation1Words[i] = abbreviation1Words[i].TrimEnd('.'); } abbreviation2 = String.Join(" ", abbreviation1Words); // try to establish Abbreviation3 abbreviation3 = Regex.Match(journalTitle, @"(?:: )[A-Z]{2,6}$").ToString(); Periodical journal = new Periodical(project, journalTitle); if (!String.IsNullOrEmpty(abbreviation1)) { journal.StandardAbbreviation = abbreviation1; } if (!String.IsNullOrEmpty(abbreviation2)) { journal.UserAbbreviation1 = abbreviation2; } if (!String.IsNullOrEmpty(abbreviation3)) { journal.UserAbbreviation2 = abbreviation3; } journalCollection.Add(journal); } DialogResult updateReferences = MessageBox.Show(periodicalList, ImportJournalsResources.WoodwardMacroUpdateMessage, periodicalList.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (updateReferences == DialogResult.Yes) { var references = Program.ActiveProjectShell.PrimaryMainForm.GetFilteredReferences(); foreach (var reference in references) { if (reference.Periodical == null) { continue; } if (journalCollection.Any(item => item.Name == reference.Periodical.Name) && !String.IsNullOrEmpty(reference.Periodical.Name)) { reference.Periodical = journalCollection.Where(item => item.Name == reference.Periodical.Name).FirstOrDefault(); refCounter++; } } project.Periodicals.AddRange(journalCollection); } else { project.Periodicals.AddRange(journalCollection); } } catch (Exception e) { Cursor.Current = Cursors.Default; journalCollection = null; MessageBox.Show(periodicalList, ImportJournalsResources.MacroImportingErrorMessage.FormatString(e.Message), periodicalList.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { Cursor.Current = Cursors.Default; if (journalCollection != null) { MessageBox.Show(periodicalList, ImportJournalsResources.WoodwardMacroResultMessage.FormatString(journalCollection.Count, refCounter), periodicalList.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); journalCollection = null; } } }
public static void Main() { #region UserVariable string journalUrl = @"ftp://ftp.ncbi.nih.gov/pubmed/J_Entrez.txt"; // URL for journal list text file #endregion if (Program.ProjectShells.Count == 0) { return; //no project open } Project activeProject = Program.ActiveProjectShell.Project; List <Periodical> journalCollection = new List <Periodical>(); string completeList; try { // Get list of journals from website Cursor.Current = Cursors.WaitCursor; DebugMacro.WriteLine("Reading list of journals from " + journalUrl); WebClient client = new WebClient(); Stream stream = client.OpenRead(journalUrl); StreamReader streamReader = new StreamReader(stream); completeList = streamReader.ReadToEnd(); } catch (Exception e) { Cursor.Current = Cursors.Default; DebugMacro.WriteLine("Could not read file from " + journalUrl + ": " + e.Message); return; } // split into individual Journals try { Cursor.Current = Cursors.WaitCursor; string[] entrySplitters = { @"--------------------------------------------------------" }; List <string> individualJournalEntries = new List <string>(completeList.Split(entrySplitters, StringSplitOptions.RemoveEmptyEntries)); DebugMacro.WriteLine("{0} journal entries found.", individualJournalEntries.Count.ToString()); DebugMacro.WriteLine("Parsing entries ..."); int counter = 0; Regex splitEntry = new Regex(@"^(?:JrId: )(?<JournalId>\d+?)(?:\nJournalTitle: )(?<JournalTitle>.*?)(?:\nMedAbbr: )(?<Abbreviation2>.*?)(?:\nISSN \(Print\): )(?<IssnPrint>.*?)(?:\nISSN \(Online\): )(?<IssnOnline>.*?)(?:\nIsoAbbr: )(?<Abbreviation1>.*?)(?:\nNlmId: )(?<NlmId>.*?)$", RegexOptions.CultureInvariant | RegexOptions.Compiled | RegexOptions.Multiline); foreach (string journalEntry in individualJournalEntries) { counter++; string journalTitle; string abbreviation1; // this one should have full stops string abbreviation2; // this one shouldn't string abbreviation3; // this one should be any all uppercase acronym after a colon in JournalTitle string issnPrint; string issnOnline; string nlmId; // split into fields Match m = splitEntry.Match(journalEntry); //if (String.IsNullOrEmpty(m.Groups["JournalId"].Value)) continue; // nothing here journalTitle = m.Groups["JournalTitle"].Value; abbreviation1 = m.Groups["Abbreviation1"].Value; abbreviation2 = m.Groups["Abbreviation2"].Value; issnPrint = m.Groups["IssnPrint"].Value; // to be validated issnOnline = m.Groups["IssnOnline"].Value; nlmId = m.Groups["NlmId"].Value; // check format of abbreviation1 if (String.IsNullOrEmpty(abbreviation1)) { abbreviation1 = abbreviation2; } if (!abbreviation1.Contains(".") && !String.IsNullOrEmpty(abbreviation1)) { string[] journalTitleWords = journalTitle.ToLowerInvariant().Split(new char[] { ' ', '.', ';', ',', ':', '&', '-' }, StringSplitOptions.RemoveEmptyEntries); string[] abbreviation1Words = abbreviation1.Split(' '); List <string> abbreviation1WithFullStops = new List <string>(); foreach (string word in abbreviation1Words) { if (word.StartsWith("(") || word.EndsWith(")")) { abbreviation1WithFullStops.Add(word); } else if (!Array.Exists(journalTitleWords, x => x == word.ToLowerInvariant())) { abbreviation1WithFullStops.Add(word + "."); } else { abbreviation1WithFullStops.Add(word); } } abbreviation1 = String.Join(" ", abbreviation1WithFullStops); } // try to establish Abbreviation3 abbreviation3 = Regex.Match(journalTitle, @"(?:: )[A-Z]{2,6}$").ToString(); Periodical journal = new Periodical(activeProject, journalTitle); if (!String.IsNullOrEmpty(abbreviation1)) { journal.StandardAbbreviation = abbreviation1; } if (!String.IsNullOrEmpty(abbreviation2)) { journal.UserAbbreviation1 = abbreviation2; } if (!String.IsNullOrEmpty(abbreviation3)) { journal.UserAbbreviation2 = abbreviation3; } if (!string.IsNullOrEmpty(issnPrint) && IsValidISSN(issnPrint)) { journal.Issn = issnPrint; } else if (!string.IsNullOrEmpty(issnOnline) && IsValidISSN(issnOnline)) { journal.Issn = issnOnline; } if (!string.IsNullOrEmpty(issnPrint) && IsValidISSN(issnPrint) && !string.IsNullOrEmpty(issnOnline) && IsValidISSN(issnOnline)) { journal.Notes = "ISSN (Online): " + issnOnline; } if (!String.IsNullOrEmpty(nlmId)) { journal.Notes = journal.Notes + "\nNlmID: " + nlmId; } journalCollection.Add(journal); } activeProject.Periodicals.AddRange(journalCollection); } catch (Exception e) { Cursor.Current = Cursors.Default; DebugMacro.WriteLine("An error occurred importing the journal data: " + e.Message); return; } finally { Cursor.Current = Cursors.Default; var saveOptions = new DesktopDatabaseSaveOptions(); saveOptions.ForceMultiUserUpdate = true; activeProject.Save(saveOptions); Cursor.Current = Cursors.Default; if (journalCollection != null) { MessageBox.Show(journalCollection.Count.ToString() + " journal(s) were imported (not counting duplicates)", "Citavi", MessageBoxButtons.OK, MessageBoxIcon.Information); journalCollection = null; } } } //end Main()