How to call base abstract or interface from DAL into BLL?

Posted by programmerist on Stack Overflow See other posts from Stack Overflow or by programmerist
Published on 2010-03-23T13:19:24Z Indexed on 2010/03/23 13:23 UTC
Read the original article Hit count: 377

Filed under:
|
|
|

How can i access abstract class in BLL ? i shouldn't see GenAccessor in BLL it must be private class GenAccessor . i should access Save method over _AccessorForSQL. ok?

MY BLL cs:


 public class AccessorForSQL: GenoTip.DAL._AccessorForSQL
    {
        public bool Save(string Name, string SurName, string Adress)
        {

            ListDictionary ld = new ListDictionary();
            ld.Add("@Name", Name);
            ld.Add("@SurName", SurName);
            ld.Add("@Adress", Adress);
            return **base.Save("sp_InsertCustomers", ld, CommandType.StoredProcedure);**
        }
    }

i can not access base.Save....????????

it is my DAL Layer:

namespace GenoTip.DAL
{
    public abstract class _AccessorForSQL
    {
        public abstract bool Save(string sp, ListDictionary ld, CommandType cmdType);
        public abstract bool Update();
        public abstract bool Delete();
        public abstract DataSet Select();
    }

   private class GenAccessor : _AccessorForSQL
    {
        DataSet ds;
        DataTable dt;
        public override bool Save(string sp, ListDictionary ld, CommandType cmdType)
        {
            SqlConnection con = null;
            SqlCommand cmd = null;
            SqlDataReader dr = null;
            try
            {
                con = GetConnection();
                cmd = new SqlCommand(sp, con);
                con.Open();
                cmd.CommandType = cmdType;
                foreach (string ky in ld.Keys)
                {
                    cmd.Parameters.AddWithValue(ky, ld[ky]);
                }
                dr = cmd.ExecuteReader();
                ds = new DataSet();
                dt = new DataTable();
                ds.Tables.Add(dt);
                ds.Load(dr, LoadOption.OverwriteChanges, dt);

            }
            catch (Exception exp)
            {

                HttpContext.Current.Trace.Warn("Error in GetCustomerByID()", exp.Message, exp);
            }
            finally
            {
                if (dr != null) dr.Close();
                if (con != null) con.Close();

            }
            return (ds.Tables[0].Rows.Count > 0) ? true : false;

        }
        public override bool Update()
        {
            return true;
        }
        public override bool Delete()
        {
            return true;
        }
        public override DataSet Select()
        {
            DataSet dst = new DataSet();
            return dst;
        }


        private static SqlConnection GetConnection()
        {
            string connStr = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            SqlConnection conn = new SqlConnection(connStr);
            return conn;
        }

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET