Example #1
0
        public long?AddDeviceWithAddress(ViewDevice d, ViewAddress a, Guid userId)
        {
            Trace.Assert(_db != null);
            ObjectResult <long?> result =
                _db.AddDeviceWithAddress(d.Name, d.InternalAddress, d.AddressType, d.Port,
                                         d.GroupID, d.TypeID, d.OwnerID,
                                         d.IP1, d.IP2, d.IP3, d.IP4, d.SecondaryPort,
                                         d.SecondaryIP1, d.SecondaryIP2, d.SecondaryIP3, d.SecondaryIP4,
                                         a.Apartament, a.Building, a.Street, a.City, a.State, a.Country, a.ZipCode,
                                         userId);

            Trace.Assert(result != null);
            IEnumerator <long?> resultList = result.GetEnumerator();

            Trace.Assert(resultList != null);
            resultList.MoveNext();
            long?deviceId = resultList.Current;

            resultList.Dispose(); //  for transaction to be able to complete
            return(deviceId);
        }