Forms Data Controls :: How To Implement Datagrid Events In Business Layer
Jan 28, 2010
<p>Dear All </p> <p>i am developing a small asp.net application in vs 2005. my application consists of 3 layers.presentation, business layer and data layer. now i got a small problem in using datagrid events like itemcommand , databound events in presentation layer. </p><p>this is my first asp.net application with different layers , upto now i dint work with layers. i created datagrid as follows in my page load i craeted an instance for my businesslayer as </p><p>
mywebsite businesslayer .customerinfo cs = new mywebsite businesslayer .customerinfo();
</p><p>
in customer info i have a function to bind the grid
now i want to add itemcommand event ad databound events. can any one advice me how to add these events and where should i have to add these events? </p><p>
I'am using enterprise library data access block in my asp.net application. I want to implement transaction from the Business logic layer, across multiple stored procs. Entlib opens a new connection for database access. Does using Transaction Scope in the following way lead to distributed transaction?
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required)) { // calling necessary DAL methods scope.Complete(); }
Is there better methods to implement transaction from BLL?
Lets assume that I have my own business layer containing my business objects and my business services. And I have decided to create a "SilverLight Business Application" (with SL v 4.0) and I want to use my already used Business Layer from the SL application I plan to develop.
I know that I cannot include a project which is not a SL project.
I am building a web site following the tutorials on asp.net. I am using dataset as data access lay, and writing classes to access the dataset. But the example is just basic ideas, how do I retrieve individual table column value in the business layer?For example, if I have a table called Product, I only want to find out what is the product name by product id. I did this in my ProductBLL:
public ProductBLL { public int GetProductName(string productId) { ProductDataSet.ProductDataTable prodData = Adapter.GetProductById(productId); [code]...
Is there a better way, or am I doing this correctly? Can anybody give me a reference to a more complicated business logic model?
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.
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.
I've even got my JQuery Ajax submission going on now but I've encountered another problem. I *think* it's something to do with the structure I'm using but like I say, I'm fairly newo this.I have my AJAX form submission which builds my "PersonViewModel" (model for the presentation layer) in JSON and sends it to "@Url.Action("RegisterSubmit")" in my Person Controller. Now, I seperate my business layer from my View/presentation layer so in "RegisterSubmit"I'm verifying the model is valid then instantiating a new instance of my business model "Person", adding the values from "PersonViewModel" and then calling my "Save" function.
We're building a large web app that has numerous layers. In order to communicate to the business layer we're using a service layer that the web layer calls when data is needed. Unfortunately, it seems that if exceptions are thrown in the business layer, it seems that the services on the web side are wrapping the exceptions and re-throwing them. We're looking for a clear way to encapsulate the error and log it, without WCF wrapping a new exception around the original.
I'm trying to reevaluate our n-layer architecture and would love to get some based on your experiences. Here is our typical .NET n-layer (sometimes n-tier) design.
DataAccess typically consists of Entity Framework 4 and Repository classes. I attempt to follow the Aggregate Root concept in order to avoid having a repository for table, easier said than done in my experience. I tend to have ~70% match between Repositories and Tables.
Model usually consists of my Entity Framework 4 entities, I've been using Self-Tracking EF entities with success.
Business is what I struggle with the most. I typically have a Manager class for every Repository. This class will contain methods like .Add() which will perform business validation before forwarding down to repository.Add().
Services, typically I will only implement this if in fact I am looking to create a web service based solution. This layer will be tasked with marshaling requests/responses between DTOs and entities. And most importantly provide the more coarse grained interface. For example a TradingService.SubmitTrade(), which is really a facade for a business transaction which might include AccountManager.ValidateCash(), OrderManager.SubmitOrder(), etc.
My business layer is very entity centric, really it's just the glue between the entities and the repository, with validation in between. I've seen many designs where the Service Layer is what holds a reference to the repositories (in essence skipping the "business layer"). In essence it serves the same purpose as my Business layer, it does the validation, however its' responsibility (and naming) is a higher level, more coarse grained business transaction. Using the example above the TradingService.submitTrade() will not delegate to any business manager classes, it would itself query the necessary repositories, perform all the validation etc.
I like my design in a sense that I can reuse a business layer method in multiple service calls, however I hate the fact that for every repository I have a matching business layer manager, creating tons of extra work. Maybe the solution is a different type of grouping at the Business Layer level? For example combine individual Manager classes like PhoneManager and EmailManager (note I have Phone entities and Email entities) into a logical Manager class such as ContactsManager (note I don't have a "Contact" entity type). With methods such as ContactManager.GetPhones() and ContactManager.GetEmail(), etc.
I have a datagrid in aspx page.Inside of datagrid i am using around 15 controls such as Button,dropdownlist and text box
controls.Once the datagrid binds then the events in the aspx page not firing.Issue occured when the number of rows greater than 500.The number of rows less then its works fine.
i am using asp net 2.0 and mysql. I need to implement a datagrid with the possibility to update a record but i am having problems and i don't know why.
this is the code:
[Code]....
the primary key of the table is a composed key fot IdOrdine and IdMezzo.
I know there are a few posts on this issue already, however I haven't found the answers I was really looking for.
My situation is like this: I have a DLL project containing my business logic. Then I have a web application that refers to this DLL, and calls a function from it. And I have a global.asax which handles errors on Application_Error
Code: public Northwind.ProductsDataTable GetProducts() { [Can I use Linq here?] return Adapter.GetProducts(); } I followed the way of using Business Layer through this tutorial and I'm wondering how I can use LINQ there:
I am implementing 3-tier architecture. I just wanted to know the role of business layer in 3-tier architecture.
I am developing application in using entity framework. So I have entity object which is accessiable in PL,BL & DL. My question is whether input assignment to entity object should be in PL OR BL.(Consider there is save method)
What is the best way (for a .Net 4 project) to implement authorization in the business layer. Simply I want to check whether a certain identity can access a certain action/resource.
I've tried to look this up in Patterns & Practices, but haven't found anything useful yet.
And what about PrincipalPermission of ASP.Net 2.0? Is this still relevant? What about maintenance?
I want to use an elegant solution, preferably (re)using asp.net role management.
I have a application with a 3-tier architecture. Onclick event of a button, I am calling a method in my code behind file. This method is defined in the Interface( Interface resides in my Business layer) and the implemtation of this method is given in the Data access layer.
The business layer and DAL are on different projects. I have compiled the entire solution and it complies OK. Now when I try to click the button I get the error:
"The method 'doInsertCust' was not found on the interface/type 'My.Type, MyTypeLibrary, Version=1.0.2371.15203, Culture=neutral, PublicKeyToken=null'.".
Note that I have already build the Business layer and DAL and the respective DLL gets automatically refreshed.
UI Business DataAccess Here, I'm calling a SP from Data Access layer which will populate a DataTable and return the DataTable back to Business. My source code is like below.
[Code]....
Here, when I set debugpoint I can see the DataTable is getting populated by the data so my
sp idreturning the data. there is no issue with the sp and dataaccess layer method. The problem lies below on my business layer. The source code is like below.
I have a application with a 3-tier architecture. Onclick event of a button, I am calling a method in my code behind file. This method is defined in the Interface( Interface resides in my Business layer) and the implemtation of this method is given in the Data access layer.
The business layer and DAL are on different projects. I have compiled the entire solution and it complies OK. Now when I try to click the button I get the error:
"The method 'doInsertCust' was not found on the interface/type 'My.Type, MyTypeLibrary, Version=1.0.2371.15203, Culture=neutral, PublicKeyToken=null'.".
Note that I have already build the Business layer and DAL and the respective DLL gets automatically refreshed.
I am creating an ASP.NET MVC application and want to display an icon in the view based on a value of a property in the model. I guess I want to have the logic deciding which image to show in the business layer (which is in a separate class library project) but the actual images files in the web application's "Content" folder. Should I set the url of the image in the business layer? I don't want the business layer to know that is serves a web application, it can be a Windows Form or WPF application as well. If I set the url with System.Web.HttpContext.Current.Server.MapPath it feels like I am getting an unwanted dependency on System.Web, right? What are the options here?
I am working on implementing a web application in ASP.Net by following the MVC design pattern (Not ASP.Net MVC). As part of the design, we have entity objects that has only properties as per the corresponding table structure and the idea is using these entity objects in the view layer and the same entity objects are passed to Persistence Layer for saving the data to the database. Business Objects in the business layer are responsible for interacting with the database.
As view creates the entity objects and passes to next layer, what would be the best practice to pass the entity objects to the business layer? Should the business objects accept data objects as parameters and interact with the persistence layer? Is there any other best practice to pass the required objects from the view layer to the next layer? As business objects also need to access the properties of the entity objects passed from the view layer, do we need any "translation" from entity objects to business objects?
the best practices to pass entity objects from view layer to the next layer and also how the entity objects created by the persistence layer can be used by business objects?
I'm working on an application using a 3 tier architecture and I'm having issues with a business layer select method. Basically, I have a gridview control that is populated by an objectDataSource. The ObjectDataSource calls a select method in the my business logic layer to retrieve data. When the business logic layer calls a table adapter method, I receive the following error message:
Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints
This is my first attempt at a 3 tier design and I'm not sure where to start with the debugging process.
Also, the stored procedure that is used by the table adapter select method, creates a new column inside of the query. This column is not included in the datasets datatable. I manually inserted a new column into the datatable from the dataset designer. The new column was created to store the values that are being returned from the new column in the stored procedure. I'm not sure if this is the correct way to do this or not but it allowed me to access the column in the business logic layer methods.
I need my linq to sql datacontext to be available across my business/data layer for all my repository objects to access. However since this is a web app, I want to create and destroy it per request. I'm wondering if having a singleton class that can lazily create and attach the datacontext to current HttpContext would work. My question is: would the datacontext get disposed automatically when the request ends? Below is the code for what I'm thinking. Would this accomplish my purpose: have a thread-safe datacontext instance that is lazily available and is automatically disposed when the request ends?
public class SingletonDC { public static NorthwindDataContext Default { get { NorthwindDataContext defaultInstance = (NorthwindDataContext)System.Web.HttpContext.Current.Items["datacontext"]; if (defaultInstance == null) { defaultInstance = new NorthwindDataContext(); System.Web.HttpContext.Current.Items.Add("datacontext", defaultInstance); } return defaultInstance; } } }
I am trying to estimate how long it will take to migrate a Classic ASP application to .NET and came across hundreds of COM functions written in VB 6.
A majority of these functions only do parameter validation and actually calls the SQL server. Is this something that should be replace with an ORM? (Linq, nHibernate, Entity Framework)... or should there be more to this picture?
As I began writing web applications with asp.net I started with small projects that used a Linq-To-SQL mapper for database access to a MSSQL Server. After gaining some expierence I switched into a classic 3 tier with Graphic Layer, Business Layer, Data Layer. The only function of the Data Layer was to provide methods insert/update/delete without any logic and logic the form of selection methods.
Over the time I realized that it would be better not to provide the database classes up to the GUI (took some time unfortunately). I switched into using Business classes in the BL that are used for all operations performed by the BL and display by the GUI in the form of getting List from the BL. A great advantage is that I can provide additional properties that are not represented by the database itself. However, I did that mapping inside the BL myself with methods that mapped the corresponding BL class to the database class.
I guess thats where O/R mapper come in handy? Until now I haven't realized their purpose, but I think I just found it. I've recently tried out using the new Entity Framework with .net framework 4, but I'm only using it like the Linq-To-SQL DataContext.
Is there a way to achieve the mapping automatically? If yes, is that something the new Entity Framework provides or do I need to look for a O/R Mapper like NHibernate?