docs: #306 renaming GanjoorVerse SectionIndex fields

This commit is contained in:
Hamid Reza Mohammadi 2022-04-21 11:31:58 +04:30
parent f66b9970d2
commit 1998831ec5
4 changed files with 36 additions and 36 deletions

View File

@ -43,22 +43,22 @@
/// <summary>
/// GanjoorPoemSection index
/// </summary>
public int? SectionIndex { get; set; }
public int? SectionIndex1 { get; set; }
/// <summary>
/// second GanjoorPoemSection index
/// </summary>
public int? SecondSectionIndex { get; set; }
public int? SectionIndex2 { get; set; }
/// <summary>
/// third GanjoorPoemSection index
/// </summary>
public int? ThirdSectionIndex { get; set; }
public int? SectionIndex3 { get; set; }
/// <summary>
/// forth GanjoorPoemSection index
/// </summary>
public int? ForthSectionIndex { get; set; }
public int? SectionIndex4 { get; set; }
public override string ToString()
{

View File

@ -130,13 +130,13 @@ namespace RMuseum.Services.Implementation
foreach (var section in sections)
{
var sectionVerses = poemVerses.Where(v =>
(section.VerseType == VersePoemSectionType.First && v.SectionIndex == section.Index)
(section.VerseType == VersePoemSectionType.First && v.SectionIndex1 == section.Index)
||
(section.VerseType == VersePoemSectionType.Second && v.SecondSectionIndex == section.Index)
(section.VerseType == VersePoemSectionType.Second && v.SectionIndex2 == section.Index)
||
(section.VerseType == VersePoemSectionType.Third && v.ThirdSectionIndex == section.Index)
(section.VerseType == VersePoemSectionType.Third && v.SectionIndex3 == section.Index)
||
(section.VerseType == VersePoemSectionType.Forth && v.ForthSectionIndex == section.Index)
(section.VerseType == VersePoemSectionType.Forth && v.SectionIndex4 == section.Index)
).OrderBy(v => v.VOrder).ToList();
if (sectionVerses.Any(v => modifiedVerses.Contains(v)))
{
@ -282,8 +282,8 @@ namespace RMuseum.Services.Implementation
foreach (var verse in poemVerses)
{
verse.SecondSectionIndex = null;
verse.ThirdSectionIndex = null;
verse.SectionIndex2 = null;
verse.SectionIndex3 = null;
_context.Update(verse);
}
}
@ -312,7 +312,7 @@ namespace RMuseum.Services.Implementation
foreach (var verse in poemVerses)
{
verse.SecondSectionIndex = secondMetreSection.Index;
verse.SectionIndex2 = secondMetreSection.Index;
}
foreach (var secondLevelSections in sections.Where(s => s.SectionType != PoemSectionType.WholePoem && s.VerseType == VersePoemSectionType.Second).OrderBy(s => s.Index))
@ -338,7 +338,7 @@ namespace RMuseum.Services.Implementation
foreach (var verse in poemVerses)
{
verse.ThirdSectionIndex = newSection.Index;
verse.SectionIndex3 = newSection.Index;
}
}
_context.UpdateRange(poemVerses);

View File

@ -99,10 +99,10 @@ namespace RMuseum.Services.Implementation
context.Add(mainSection);//having a main section for مثنوی inside normal text helps keep track of related versess
foreach (var verse in singleVerses)
{
verse.SectionIndex = mainSection.Index;
verse.SecondSectionIndex = null;//clear previous indices
verse.ThirdSectionIndex = null;//clear previous indices
verse.ForthSectionIndex = null;//clear previous indices
verse.SectionIndex1 = mainSection.Index;
verse.SectionIndex2 = null;//clear previous indices
verse.SectionIndex3 = null;//clear previous indices
verse.SectionIndex4 = null;//clear previous indices
}
context.UpdateRange(singleVerses);
@ -167,10 +167,10 @@ namespace RMuseum.Services.Implementation
context.Add(mainSection);//having a main section for مثنوی inside normal text helps keep track of related versess
foreach (var verse in singleVerses)
{
verse.SectionIndex = mainSection.Index;
verse.SecondSectionIndex = null;//clear previous indices
verse.ThirdSectionIndex = null;//clear previous indices
verse.ForthSectionIndex = null;//clear previous indices
verse.SectionIndex1 = mainSection.Index;
verse.SectionIndex2 = null;//clear previous indices
verse.SectionIndex3 = null;//clear previous indices
verse.SectionIndex4 = null;//clear previous indices
}
context.UpdateRange(singleVerses);
}
@ -279,10 +279,10 @@ namespace RMuseum.Services.Implementation
List<GanjoorVerse> bandVerses = new List<GanjoorVerse>();
foreach (var verse in nonCommentVerses)
{
verse.SectionIndex = mainSection.Index;
verse.SecondSectionIndex = null;//clear previous indices
verse.ThirdSectionIndex = null;//clear previous indices
verse.ForthSectionIndex = null;//clear previous indices
verse.SectionIndex1 = mainSection.Index;
verse.SectionIndex2 = null;//clear previous indices
verse.SectionIndex3 = null;//clear previous indices
verse.SectionIndex4 = null;//clear previous indices
if (verse.VersePosition == VersePosition.Right || verse.VersePosition == VersePosition.Left)
{
currentBandVerses.Add(verse);
@ -295,7 +295,7 @@ namespace RMuseum.Services.Implementation
{
foreach (var currentBandVerse in currentBandVerses)
{
currentBandVerse.SecondSectionIndex = currentBandSection.Index;
currentBandVerse.SectionIndex2 = currentBandSection.Index;
}
currentBandSection.RhymeLetters = LanguageUtils.FindRhyme(currentBandVerses).Rhyme;
currentBandSection.HtmlText = PrepareHtmlText(currentBandVerses);
@ -323,7 +323,7 @@ namespace RMuseum.Services.Implementation
{
foreach (var currentBandVerse in currentBandVerses)
{
currentBandVerse.SecondSectionIndex = currentBandSection.Index;
currentBandVerse.SectionIndex2 = currentBandSection.Index;
}
currentBandSection.RhymeLetters = LanguageUtils.FindRhyme(currentBandVerses).Rhyme;
currentBandSection.HtmlText = PrepareHtmlText(currentBandVerses);
@ -344,7 +344,7 @@ namespace RMuseum.Services.Implementation
};
foreach (var bandVerse in bandVerses)
{
bandVerse.SecondSectionIndex = bandSection.Index;
bandVerse.SectionIndex2 = bandSection.Index;
}
bandSection.RhymeLetters = LanguageUtils.FindRhyme(bandVerses).Rhyme;
bandSection.HtmlText = PrepareHtmlText(bandVerses);
@ -379,10 +379,10 @@ namespace RMuseum.Services.Implementation
context.Add(mainSection);//having a main section for مثنوی inside normal text helps keep track of related versess
foreach (var verse in nonCommentVerses)
{
verse.SectionIndex = mainSection.Index;
verse.SecondSectionIndex = null;//clear previous indices
verse.ThirdSectionIndex = null;//clear previous indices
verse.ForthSectionIndex = null;//clear previous indices
verse.SectionIndex1 = mainSection.Index;
verse.SectionIndex2 = null;//clear previous indices
verse.SectionIndex3 = null;//clear previous indices
verse.SectionIndex4 = null;//clear previous indices
}
index++;
@ -415,8 +415,8 @@ namespace RMuseum.Services.Implementation
GanjoorMetreRefSectionIndex = mainSection.Index,
};
rightVerse.SecondSectionIndex = verseSection.Index;
leftVerse.SecondSectionIndex = verseSection.Index;
rightVerse.SectionIndex2 = verseSection.Index;
leftVerse.SectionIndex2 = verseSection.Index;
var rl = new List<GanjoorVerse>();rl.Add(rightVerse);rl.Add(leftVerse);
verseSection.HtmlText = PrepareHtmlText(rl);

View File

@ -101,11 +101,11 @@ namespace RMuseum.Services.Implementation
v.PoemId == section.PoemId
&&
(
(section.VerseType == VersePoemSectionType.Second && v.SecondSectionIndex == section.Index)
(section.VerseType == VersePoemSectionType.Second && v.SectionIndex2 == section.Index)
||
(section.VerseType == VersePoemSectionType.Third && v.ThirdSectionIndex == section.Index)
(section.VerseType == VersePoemSectionType.Third && v.SectionIndex3 == section.Index)
||
(section.VerseType == VersePoemSectionType.Forth && v.ForthSectionIndex == section.Index)
(section.VerseType == VersePoemSectionType.Forth && v.SectionIndex4 == section.Index)
)
)
.OrderBy(v => v.VOrder)