Component Page /TableInformation.cs (C#)
1: using System;  
2: using System.Collections.Generic;  
3: using Microsoft.ApplicationBlocks.Data;  
4: using System.Data.SqlClient;  
5: using System.Data;  
6:   
7: namespace QuizNetOnline.Logic  
8: {  
9:     [Serializable]  
10:     public class TableInformation  
11:     {  
12:         private static TableInformation _instance;  
13:         private int? _comments;  
14:   
15:         private int? _contactus;  
16:         private int? _errors;  
17:   
18:         private int? _log;  
19:   
20:         private int? _last24HrsResults;  
21:         private int? _dayResults;  
22:   
23:         private int? _userquestions;  
24:   
25:         public TableInformation()  
26:         {  
27:             int? contactUs = 0;  
28:             int? log = 0;  
29:             int? dayResults = 0;  
30:             int? last24HrsResults = 0;  
31:             int? userQuestions = 0;  
32:             int? comments = 0;  
33:             int? errors = 0;  
34:   
35:             ISqlWrapper isqlWrapper = new SqlWrapper();  
36:   
37:             string connStr = isqlWrapper.GetConnectionString();  
38:   
39:             if (connStr == null)  
40:                 throw new NotImplementedException();  
41:   
42:             const string sproc = "GetRecordCounts";  
43:             var parameters = new SqlParameter[7];  
44:             parameters[0] = new SqlParameter("@ContactUs", contactUs);  
45:             parameters[0].Direction = ParameterDirection.InputOutput;  
46:             parameters[1] = new SqlParameter("@Log", log);  
47:             parameters[1].Direction = ParameterDirection.InputOutput;  
48:             parameters[2] = new SqlParameter("@Results", dayResults);  
49:             parameters[2].Direction = ParameterDirection.InputOutput;  
50:             parameters[3] = new SqlParameter("@Last24hrs", last24HrsResults);  
51:             parameters[3].Direction = ParameterDirection.InputOutput;  
52:             parameters[4] = new SqlParameter("@UserQuestions", userQuestions);  
53:             parameters[4].Direction = ParameterDirection.InputOutput;  
54:             parameters[5] = new SqlParameter("@Comments", comments);  
55:             parameters[5].Direction = ParameterDirection.InputOutput;  
56:             parameters[6] = new SqlParameter("@Errors", errors);  
57:             parameters[6].Direction = ParameterDirection.InputOutput;  
58:             try  
59:             {  
60:                 isqlWrapper.ExecuteNonQuery(connStr, CommandType.StoredProcedure, sproc, parameters);  
61:   
62:                 ContactUs = Convert.ToInt32(parameters[0].Value.ToString());  
63:                 Log = Convert.ToInt32(parameters[1].Value.ToString());  
64:                 Last24HrsResults = Convert.ToInt32(parameters[3].Value.ToString());  
65:                 DayResults = Convert.ToInt32(parameters[2].Value.ToString());  
66:                 UserQuestions = Convert.ToInt32(parameters[4].Value.ToString());  
67:                 Comments = Convert.ToInt32(parameters[5].Value.ToString());  
68:                 Errors = Convert.ToInt32(parameters[6].Value.ToString());  
69:             }  
70:             catch (Exception ex)  
71:             {  
72:                 ErrorLog errorLog = new ErrorLog();  
73:                 errorLog.LogException("TableInformation", ex, isqlWrapper);  
74:                 throw;  
75:             }  
76:         }  
77:   
78:         public static TableInformation Instance  
79:         {  
80:             get { return _instance ?? (_instance = new TableInformation()); }  
81:         }  
82:   
83:         public int? ContactUs  
84:         {  
85:             get { return _contactus; }  
86:             set { _contactus = value; }  
87:         }  
88:   
89:         public int? Log  
90:         {  
91:             get { return _log; }  
92:             set { _log = value; }  
93:         }  
94:   
95:         public int? Last24HrsResults  
96:         {  
97:             get { return _last24HrsResults; }  
98:             set { _last24HrsResults = value; }  
99:         }  
100:   
101:         public int? DayResults  
102:         {  
103:             get { return _dayResults; }  
104:             set { _dayResults = value; }  
105:         }  
106:   
107:         public int? UserQuestions  
108:         {  
109:             get { return _userquestions; }  
110:             set { _userquestions = value; }  
111:         }  
112:   
113:         public int? Comments  
114:         {  
115:             get { return _comments; }  
116:             set { _comments = value; }  
117:         }  
118:   
119:         public int? Errors  
120:         {  
121:             get { return _errors; }  
122:             set { _errors = value; }  
123:         }  
124:   
125:   
126:         public virtual int GetTopicCount(Topic topic,string additionalOptions,string tagOptions,string userName)  
127:         {  
128:             int topicCount = 0;  
129:             foreach (DataRow row in GetTopicsCount(topic, additionalOptions, tagOptions, userName).Rows)  
130:             {  
131:                 topicCount+=Convert.ToInt32(row["Records"].ToString());      
132:             }  
133:             return topicCount;  
134:         }  
135:   
136:         public virtual Dictionary<string, int> GetTopicCount()  
137:         {  
138:             Dictionary<string, int> dictionaryTopicCount = new Dictionary<string, int>();  
139:   
140:             foreach (DataRow row in GetTopicsCount(null,null,null,null).Rows)  
141:             {  
142:                 dictionaryTopicCount.Add(row["TopicCode"].ToString(), Convert.ToInt32(row["Records"]));  
143:             }  
144:   
145:             return dictionaryTopicCount;  
146:         }  
147:   
148:         public virtual DataTable GetTopicsCount(Topic topic,string additionalOptions,string tagOptions,string username)  
149:         {  
150:             ISqlWrapper isqlWrapper = new SqlWrapper();  
151: There is a limit of 150 source code lines in the evaluation version
152: There is a limit of 150 source code lines in the evaluation version
153: There is a limit of 150 source code lines in the evaluation version
154: There is a limit of 150 source code lines in the evaluation version
155: There is a limit of 150 source code lines in the evaluation version
156: There is a limit of 150 source code lines in the evaluation version
157: There is a limit of 150 source code lines in the evaluation version
158: There is a limit of 150 source code lines in the evaluation version
159: There is a limit of 150 source code lines in the evaluation version
160: There is a limit of 150 source code lines in the evaluation version
161: There is a limit of 150 source code lines in the evaluation version
162: There is a limit of 150 source code lines in the evaluation version
163: There is a limit of 150 source code lines in the evaluation version
164: There is a limit of 150 source code lines in the evaluation version
165: There is a limit of 150 source code lines in the evaluation version
166: There is a limit of 150 source code lines in the evaluation version
167: There is a limit of 150 source code lines in the evaluation version
168: There is a limit of 150 source code lines in the evaluation version
169: There is a limit of 150 source code lines in the evaluation version
170: There is a limit of 150 source code lines in the evaluation version
171: There is a limit of 150 source code lines in the evaluation version
172: There is a limit of 150 source code lines in the evaluation version

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