public Boolean LoadFromDatabase(Int64 entityId, Core.Enumerations.EntityAddressType addressType, DateTime forDate)
        {
            Boolean success = false;

            String selectStatment = "EXEC dal.EntityAddress_SelectByTypeAndDate " + entityId.ToString() + ", " + ((Int32)addressType).ToString() + ", '" + forDate.ToString("MM/dd/yyyy") + "'";

            System.Data.DataTable tableEntityAddress;

            if (base.application.EnvironmentDatabase == null)
            {
                return(false);
            }


            tableEntityAddress = base.application.EnvironmentDatabase.SelectDataTable(selectStatment);

            if (tableEntityAddress.Rows.Count == 1)
            {
                MapDataFields(tableEntityAddress.Rows[0]);

                success = true;
            }

            else
            {
                application.SetLastException(application.EnvironmentDatabase.LastException);

                success = false;
            }

            return(success);
        }
        public EntityAddress(Application applicationReference, Int64 entityId, Core.Enumerations.EntityAddressType addressType, DateTime forDate)
        {
            BaseConstructor(applicationReference);

            if (!LoadFromDatabase(entityId, addressType, forDate))
            {
                throw new ApplicationException("Unable to load Entity Address.");
            }
        }
        override public void MapDataFields(System.Data.DataRow currentRow)
        {
            base.MapDataFields(currentRow);


            entityId = (Int64)currentRow["EntityId"];


            addressType = (Core.Enumerations.EntityAddressType)((Int32)currentRow["AddressType"]);

            line1 = (String)currentRow["Line1"];

            line2 = (String)currentRow["Line2"];

            city = (String)currentRow["City"];

            state = (String)currentRow["State"];

            zipCode = (String)currentRow["ZipCode"];

            zipPlus4 = (String)currentRow["ZipPlus4"];

            postalCode = (String)currentRow["PostalCode"];

            county = (String)currentRow["County"];


            longitude = (Decimal)currentRow["Longitude"];

            latitude = (Decimal)currentRow["Latitude"];


            effectiveDate = (DateTime)currentRow["EffectiveDate"];

            terminationDate = (DateTime)currentRow["TerminationDate"];

            return;
        } // MapDataFields (System.Data.DataRow currentRow)