예제 #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;
                }
            }
        }
예제 #2
0
        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;
            }
        }
예제 #3
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();
            }
        }