Component Page /ContactUs.cs (C#)
1: using System;  
2: using Microsoft.ApplicationBlocks.Data;  
3: using System.Data.SqlClient;  
4: using System.Data;  
5:   
6: namespace QuizNetOnline.Logic  
7: {  
8:     [Serializable]  
9:     public class ContactUs  
10:     {  
11:         private static ContactUs _instance;  
12:         public static ContactUs Instance  
13:         {  
14:             get { return _instance ?? (_instance = new ContactUs()); }  
15:         }  
16:   
17:         public DateTime SentDate { get; set; }  
18:         public string Email { get; set; }  
19:         public string Name { get; set; }  
20:         public string Subject { get; set; }  
21:         public string Message { get; set; }  
22:   
23:         public int Create(ISqlWrapper iSqlWrapper)  
24:         {  
25:             string connStr = iSqlWrapper.GetConnectionString();  
26:             const string sproc = "CreateContactUs";  
27:   
28:             var parameters = new SqlParameter[4];  
29:   
30:             parameters[0] = new SqlParameter("@Email", Email);  
31:             parameters[1] = new SqlParameter("@Name", Name);  
32:             parameters[2] = new SqlParameter("@Subject", Subject);  
33:             parameters[3] = new SqlParameter("@Message", Message);  
34:   
35:             try  
36:             {  
37:                 return iSqlWrapper.ExecuteNonQuery(connStr, CommandType.StoredProcedure, sproc, parameters);  
38:             }  
39:             catch (Exception ex)  
40:             {  
41:                 ErrorLog errorLog = new ErrorLog();  
42:                 errorLog.LogException("CreateContactUs", ex, iSqlWrapper);  
43:                 throw;  
44:             }  
45:         }  
46:   
47:         public int Delete(ISqlWrapper iSqlWrapper)  
48:         {  
49:             string connStr = iSqlWrapper.GetConnectionString();  
50:             const string sproc = "DeleteContactUs";  
51:   
52:             var parameters = new SqlParameter[3];  
53:   
54:             parameters[0] = new SqlParameter("@SentDate", SentDate);  
55:             parameters[1] = new SqlParameter("@Email", Email);  
56:             parameters[2] = new SqlParameter("@Name", Name);  
57:   
58:             try  
59:             {  
60:                 return iSqlWrapper.ExecuteNonQuery(connStr, CommandType.StoredProcedure, sproc);  
61:             }  
62:             catch (Exception ex)  
63:             {  
64:                 ErrorLog errorLog = new ErrorLog();  
65:                 errorLog.LogException("DeleteContactUs", ex, iSqlWrapper);  
66:                 throw;  
67:             }  
68:         }  
69:     }  
70: }  

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