I am looking for some advice. I have been developing for about 11 years on the Oracle EnterpriseOne platform and am now making the leap to c#. So I am no stranger to programming but there are a couple of concepts I am struggling to tie up in my head when creating c# ASP.NET webpages.
I have the following scenario:
So I have an order header + an order detail table and I want to create a new order, there could potentially be multiple order lines for each order header.
In EnterpriseOne I would have a landing screen where could search, select and add new orders. When you click the add button i would load a header screen (no grid) where you would enter all the order header info, common to all order detail records. When clicking OK (to the header screen) I would display a detail screen (grid) where you could add the multiple order detail records.
So how do I do this in c# ASP.NET 2.0? I would like to create an N-tier application.
- I have created new classes (OrdersHeader + Order Detail) which match to my order header and order detail tables.
- I have created a new class (OrdersDB) which interacts with the order header/detail classes and the database (using ADO.NET and stored procedures).
- On the landing screen I have created an ObjectDataSource pointing to OrdersDB and the SelectMothod… so this will return a collection of OrderDetails and allow the user to seach and select on existing orderdetails.
- I create a header screen (when they click add) which will contain a list of text boxes +labels. When clicking OK I will create a instance of a new OrderHeader class from the values on screen and pass to the insert method of OrdersDB. is this correct?
- On the details screen which control should I use to let the user add order details? I was assuming I could use the GridView which was set up to allow Inserting but when inquiring on an empty DB this is bringing back a blank grid (and now allowing me to add new rows).
I hope thats clear enough. I am sure it is obvious what i need to do, but i think years of working in another platform has confused the issue for me.
It really depends on the UI you are catering for.
If you want a single screen where you can basically directly edit rows in the database (edit values, delete records, add records) your probably looking for a GridView
It also depends on your comfort level/experience with ASP.NET Web Forms. Web Forms is great in the “drag and drop” sense (which IMO is also it’s downfall). Meaning you can chuck a control on a page and be ready to go.
But sometimes it’s overkill. I prefer to use the web controls only when absolutely necessary.
I would be keeping with a simple form, basic form fields, then constructing the entity on the server and passed onto the business tier for validation and persistence. Have full control over the process.
By the way, i don’t see in your question how any of your solutions so far is N-Tier? If you want N-Tier, you should be communicating with your data tier (which would be on a seperate computer to your web tier) via some sort of web service (ie WCF), no directly calling
OrdersDB