Architecture :: Pass Data From DAL To BLL And From BLL To PL?
Sep 29, 2010
I am developing an application for online examination system. It is 3 - tier application. I know how PL, BLL and DAL layers interact with each other but only one way. I meant, PL called BLL and BLL called DAL. However, recently I came across a scenario where I want to transfer a data from DAL to BLL and from BLL to PL or may be directly from DAL to PL.
I have "retrieve.aspx" page to reset forgotten password which contains a textbox and button. This page will ask Email address from user and when user hit the "Go" button, application will hit the database. If it finds the entered email address into a database, it will redirect to "questionanswer.aspx".
"questionanswer.aspx" contains a label, textbox and submit button. In the page load event of "questionanswer.aspx", application will show a security question (a fetched question from database related to entered email address) and ask user to fill an answer. On the click event of submit button, application again hit the database and authenticate the user, if the answer is correct it will redirect the user to password reset page. I can go up to fetching a question from database. But I do not know where to store it in DAL and how to pass it to PL where I can assign it to lable.text. I have 3 classes Users.cs, UserBAL.cs and UserDAL.cs. Retrieve.aspx.cs:
protected void btnGo_Click(object sender, EventArgs e)
{
Users PwdRetrieve = new Users();
PwdRetrieve.EmailAddress = txtEmailRetrive.Text.ToString();
Session["EmailAddress"] = txtEmailRetrive.Text.ToString();
UserBAL balPR = new UserBAL();
if (balPR.CheckEmailPR(PwdRetrieve))
{
Response.Redirect("questionanswer.aspx");
}
else
{
lblErrorMsg1.Text = ("We have not found an Email Address in our databse.");
lblErrorMsg2.Text = ("Please enter a valid Email Address.");
}
}
UserBAL.cs:
public bool CheckEmailPR(Users PwdRetrieve)
{
UserDAL dalPR = new UserDAL();
if (dalPR.CheckEmailPR(PwdRetrieve) > 0)
{
return true;
}
else
{
return false;
}
}
UserDAL.cs:
public int CheckEmailPR(Users PwdRetrieve)
{
int rows = 0;
using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString2"].ConnectionString))
{
string SP_CHECK_EMAIL = "CheckEmailForPasswordRetrival";
SqlCommand cmd = new SqlCommand(SP_CHECK_EMAIL, conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@Email", SqlDbType.VarChar).Value = PwdRetrieve.EmailAddress;
cmd.Parameters.Add("@rows", SqlDbType.Int);
cmd.Parameters["@rows"].Direction = ParameterDirection.Output;
conn.Open();
rows = Convert.ToInt32(cmd.ExecuteScalar());
rows = (int)cmd.Parameters["@rows"].Value;
conn.Close();
}
return (int)rows;
}
Questionanswer.aspx.cs:
protected void Page_Load(object sender, EventArgs e)
{
txtAnswer.Focus();
Users QuestionAnswer = new Users();
QuestionAnswer.EmailAddress = (string)Session["EmailAddress"];
UserBAL balQA = new UserBAL();
if (balQA.FetchQuestion(QuestionAnswer))
{
lblQuestion.Text = "Do not know how to assign a fetched question to this lable.";
}
else
{
lblErrorMsgQA.Text = ("Sorry! Please enter a correct answer.");
}
}
UserBAL.cs:
public string FetchQuestion(Users QuestionAnswer)
{
UserDAL dalQA = new UserDAL();
if (dalQA.FetchQuestion(QuestionAnswer) != null)
{
}
else
{
}
}
UserDAL.cs:
public string FetchQuestion(Users QuestionAnswer)
{
string question = string.Empty;
using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString2"].ConnectionString))
{
string SP_FETCH_QUESTION = "FetchQuestion";
SqlCommand cmd = new SqlCommand(SP_FETCH_QUESTION, conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Email", SqlDbType.VarChar).Value = QuestionAnswer.EmailAddress;
conn.Open();
SqlDataReader read = cmd.ExecuteReader();
while (read.Read())
{
question = read["tblSecurityQuestion"].ToString();
}
read.Close();
conn.Close();
}
return question;
}
View 7 Replies
Similar Messages:
Jul 6, 2010
I have three layers like UI, business and data access in my asp.net web application project. If I pass say a company code from the UI to the business to the data access and I query the company details like company name, address, phone etc from the database using sqlhelper executedataset() which wil return me a dataset. Then how do I pass these company details back to the UI layer. Is it correct to just pass the datatable object to the business and UI.
View 6 Replies
Feb 23, 2010
i'm facing a problem with transfering data between two web applicatins on two different servers. For example on page A
I have a login box with LoginName textbox and Password textbox and Login button. What I am trying to achieve is that when i press Login button I will transfer data from Login and Password textboxes to page B and .net code on page B will try to validate the logging user. I was trying code like this but it won't works on page A
[Code]....
and on page B in Page_Load event
[Code]....
I was thinking of using Web Service between these apps, however i am not certain that it will works.
View 12 Replies
Jun 3, 2010
here i have in 3-tier architecture , how to pass the data between DAL and BAL. i am using grid view to edit the data,when ever i click on the edit button all the corresponding fields should come to textboxes. i tried for delete ,it works fine bt not working to EDIT.
View 7 Replies
Apr 1, 2010
how the data pass from one layer to another layer in mvc design pattern...
View 2 Replies
Oct 26, 2010
I am new to this .NET what is the difference between N-Tier and 3- Tier Architecture. If they are same. How to pass the values from presentation layer to business logic layer.
For Example
I have 10 controls in presentation layer. I passing values to these controls. How the architecture works.
View 3 Replies
Dec 8, 2010
Which is the best way to pass a values from one application to another application in asp.net
View 5 Replies
Oct 4, 2010
I am looking details on the internal working of asp.net architecture. The topics need to include the following:
Asp.Net Thread/Application Pools HttpRuntime HttpApplication - When and how it is set up How HttpContext is set up How objects can passed along the pipeline using HttpContext.Current.Items Why does modification of static variables requires locks in ASP.NET (advanced)IIS 7 Integration Mode
View 1 Replies
Sep 22, 2010
i want to create a centralised business or Service authendication architecture in .net. for example, we have a clients like c1, c2, c3, c4, ... etc. everybody logins seperatly as well as grouply. ie, if client "C1" logins [with login authentication] he can access c2 , c3, c4 also without login authendication. So its like a google. if we enters gmail account, we can access orkut, picasa like that.. i need the cetralised architecture.
And, client "c1" seperately asks seperately how will be the authendication architecture.
so give me the single solution for both these two scenarios. how will be the architecture for these two and how is the Data Base (Login) Structure.
View 3 Replies
Dec 25, 2010
recently i've studied on ADO.NET's Entity Model Framework and say 'wow' as ORM is one of the fevourite pattern i practice..but suddenly i've come to an ambiguous situation when i'm going to start. i usually follow the following 3-tier architecture..
1. UI Layer
2. BLL - business logic layer
3. DAL - Data Access Layer
a. DTO / DAO
b. Gateway (contains the sql query/stored procedure and connection with DB)
now when i'm going to use the Entity Model Design,where the DBML/ .edmx File should be placed? Because many a times i'm using the DBML file as DTO because of the mapped objects.. in the same time, sometimes DBML ( .edmx file in .NET 4.0) contains CRUD methods and stored procedured method as well as methods with different selection operations,- which should be in Gateway. so where the .edmx file should be placed !?!! IN DTO namespace !? or in Gateway namespace!
moreover sometimes there is no need for the BLL which breaks the rules of inter-layer-communication (UI > BLL > DAL.Gateway)! what makes me confuse is, what should be the ideal n-tier architecture when i'll use the ADO.NET Entity Model Design Framework
View 4 Replies
Jul 30, 2010
I am working on 3 tier architecture: UI, BL, DAL. In my UI i have following code for Asynchronous page processing:
[Code]....
But I want a database fetch operation to be performed in this asyncronous method. And due to 3 tier arch. i am unable to do this in UI Layer. Can anyone guide me that how can I implement Asynchronous processing in 3 tier architecture? Note: If you are going to place EndAsyncWork1 in DAL then show that how can I return a value back to UI layer from this function.
[Code]....
View 1 Replies
May 20, 2010
I want to know that What are the factors if we use methods on each .cs page for connection and executing query on each aspx code behind page rather then using BAL .
How our application get affected in terms of performance and speed or other way?
when we put our website on server after publish/compile in general approach (using query in C# code behind) rathor than using stored procedures?
then which logic is better and why ?
View 8 Replies
Apr 28, 2010
I have implemented the 3-tier architecture project; DAL, BAL, and presentation layer are three layers in it. I am going to implement the following scenario:
Presentation layer calls to a function in the BAL layer which returns 2 string variable, and in turn this function from BAL layer calls to a DAL layer function which also returns 2 string variable. How can I implement the above scenario?
View 2 Replies
May 13, 2010
I'm developing a n-tier architecture... I'm confused with handling exception in the layers... Is it a good practise to add a Exception Layer to the architecture.
View 3 Replies
Jun 12, 2010
I am a newbie to asp.net and work in a firm where the projects are quite small.
I was told by my manager that in a few weeks or so we would be getting a bigger project and I need to be well versed with Design Patterns and N tier arcihtecture.
I would really appreciate if someone could provide me some links and also drop me a few sentences on how this things are useful?
View 4 Replies
Dec 22, 2010
I am going to create the SAAS (Software as a service) Application. Can you please provide all the attributes that we have to consider in SAAS application (for example usability, pluggable architecture etc .. )
How architecture should be build for this project, provide sample architecture for SAAS application. This architecture should be easy to upload and upgrade or degrade the features. Error handling should be easy.
View 2 Replies
Aug 10, 2010
I am try to create architecture design for WCF service.
We have WCF service that we have to expose to third party so then can request with xml and get back xml response.
The wcf service should do the following:
- Accept the request call with xml
- Check xml against the schema
- Parse the xml
- Authenticate the incoming xml by username and password that will be in xml
- Send back the response
If anybody can let me know what kind of design I can use or is there any pattern available that I can take it and then extend it as per my requirement.
View 2 Replies
Mar 9, 2011
It's Possing to make a web site a web site to be extended using plugins?im planing to make a bugtracker using the webforms in aps.netbut icant find a tutorial about how to make it extendable
View 3 Replies
Mar 2, 2010
guide in typical 4 layered architecture (having User Interface, Custom Types, Business Logic, Data Access Layer) do we follow some design pattern ? I am not clear what pattern it is or what pattern it should be called.
View 3 Replies
Feb 5, 2011
am creating service oriented application , I am calling all my services through jquery but I am having a problem that I dont feel writing jquery calling scripts from the page and exposing the service names is something goood....like at least I shall have only one class that's calling , so...I am having some kind of problem to find the most suitable architecture about that
View 2 Replies
Nov 30, 2010
I am trying to use a 3-tier architecture (UI, BAL & DAL) for my project. I have each of the tier in different physical machines.
UI - Machine 1
BAL - Machine 2
DAL - Machine 3
How can DAL & BAL interact? What would be the best way to call one component from another?
View 9 Replies
Aug 19, 2010
was giving a though on using ajax enabled wcf services as part of architecturegenerally wht im usingis UI-> BL-> data accessis it suggestable to use wcf services layer insteadof BLnd hv UI-> services-> data accessrelated to asp.netwould like to no pro's and con's of doing this thing.
View 2 Replies
Mar 29, 2011
I was tasked to create 3 tier web application. However, i browsed through many books & tutorials. The examples are doing it using Object data source which my lecturers claimed that it is not 3 tier at all. Shouldn't be dragging any data source into deisgn view. Any comprehensive examples for me to take reference from?
View 4 Replies
Aug 18, 2010
i want to develop an application in asp.net using 3 tier architecture .
i know that there are three layers
Data layerBusiness Layer
Data Access LayerBusiness Logic Layer Presentation Layer. I am confused between Data Access Layer and Business Logic Layer.
In data access layer we develop the property classes and main class function which returns datasets, datatables and data reader to Presentation layer.
what is the use of Business Logic Layer ? what actually we do in Business logic Layer
?? we can pass data directly from data access layer to presentation layer ?
View 6 Replies
Feb 5, 2010
i am in the process of creating 3 tier architecture for ASP.net with Microsoft Studio 2005.
My architerture is as below
Presentation Layer Business Logic Layer Data Access Layer
-------------------------- --------------------------- -------------------------------
Form1 BLTable1 DaTable1
(NameSpace = MyCompany.MyProject.BL. BLTable1) (NameSpace = MyCompany.MyProject.DA. DaTable1)
Form2 BLTable2 DaTable2
(NameSpace = MyCompany.MyProject.BL. BLTable2) (NameSpace =
MyCompany.MyProject.DA. DaTable2)
Form3 BLTable3 DaTable3
(NameSpace = MyCompany.MyProject.BL. BLTable3) (NameSpace = MyCompany.MyProject.DA. DaTable3)
I have 2 question here:
(1).MSDN say that we should not have the namespace where its name is same with class name but it does not exlpain why.Does anyone know why? The msdn page is
http://msdn.microsoft.com/en-us/library/893ke618%28VS.71%29.aspx
(2). Business Logic Layer BLTable1 need to interact with Data Access Layer
DaTable1 , so i put the code: imports MyCompany.MyProject.DA. DaTable1 inside
BLTable1, so that i can have access to all the public shared method inside
DaTable1 in BLTable1 for example : DaTable1.Save()
But problem arise when BLTable1 want to use the public shared method in BLTable2 .
I have put the code imports MyCompany.MyProject.BL. BLTable2 inside BLTable1,but i need to
key in the class name twice only can access to the public shared method inside
BLTable2 for example :BLTable2.BLTable2.Save.
View 1 Replies