| using System.Data;
|
| 1:using System.Data.Common;
|
| 2:using Microsoft.Practices.EnterpriseLibrary.Common;
|
| 3:using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
|
| 4:using Microsoft.Practices.EnterpriseLibrary.Data;
|
| 5:using Microsoft.Practices.EnterpriseLibrary.Data.Configuration;
|
| 6:using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
|
| 7:using Microsoft.Practices.EnterpriseLibrary.Configuration;
|
| 8:
|
| 9:namespace Arindam.DTO
|
| 10:{
|
| 11: public class EmployerDTO : BaseDTO
|
| 12: {
|
| 13: private Database db;
|
| 14: private static EmployerDTO _Instance;
|
| 15: public static EmployerDTO Instance
|
| 16: {
|
| 17: get
|
| 18: {
|
| 19: if (_Instance == null)
|
| 20: {
|
| 21: _Instance = new EmployerDTO();
|
| 22: }
|
| 23: return _Instance;
|
| 24: }
|
| 25: }
|
| 26:
|
| 27:
|
| 28: private EmployerDTO()
|
| 29: {
|
| 30: db = DatabaseFactory.CreateDatabase("DataAccessQuickStart");
|
| 31:
|
| 32: }
|
| 33:
|
| 34: public bool AddEmployer(tbEmployerInfo emp)
|
| 35: {
|
| 36: bool _isAdded = false;
|
| 37:
|
| 38: try
|
| 39: {
|
| 40:
|
| 41: DbCommand dbc = db.GetStoredProcCommand("usp_MySpName");
|
| 42: db.AddInParameter(dbc, "CallerID", DbType.String, "DInsert");
|
| 43: db.AddInParameter(dbc, "Password", DbType.String, emp.Password);
|
| 44: db.AddInParameter(dbc, "Email", DbType.String, emp.Email);
|
| 45: db.AddInParameter(dbc, "Address", DbType.String, emp.Address);
|
| 46: db.AddInParameter(dbc, "Website", DbType.String, emp.Website);
|
| 47: db.AddInParameter(dbc, "Phone", DbType.String, emp.Phone);
|
| 48: db.AddInParameter(dbc, "Company", DbType.String, emp.Company);
|
| 49: db.AddInParameter(dbc, "Description", DbType.String, emp.Description);
|
| 50:
|
| 51:
|
| 52: db.ExecuteNonQuery(dbc);
|
| 53: dbc = null;
|
| 54: _isAdded = true;
|
| 55: }
|
| 56: catch (Exception ex)
|
| 57: {
|
| 58: this.Status = ex.ToString();
|
| 59: }
|
| 60: return _isAdded;
|
| 61: }
|
| 62:
|
| 63: }
|
| 64:}
|
| 65: |