>> >>using MyCompany.MyApp.Business.MyBiz; >> >>namespace MyCompany.MyApp.WinUI.MyUI >>{ >> public class MyForm : MyBaseForm >> { >> private long CustomerKey; >> private MyDataSet dsData; >> private CustomerBiz oBiz; >> >> public MyForm(long key) >> { >> this.CustomerKey = key; >> InitializeComponent(); >> this.FillData(); >> } >> >> public void FillData() >> { >> // To simplify, I'm directly calling a Biz class. >> // In reality, I use a Web Service here instead >> // which in turn calls the Biz class. >> >> oBiz = new CustomerBiz(); >> dsData = oBiz.GetCustomer(this.CustomerKey); >> } >> } >>} >>>>Now in your MyBiz project, you'd have a Biz class:
>>using MyCompany.MyApp.DataAccess.MyDataAccess >> >>namespace MyCompany.MyApp.Business.MyBiz >>{ >> public class CustomerBiz >> { >> private MyDataSet dsData; >> >> public MyDataSet GetCustomer(long CustomerKey) >> { >> CustomerAccess oDA = new CustomerAccess(); >> this.dsData = oDA.GetCustomer(CustomerKey); >> >> // if you have other Biz things to do to this customer >> // do it here before returning the DataSet >> >> return this.dsData; >> } >> } >>} >>>>And, lastly, in your MyDataAccess project, you'd have this class:
>>namespace MyCompany.MyApp.DataAccess.MyDataAccess >>{ >> public class CustomerAccess >> { >> public MyDataSet GetCustomer(long CustomerKey) >> { >> // Here's where you'd put all the SqlCommand and DataAdapter stuff >> // and fill your DataSet. >> >> return dsData; >> } >> } >>} >>>>Now, that's the "simple" version, just to get the concept. Let's take it a step further: