Page 168 - DCAP312_WEB_TECHNOLOGIES_II
P. 168

Web Technologies-II



                   Notes         Here is the code for the IBusinessEntity interface:
                                           public interface IBusinessEntity
                                           {
                                           Object Code
                                           {
                                           get;
                                           set;
                                           }
                                           }
                                 The IBusinessEntity interface exposes one property called Code, which functions as a unique
                                 ID. Using the IBusinessEntity interface as the base interface or contract for all entities ensures
                                 that you can reuse the data binding framework code with any business object. Here is the code
                                 for the EmployeeDO class:

                                           public class EmployeeDO : Component, IBusinessEntity
                                           {
                                           private object code;
                                           private string empName;
                                           private string empAddress;
                                           public Object Code
                                           {
                                           get {return code; }
                                           set {code = value; }
                                           }
                                           public String EmpName
                                           {
                                           get {return empName; }
                                           set {empName = value; }
                                           }
                                           public String EmpAddress
                                           {
                                           get {return empAddress; }
                                           set {empAddress = value; }
                                           }
                                           }
                                 Create a Container
                                 Next, you need a container in which to store the data binding information. You will use this
                                 information to bind the controls to the appropriate property of the business object at runtime.
                                 This DataBindingRegister class serves that purpose. It holds the data binding information for
                                 each control along with the corresponding property of the business object to which the control
                                 will be bound.

                                 Here is the source code for the DataBindingRegister class:
                                           Public class DataBindingRegister
                                           {

        162                               LOVELY PROFESSIONAL UNIVERSITY
   163   164   165   166   167   168   169   170   171   172   173