Beispiel #1
0
        public void Save()
        {
            if (!String.IsNullOrEmpty(this.GalleryImage))
            {
                using (PhotoGalleryDataContext db = PhotoGalleryDataContext.GetDataContext()) {
                    tblGalleryImageMeta gal = (from c in db.tblGalleryImageMetas
                                               where c.GalleryImage.ToLower() == this.GalleryImage.ToLower()
                                               select c).FirstOrDefault();

                    if (gal == null || this.GalleryImageMetaID == Guid.Empty)
                    {
                        gal                    = new tblGalleryImageMeta();
                        gal.SiteID             = this.SiteID;
                        gal.GalleryImageMetaID = Guid.NewGuid();
                        gal.GalleryImage       = this.GalleryImage;
                    }

                    gal.ImageTitle    = this.ImageTitle;
                    gal.ImageMetaData = this.ImageMetaData;

                    if (gal.GalleryImageMetaID != this.GalleryImageMetaID)
                    {
                        db.tblGalleryImageMetas.InsertOnSubmit(gal);
                    }

                    db.SubmitChanges();

                    this.GalleryImageMetaID = gal.GalleryImageMetaID;
                }
            }
        }
        public void Save()
        {
            using (PhotoGalleryDataContext db = PhotoGalleryDataContext.GetDataContext()) {
                tblGallery gal = (from c in db.tblGalleries
                                  where c.GalleryID == this.GalleryID
                                  select c).FirstOrDefault();

                if (gal == null || this.GalleryID == Guid.Empty)
                {
                    gal           = new tblGallery();
                    gal.SiteID    = this.SiteID;
                    gal.GalleryID = Guid.NewGuid();
                }

                gal.GalleryTitle = this.GalleryTitle;

                if (gal.GalleryID != this.GalleryID)
                {
                    db.tblGalleries.InsertOnSubmit(gal);
                }

                db.SubmitChanges();

                this.GalleryID = gal.GalleryID;
            }
        }
Beispiel #3
0
        public List <GalleryImageEntry> GalleryImageEntryListGetByGalleryID(Guid galleryID)
        {
            using (PhotoGalleryDataContext db = PhotoGalleryDataContext.GetDataContext()) {
                List <GalleryImageEntry> ge = (from c in db.tblGalleryImages
                                               where c.GalleryID == galleryID
                                               select new GalleryImageEntry(c)).ToList();

                return(ge);
            }
        }
Beispiel #4
0
        public GalleryImageEntry GalleryImageEntryGetByID(Guid galleryImageID)
        {
            using (PhotoGalleryDataContext db = PhotoGalleryDataContext.GetDataContext()) {
                GalleryImageEntry ge = (from c in db.tblGalleryImages
                                        where c.GalleryImageID == galleryImageID
                                        select new GalleryImageEntry(c)).FirstOrDefault();

                return(ge);
            }
        }
Beispiel #5
0
        public List <GalleryGroup> GalleryGroupListGetBySiteID()
        {
            using (PhotoGalleryDataContext db = PhotoGalleryDataContext.GetDataContext()) {
                List <GalleryGroup> ge = (from c in db.tblGalleries
                                          where c.SiteID == this.SiteID
                                          select new GalleryGroup(c)).ToList();

                return(ge);
            }
        }
Beispiel #6
0
        public GalleryGroup GalleryGroupGetByID(Guid galleryID)
        {
            using (PhotoGalleryDataContext db = PhotoGalleryDataContext.GetDataContext()) {
                GalleryGroup ge = (from c in db.tblGalleries
                                   where c.SiteID == this.SiteID &&
                                   c.GalleryID == galleryID
                                   select new GalleryGroup(c)).FirstOrDefault();

                return(ge);
            }
        }
Beispiel #7
0
        public List <GalleryMetaData> GetGalleryMetaDataListByGalleryID(Guid galleryID)
        {
            using (PhotoGalleryDataContext db = PhotoGalleryDataContext.GetDataContext()) {
                List <GalleryMetaData> imageData = (from g in db.tblGalleryImageMetas
                                                    join gg in db.tblGalleryImages on g.GalleryImage.ToLower() equals gg.GalleryImage.ToLower()
                                                    where g.SiteID == this.SiteID &&
                                                    gg.GalleryID == galleryID
                                                    select new GalleryMetaData(g)).ToList();

                return(imageData);
            }
        }
Beispiel #8
0
        public GalleryImageEntry GalleryImageEntryGetByFilename(Guid galleryID, string galleryImage)
        {
            using (PhotoGalleryDataContext db = PhotoGalleryDataContext.GetDataContext()) {
                GalleryImageEntry ge = (from c in db.tblGalleryImages
                                        where c.GalleryID == galleryID &&
                                        c.GalleryImage.ToLower() == galleryImage.ToLower()
                                        orderby c.ImageOrder ascending
                                        select new GalleryImageEntry(c)).FirstOrDefault();

                return(ge);
            }
        }
Beispiel #9
0
        public void GalleryImageCleanup(Guid galleryID, List <string> lst)
        {
            using (PhotoGalleryDataContext db = PhotoGalleryDataContext.GetDataContext()) {
                var lstDel = (from g in db.tblGalleryImages
                              where g.GalleryID == galleryID &&
                              !lst.Contains(g.GalleryImage.ToLower())
                              select g).ToList();

                db.tblGalleryImages.DeleteAllOnSubmit(lstDel);

                db.SubmitChanges();
            }
        }
Beispiel #10
0
        public GalleryGroup GalleryGroupGetByName(string galleryTitle)
        {
            GalleryGroup ge = null;

            using (PhotoGalleryDataContext db = PhotoGalleryDataContext.GetDataContext()) {
                if (!String.IsNullOrEmpty(galleryTitle))
                {
                    ge = (from c in db.tblGalleries
                          where c.SiteID == this.SiteID &&
                          c.GalleryTitle.ToLower() == galleryTitle.ToLower()
                          select new GalleryGroup(c)).FirstOrDefault();
                }
            }

            return(ge);
        }
Beispiel #11
0
        public GalleryMetaData GalleryMetaDataGetByFilename(string galleryImage)
        {
            GalleryMetaData ge = null;

            using (PhotoGalleryDataContext db = PhotoGalleryDataContext.GetDataContext()) {
                if (!String.IsNullOrEmpty(galleryImage))
                {
                    ge = (from c in db.tblGalleryImageMetas
                          where c.SiteID == this.SiteID &&
                          c.GalleryImage.ToLower() == galleryImage.ToLower()
                          select new GalleryMetaData(c)).FirstOrDefault();
                }
            }

            return(ge);
        }