Exemplo n.º 1
0
        public void InsertNetworkTariff(AirtimeBilling.Core.Entities.NetworkTariff entity)
        {
            if (entity == null) return;

            using (var db = DbFactory.GetDataContext())
            {
                var tariff = new NetworkTariff();
                PopulateNetworkTariffFromEntity(entity, ref tariff);

                db.NetworkTariffs.InsertOnSubmit(tariff);
                try
                {
                    db.SubmitChanges();
                    entity.Inserted(tariff.NetworkTariffId);
                }
                catch (ChangeConflictException)
                {
                    // Try again if there's a concurrency error
                    db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, db.NetworkTariffs);
                    db.SubmitChanges();
                }
            }
        }
Exemplo n.º 2
0
 private void PopulateNetworkTariffFromEntity(AirtimeBilling.Core.Entities.NetworkTariff entity, ref NetworkTariff tariff)
 {
     tariff.Code = entity.Code;
     tariff.IsCountedInFreeCall = entity.IsCountedInFreeCall;
     tariff.NetworkId = entity.NetworkId;
     tariff.Tariff = entity.Name;
     tariff.HasFlagfall = entity.HasFlagfall;
 }
Exemplo n.º 3
0
        private AirtimeBilling.Core.Entities.NetworkTariff PopulateEntityFromNetworkTariff(NetworkTariff tariff)
        {
            AirtimeBilling.Core.Entities.NetworkTariff entity = null;
            if (tariff != null)
            {
                entity = new AirtimeBilling.Core.Entities.NetworkTariff(tariff.NetworkTariffId)
                {
                    Code = tariff.Code,
                    Name = tariff.Tariff,
                    IsCountedInFreeCall = tariff.IsCountedInFreeCall,
                    NetworkId = tariff.NetworkId,
                    HasFlagfall = tariff.HasFlagfall
                };
            }

            return entity;
        }