Esempio n. 1
0
        /// <summary>
        /// Get header and related details data by Id(key)
        /// </summary>
        /// <typeparam name="TKey"></typeparam>
        /// <param name="key"></param>
        /// <returns></returns>
        public virtual Customer GetById(string id)
        {
            CreateBusinessEntities();
            var filter = "(IDCUST = \"" + id + "\")";

            _header.Browse(filter, true);
            var headerData = (_header.Fetch(false)) ? _headerMapper.Map(_header) : null;

            _detail.ClearRecord();
            _detail.Browse(filter, true);
            // Add details records
            while (_detail.Fetch(false))
            {
                var detailData = _detailMapper.Map(_detail);
                headerData.CustomerOptionalFields.Add(detailData);
            }

            return(headerData);
        }