GreenRock Software Code Comment

February 19, 2008

Filed under: DTO Classes — greenrocksoftware @ 11:07 am

This code is part of an application that demonstrates our adopted approach to the separation of GUI and database. The EntityInfo tier is used as a container to carry data objects in and out of the DAL as well as holding the attribute data for BLL objects.

This code is an example of a DTO class.

using System;

using System.Collections.Generic;

using System.Text;

using System.Xml;

using System.Xml.Serialization;

 

namespace EntityInfo

 

{

    // EntityInfo object used to pass data to the data access layer

    public class UserInfo

    {

        #region private members

        private string _login;

        private string _password;

        private string _firstname;

        private string _lastName;

        private string _address;

        private string _city;

        private string _state;

        private string _zip;

        private string _phone;

        #endregion private members

        #region properties

        [XmlAttribute(“Login”)]

        public String Login

        {

            get { return _login.Trim(); }

            set { _login = value; }

        }

        [XmlAttribute(“Password”)]

        public String Password

        {

            get { return _password.Trim(); }

            set { _password = value; }

        }

        [XmlElement(“First Name”)]

        public String FirstName

        {

            get { return _firstname; }

            set { _firstname = value; }

        }

        [XmlElement(“Last Name”)]

        public String LastName

        {

            get { return _lastName; }

            set { _lastName = value; }

        }

        [XmlElement(“Address”)]

        public String Address

        {

            get { return _address; }

            set { _address = value; }

        }

        [XmlElement(“City”)]

        public String City

        {

            get { return _city; }

            set { _city = value; }

        }

        [XmlElement(“State”)]

        public String State

        {

            get { return _state; }

            set { _state = value; }

        }

        [XmlElement(“Zip”)]

        public String Zip

        {

            get { return _zip; }

            set { _zip = value; }

        }

        [XmlElement(“Telephone”)]

        public String Phone

        {

            get { return _phone; }

            set { _phone = value; }

        }

        #endregion properties

 

        #region constructors

 

        public UserInfo()

        {

        }

        public UserInfo(string login, string password, string firstname, string lastName, string address, string city, string state, string zip, string phone)

        {

            this.Login = login;

            this.Password = password;

            this.FirstName = firstname;

            this.LastName = lastName;

            this.Address = address;

            this.City = city;

            this.State = state;

            this.Zip = zip;

            this.Phone = phone;

        }

    #endregion constructors

    }

}

 

Blog at WordPress.com.