static NoEventSeriesMixin() {
     NoEventSeries = new EventSeries()
     {
         CollectionSeriesID = null,
         Description = DiversityResources.EventSeries_NoES_Header,
         ModificationState = ModificationState.Unmodified,
         SeriesCode = string.Empty,
         SeriesStart = DateTime.MinValue,
         SeriesEnd = DateTime.MinValue
     };
 }
        public IObservable<Unit> InsertEventSeries(EventSeries series, IEnumerable<ILocalizable> localizations)
        {
            var res = InsertESCompleted.FilterByUserState(series)
                .PipeErrors()
                .Select(p => p.Result)
                .StoreMapping(series, Mapping)
                .ReplayOnlyFirst();

            var svcLocs = new ObservableCollection<Svc.Localization>(localizations.Select(l => l.ToServiceObject()));
            _svc.InsertEventSeriesAsync(series.ToServiceObject(), svcLocs, this.GetCreds(), series);
            return res;
        }
        public int InsertEventSeries(EventSeries series, IEnumerable<Localization> localizations, UserCredentials login)
        {
            using (var db = login.GetConnection())
            using (var t = new Transaction(db))
            {
                db.Insert(series);

                var geoString = SerializeLocalizations(localizations);
                if (!string.IsNullOrWhiteSpace(geoString))
                    db.Execute("UPDATE [dbo].[CollectionEventSeries] SET geography=GEOGRAPHY::STGeomFromText(@0, 4326) WHERE SeriesID=@1", geoString, series.CollectionEventSeriesID);

                t.Complete();
                return series.CollectionEventSeriesID;
            }
        }
        public int InsertEventSeries(EventSeries series, IEnumerable<Localization> localizations, UserCredentials login)
        {
            using (var db = login.GetConnection())
            using (var t = new Transaction(db))
            {
                db.Insert(series);

                var geoString = SerializeLocalizations(localizations);
                if (!string.IsNullOrWhiteSpace(geoString))
                    db.Execute("Update [dbo].[CollectionEventSeries] Set geography=@0 Where SeriesID=@1", geoString, series.CollectionEventSeriesID);

                t.Complete();
                return series.CollectionEventSeriesID;
            }
        }
 internal static IQueryable<Localization> GeoPoints(EventSeries es, DiversityDataContext ctx)
 {
     return from gp in ctx.GeoTour
            where gp.RelatedID == es.SeriesID
            select gp;
 }
 internal static IQueryable<Event> Events(EventSeries es, DiversityDataContext ctx)
 {
     return from ev in ctx.Events
            where ev.SeriesID == es.SeriesID
            select ev;
 }
 internal static IQueryable<GeoPointForSeries> GeoPoints(EventSeries es, DiversityDataContext ctx)
 {
     return from gp in ctx.GeoTour
            where gp.SeriesID == es.SeriesID
            select gp;
 }