Click here to Skip to main content
15,896,154 members
Articles / Web Development / ASP.NET

EHSDataCompliance Framework

Rate me:
Please Sign up or sign in to vote.
3.95/5 (13 votes)
5 Mar 2012CPOL13 min read 30.7K   281   8  
This article is about limiting the amount of codes a developer has to write in the DAC layer
#region DotNet Namespaces
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
#endregion

#region Custom Namespaces
using BEs.Engin;
using EHS.CommonDataHelpers.Interfaces;
using EHS.DatabaseHelpers.SqlDatabaseHelper.DataHelpers;
using EHS.CommonDataHelpers.Enums;
using EHS.CommonDataHelpers.DataHelper.Data;
using EHS.CommonDataHelpers.DataHelper.DataHelpers;
using BEs.Enums;
#endregion

namespace DLSql.EnginDAL
{
    public class EnginDAL : IDataAccessLayer<Engin, Engins>
    {
        #region Implemented Methods

        public TransactionStatus Delete(Engin dataObject)
        {
            throw new NotImplementedException();
        }

        public TransactionStatusWithData<Engins> GetAll()
        {
            DataRecord objDataRecord = new DataRecord();
            objDataRecord.TableName = "Engin";

            Engins objEngins = new Engins();

            return StoredProcedures.SelectAll<Engins>(objDataRecord, objEngins);
        }

        public TransactionStatusWithData<Engin> GetById(Engin dataObject)
        {
            StoredProcedure<Engin> Sp_InsertEngin = new StoredProcedure<Engin>();

            Sp_InsertEngin.ProcedureName = "Sp_GetEnginByID";
            Sp_InsertEngin.DataObject = dataObject;
            Sp_InsertEngin.SqlConnectionInfo.ConnectionType = (int)BEs.Enums.ConnectionType.NormalLogin;
            return Sp_InsertEngin.ExecuteReader();
        }

        public TransactionStatus Insert(Engin dataObject)
        {
            StoredProcedure<Engin> Sp_InsertEngin = new StoredProcedure<Engin>();

            Sp_InsertEngin.ProcedureName = "Sp_InsertEngin";
            Sp_InsertEngin.DataObject = dataObject;
            Sp_InsertEngin.SqlConnectionInfo.ConnectionType = (int)BEs.Enums.ConnectionType.NormalLogin;
            return Sp_InsertEngin.ExecuteNonQuery();
        }

        public TransactionStatus Update(Engin dataObject)
        {
            throw new NotImplementedException();
        }

        #endregion

        #region GetColumn

        public Engins GetColumn()
        {
            DataRecord objDataRecord = new DataRecord();

            objDataRecord.TableName = "Engin";
            objDataRecord.FieldName = "Description";

            Engins objEngins = new Engins();
            StoredProcedures.SelectAllFromField<Engins>(objDataRecord, objEngins);

            return objEngins;
        }

        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer Informatics International (Pvt)Ltd
Sri Lanka Sri Lanka
Name : Eraj Hilary Shalindra Fernando
Email : hilary.shalindra@gmail.com

Comments and Discussions