Solved

Referance abstract class within BLL

Posted on 2008-09-30
3
172 Views
Last Modified: 2013-12-17
Hi
I'm trying to get data from a abstract class and use it in BLL class, problem is i cannot seem to pass the data over, the data i'm trying to get is:
protected static string CurrentMemberIpAddr from public abstract class MemberBrowserDetails
protected static string CurrentMemberBrowser from public abstract class MemberBrowserDetails
Which will be used instead of:
"TestIP", "TestBrowser" in CheckLoginUsernamePasswordBLL
I've attached the two classes
Can any help with this problem
Regards
George
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
 
/// <summary>
/// Get member IPAddress, browser details and if new member create a new ID
/// </summary>
namespace TSE.Secure.BLL
{
    public abstract class MemberBrowserDetails
    {
        protected static string MemberUniqueID
        {
            get { return System.Guid.NewGuid().ToString(); }
        }
        protected static string CurrentMemberIpAddr
        {
            get { return HttpContext.Current.Request.UserHostAddress; }
        }
 
        protected static string CurrentMemberBrowser
        {
            get { return HttpContext.Current.Request.UserAgent; }
        }
 
        protected static string ConvertNullToEmptyString(string input)
        {
            return (input == null ? "" : input);
        }
    }
}
==================================================
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
using CheckLoginDetails.DO;
 
/// <summary>
/// Summary description for CheckLoginUsernamePasswordDAL
/// </summary>
namespace CheckLoginDetails.BLL
{
    public class CheckLoginUsernamePasswordBLL
    {
        public List<UserDetailsDataObject> CheckMemberLogin(string strEmail, string strPassword)
        {
 
            List<UserDetailsDataObject> userDataList = new List<UserDetailsDataObject>();
            try
            {
                //  if (!isValidEmailString (strEmail) ) throw some error 
                DAL.SecureMembershipGetPasswordProc dal = new CheckLoginDetails.DAL.SecureMembershipGetPasswordProc();
                userDataList = dal.CheckMemberLogin(strEmail, strPassword, "TestIP", "TestBrowser");
 
            }
            catch (SqlException)
            {
                throw new ApplicationException("Sorry an error has occured<br /> and we cannot process your request.");
            }
            finally
            {
            }
            return userDataList;
        }
    }
}

Open in new window

0
Comment
Question by:BeginningWebDesign
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
johnaryan earned 500 total points
ID: 22608701
Looking at your abstract class MemberBrowserDetails, all the Properties are marked "protected", this implies that they are only available to a class that inherits them.
As CheckLoginUsernamePasswordBLL doesn't implement the abstract class it cannot access it's members.

Making these properties public will allow all classes access to them, you could also mark them as internal the calling class be in the same assembly.

John
0
 

Author Comment

by:BeginningWebDesign
ID: 22609341
Hi johnaryan:

I had tried the code attached, but this did not work. So i added the code snippet "as is" when posted
The code attached does not insert the IPAddr or browser info.

George
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
using CheckLoginDetails.DO;
using TSE.Secure.BLL;
 
/// <summary>
/// Summary description for CheckLoginUsernamePasswordDAL
/// </summary>
namespace CheckLoginDetails.BLL
{
    public class CheckLoginUsernamePasswordBLL : MemberBrowserDetails
    {
        public List<UserDetailsDataObject> CheckMemberLogin(string strEmail, string strPassword)
        {
 
            List<UserDetailsDataObject> userDataList = new List<UserDetailsDataObject>();
            try
            {
                //  if (!isValidEmailString (strEmail) ) throw some error 
                DAL.SecureMembershipGetPasswordProc dal = new CheckLoginDetails.DAL.SecureMembershipGetPasswordProc();
                userDataList = dal.CheckMemberLogin(strEmail, strPassword, MemberBrowserDetails.CurrentMemberIpAddr, MemberBrowserDetails.CurrentMemberBrowser);
 
            }
            catch (SqlException)
            {
                throw new ApplicationException("Sorry an error has occured<br /> and we cannot process your request.");
            }
            finally
            {
            }
            return userDataList;
        }
    }
}

Open in new window

0
 

Author Closing Comment

by:BeginningWebDesign
ID: 31501628
I found the problem, i had the set 2 variables to the wrong values, i'm awarding points to johnaryan: for trying to help
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question