Example #1
0
        public static AreaContract ToContract(this CD_Area entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var contract = new AreaContract();

            contract.ID           = entity.ID;
            contract.OLD_ID       = entity.OLD_ID;
            contract.ParentID     = entity.ParentID;
            contract.Code         = entity.Code;
            contract.CraCode      = entity.CraCode;
            contract.GeoName      = entity.GeoName;
            contract.EngName      = entity.EngName;
            contract.TypeID       = entity.TypeID;
            contract.RecordType   = (entity.DateDeleted == null) ? RecordTypesEnum.Active : RecordTypesEnum.Inactive;
            contract.NewCode      = entity.NewCode;
            contract.DateChanged  = entity.DateChanged;
            contract.DateCreated  = entity.DateCreated;
            contract.DateDeleted  = entity.DateDeleted;
            contract.AreaType     = entity.AreaType.ToContract();
            contract.PhoneIndexes = entity.PhoneIndexes.ToContracts();

            return(contract);
        }
Example #2
0
        public static CD_Area ToEntity(this AreaContract contract)
        {
            if (contract == null)
            {
                return(null);
            }

            var entity = new CD_Area();

            entity.ID          = contract.ID;
            entity.OLD_ID      = contract.OLD_ID;
            entity.ParentID    = contract.ParentID;
            entity.Code        = contract.Code;
            entity.CraCode     = contract.CraCode;
            entity.GeoName     = contract.GeoName;
            entity.EngName     = contract.EngName;
            entity.TypeID      = contract.TypeID;
            entity.NewCode     = contract.NewCode;
            entity.DateChanged = contract.DateChanged;
            entity.DateCreated = contract.DateCreated;
            entity.DateDeleted = contract.DateDeleted;

            return(entity);
        }