Component Page /WebFunctions.cs (C#)
1: using System;  
2: using System.Collections.Generic;  
3: using System.Configuration;  
4: using Microsoft.ApplicationBlocks.Data;  
5:   
6: namespace QuizNetOnline.Logic  
7: {  
8:     public class WebFunctions  
9:     {  
10:         static public string MultilineFormatter(string text)  
11:         {  
12:                     const string tab = "  ";  
13:                     text = text.Replace(Environment.NewLine, "<br>");  
14:                     //Replace special character-9 to 2 x spaces  
15:                     text = text.Replace(Convert.ToChar(9).ToString(), tab);  
16:                     return text;  
17:         }  
18:   
19:         /// <summary>  
20:         ///    
21:         /// </summary>  
22:         /// <param name="topic"></param>  
23:         /// <param name="unlimitedQuestions"></param>  
24:         /// <param name="userName"></param>  
25:         /// <param name="quizNetSystem"></param>  
26:         /// <param name="additionalOptions"></param>  
27:         /// <param name="tagOptions"></param>  
28:         /// <returns></returns>  
29:         public virtual List<int> SetupQuestionList(string topic, bool unlimitedQuestions, string userName, QuizNetSystem quizNetSystem, string additionalOptions, string tagOptions)  
30:         {  
31:             SqlWrapper sqlWrapper = new SqlWrapper();  
32:   
33:             int maximumValue = Convert.ToInt32(ConfigurationManager.AppSettings["NumberOfFreeQuestions"]);  
34:             //If the value is 0 then allow for maximum number of questions  
35:             if (maximumValue == 0)  
36:                 unlimitedQuestions = true;  
37:   
38:             if(unlimitedQuestions)  
39:                 return quizNetSystem.LoadQuestions(topic, userName, sqlWrapper, additionalOptions, tagOptions);  
40:   
41:             if (topic == "fav")  
42:             {  
43:                 return quizNetSystem.LoadQuestions(topic, userName, sqlWrapper, additionalOptions, tagOptions);  
44:             }  
45:             //Load the free quiz  
46:             List<int> questions = quizNetSystem.LoadQuestions(topic, userName, new SqlWrapper(), additionalOptions, tagOptions);  
47:             return questions.GetRange(0, questions.Count >= maximumValue ? maximumValue : questions.Count);  
48:         }  
49:     }  
50: }  

.NET Documentation Tool is © 2002 - 2009 Winnersh Triangle Web Solutions Limited.