コード例 #1
0
        internal static void DeleteCountry(Rbr_Db pDb, CountryDto pCountry)
        {
            //NOTE: no delete, just archive for Country and Routes
            pCountry.Status = Status.Archived;

            var _countryRow = mapToCountryRow(pCountry);
            var _routeRows  = pDb.RouteCollection.GetByCountry_id(_countryRow.Country_id);

            foreach (var _routeRow in _routeRows)
            {
                _routeRow.RouteStatus = Status.Archived;
                RoutingManager.UpdateBaseRoute(pDb, RoutingManager.MapToBaseRoute(pDb, _routeRow));
            }
            pDb.CountryCollection.Update(_countryRow);
            //pDb.AddChangedObject(new BaseRouteKey(TxType.Delete, 0, _countryRow.Country_id, 0));
        }
コード例 #2
0
        internal static void UpdateCountry(Rbr_Db pDb, CountryDto pCountry)
        {
            var _original   = pDb.CountryCollection.GetByPrimaryKey(pCountry.CountryId);
            var _countryRow = mapToCountryRow(pCountry);

            pDb.CountryCollection.Update(_countryRow);

            if (_countryRow.IsNameChanged(_original))
            {
                //update names for All Country Routes (for ALL Services)
                var _routeRows = RoutingManager.GetByCountryId(pDb, _countryRow.Country_id);
                foreach (var _routeRow in _routeRows)
                {
                    _routeRow.Name = _countryRow.Name + AppConstants.SubRouteSeparator + _routeRow.BreakoutName;
                    RoutingManager.UpdateBaseRoute(pDb, RoutingManager.MapToBaseRoute(pDb, _routeRow));
                }
            }
            //pDb.AddChangedObject(new BaseRouteKey(TxType.Delete, 0, _countryRow.Country_id, 0));
        }