Exemple #1
0
        public static void FormatPhrase(PhraseItem phrase)
        {
            var newPhrase      = FormatPhrase(phrase.Phrase);
            var newDescription = FormatDescription(phrase.Description);

            phrase.Phrase      = newPhrase;
            phrase.Description = newDescription;
        }
Exemple #2
0
        public async Task <string> AddPhraseAsync(int packId, PhraseItem phrase, string author)
        {
            if (phrase.Complexity < 1 || String.IsNullOrWhiteSpace(phrase.Description))
            {
                return(await GetResponseAsync($"addPackWord?id={packId}&word={phrase.Phrase}&author={author}", 8091)
                       .ConfigureAwait(false));
            }

            return(await GetResponseAsync(
                       $"addPackWordDescription?id={packId}&word={phrase.Phrase}&description={phrase.Description.ReplaceSemicolons()}&level={phrase.Complexity}&author={author}",
                       8091).ConfigureAwait(false));
        }
Exemple #3
0
        public void EditPhrase(int packId, PhraseItem oldPhrase, PhraseItem newPhrase, string selectedAuthor)
        {
            if (oldPhrase.Phrase != newPhrase.Phrase)
            {
                DeletePhrase(packId, oldPhrase.Phrase, selectedAuthor);
            }

            if (!string.Equals(oldPhrase.Phrase, newPhrase.Phrase, StringComparison.Ordinal) ||
                Math.Abs(oldPhrase.Complexity - newPhrase.Complexity) > 0.01 ||
                !string.Equals(oldPhrase.Description, newPhrase.Description, StringComparison.Ordinal))
            {
                GetResponse(
                    $"addPackWordDescription?id={packId}&word={newPhrase.Phrase}&description={newPhrase.Description.ReplaceSemicolons()}&level={newPhrase.Complexity}&author={selectedAuthor}",
                    8091);
            }
        }
Exemple #4
0
        public PhraseItem Clone()
        {
            var phrase = new PhraseItem
            {
                Phrase          = Phrase,
                Complexity      = Complexity,
                Description     = Description,
                ReviewerObjects = new Reviewer[ReviewerObjects.Length]
            };

            for (var i = 0; i < ReviewerObjects.Length; i++)
            {
                phrase.ReviewerObjects[i] = new Reviewer(ReviewerObjects[i].Author, ReviewerObjects[i].ReviewState);
            }

            return(phrase);
        }
Exemple #5
0
        public async Task <string> EditPhraseAsync(int packId, PhraseItem oldPhrase, PhraseItem newPhrase, string selectedAuthor)
        {
            if (oldPhrase.Phrase != newPhrase.Phrase)
            {
                await DeletePhraseAsync(packId, oldPhrase.Phrase, selectedAuthor).ConfigureAwait(false);
            }

            if (!string.Equals(oldPhrase.Phrase, newPhrase.Phrase, StringComparison.Ordinal) ||
                Math.Abs(oldPhrase.Complexity - newPhrase.Complexity) > 0.01 ||
                !string.Equals(oldPhrase.Description, newPhrase.Description, StringComparison.Ordinal))
            {
                return(await GetResponseAsync(
                           $"addPackWordDescription?id={packId}&word={newPhrase.Phrase}&description={newPhrase.Description.ReplaceSemicolons()}&level={newPhrase.Complexity}&author={selectedAuthor}",
                           8091).ConfigureAwait(false));
            }

            return(await new Task <string>(() => "").ConfigureAwait(false));
        }
Exemple #6
0
 public Task ReviewPhraseAsync(int packId, PhraseItem phrase, string reviewerName, State state)
 {
     return(GetResponseAsync($"reviewPackWord?id={packId}&word={phrase.Phrase}&author={reviewerName}&state={(int)state}", 8091));
 }
Exemple #7
0
 public void ReviewPhrase(int packId, PhraseItem phrase, string reviewerName, State state)
 {
     GetResponse($"reviewPackWord?id={packId}&word={phrase.Phrase}&author={reviewerName}&state={(int)state}", 8091);
 }
Exemple #8
0
 public void AddPhrase(int packId, PhraseItem phrase)
 {
     GetResponse(
         $"addPackWordDescription?id={packId}&word={phrase.Phrase}&description={phrase.Description.ReplaceSemicolons()}&level={phrase.Complexity}&author={phrase.ReviewedBy}", 8091);
 }