Component Page /UserWeb.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 UserWeb  
11:     {  
12:         public string UserName { get; set; }  
13:   
14:         public string QuizType { get; set; }  
15:   
16:         public string TagType { get; set; }  
17:   
18:         public bool IsNew { get; set; }  
19:   
20:         public UserLocation UserLocation { get; set; }  
21:   
22:         public string NickName { get; set; }  
23:         public string ProfileCountry { get; set; }  
24:         public string ProfileState { get; set; }  
25:         public string ProfileCity { get; set; }  
26:   
27:         public DateTime SessionStartDateTime { get; set; }  
28:   
29:         public int NumberOfQuestionsAnswered { get; set; }  
30:   
31:         public DataTable GetUser(string userID,string password, ISqlWrapper iSqlWrapper)  
32:         {  
33:             ISqlWrapper isqlWrapper = new SqlWrapper();  
34:             string connStr = isqlWrapper.GetConnectionString();  
35:             const string sproc = "GetUser";  
36:             var parameters = new SqlParameter[2];  
37:             parameters[0] = new SqlParameter("@UserID", userID);  
38:             parameters[1] = new SqlParameter("@Password", password);  
39:   
40:             try  
41:             {  
42:                 DataTable tbl = iSqlWrapper.ExecuteDataset(connStr, CommandType.StoredProcedure, sproc, parameters).Tables[0];  
43:                 return tbl;  
44:             }  
45:             catch (Exception ex)  
46:             {  
47:                 ErrorLog errorLog = new ErrorLog();  
48:                 errorLog.LogException("GetUser", ex, isqlWrapper);  
49:                 throw;  
50:             }  
51:         }  
52:   
53:         public void LoadProfileDetails(string userName, ISqlWrapper iSqlWrapper)  
54:         {  
55:             ISqlWrapper isqlWrapper = new SqlWrapper();  
56:             string connStr = isqlWrapper.GetConnectionString();  
57:             const string sproc = "GetProfile";  
58:             var parameters = new SqlParameter[1];  
59:             parameters[0] = new SqlParameter("@UserName", userName);  
60:   
61:             try  
62:             {  
63:                 DataTable tbl = iSqlWrapper.ExecuteDataset(connStr, CommandType.StoredProcedure, sproc, parameters).Tables[0];  
64:                 if (tbl.Rows.Count > 0)  
65:                 {  
66:                     NickName = tbl.Rows[0]["NickName"].ToString();  
67:                     ProfileCountry = tbl.Rows[0]["Country"].ToString();  
68:                     ProfileState = tbl.Rows[0]["State"].ToString();  
69:                     ProfileCity = tbl.Rows[0]["City"].ToString();  
70:                 }  
71:             }  
72:             catch (Exception ex)  
73:             {  
74:                 ErrorLog errorLog = new ErrorLog();  
75:                 errorLog.LogException("LoadNickName", ex, isqlWrapper);  
76:                 throw;  
77:             }  
78:         }  
79:   
80:         public List<UserTest> UserTests { get; set; }  
81:   
82:         public void LoadUserTests(bool includePastQuestionsCorrectIncorrect)  
83:         {  
84:             UserTest userTest = new UserTest();  
85:             UserTests = userTest.LoadQuizzes(includePastQuestionsCorrectIncorrect, UserName, QuizType, TagType, new SqlWrapper());  
86:         }  
87:     }  
88: }  

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