Exemple #1
0
 public void CreateQuote(QuoteSM quote)
 {
     try
     {
         quote.RatingNum = 0;
         quoteData.CreateQuote(Map(quote));
         logs.LogError("Event ", "User was able to create new item ", "Class:QuoteLogic, Method:CreateQuote");
     }
     catch (Exception P)
     {
         logs.LogError("Error ", "User was unable to create a new item ", "Class:UserLogic, Method:CreateQuote");
     }
 }
Exemple #2
0
        private QuoteSM Map(QuoteDM quote)
        {
            QuoteSM phrase = new QuoteSM();

            phrase.QuoteId     = Convert.ToInt32(quote.QuoteId);
            phrase.Phrase      = quote.Phrase;
            phrase.Author      = quote.Author;
            phrase.CategoryNum = Convert.ToInt32(quote.Category);
            phrase.RatingNum   = Convert.ToInt32(quote.Rating);
            phrase.NumRatings  = Convert.ToInt32(quote.NumRatings);
            phrase.RatingScore = Convert.ToInt32(quote.RatingScore);
            return(phrase);
        }
Exemple #3
0
        private QuoteDM Map(QuoteSM quote)
        {
            QuoteDM phrase = new QuoteDM();

            phrase.QuoteId     = quote.QuoteId.ToString();
            phrase.Phrase      = quote.Phrase;
            phrase.Author      = quote.Author;
            phrase.Category    = quote.CategoryNum.ToString();
            phrase.Rating      = quote.RatingNum.ToString();
            phrase.NumRatings  = quote.NumRatings.ToString();
            phrase.RatingScore = quote.RatingScore.ToString();
            return(phrase);
        }
Exemple #4
0
 public void EditQuoteById(QuoteSM quote)
 {
     try
     {
         if (quote.NumRatings > 0)
         {
             quote.RatingNum = (quote.RatingScore / quote.NumRatings);
         }
         quoteData.EditQuoteById(Map(quote));
         logs.LogError("Event ", "User was able to update Quote", "Class:QuoteLogic, Method:UpdateQuoteById");
     }
     catch (Exception e)
     {
         logs.LogError("Error ", "User was unable to update Quote", "Class:QuoteLogic, Method:UpdateQuoteById");
     }
 }