Solved

Referance abstract class within BLL

Posted on 2008-09-30
3
169 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
  • 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jquery datatables, asp.net MVC 9 41
REXEX help Part 2 2 25
ASP.NET MVC -Add authentication 2 21
Calculate number of nights between two dates 5 25
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

810 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