Ejemplo n.º 1
0
 partial void DeleteGalleryPublicationPeriodRecord(GalleryPublicationPeriodRecord instance);
Ejemplo n.º 2
0
 partial void InsertGalleryPublicationPeriodRecord(GalleryPublicationPeriodRecord instance);
Ejemplo n.º 3
0
		private void detach_GalleryPublicationPeriodRecords(GalleryPublicationPeriodRecord entity)
		{
			this.SendPropertyChanging();
			entity.AdminUserMembershipRecord = null;
		}
Ejemplo n.º 4
0
		private void detach_GalleryPublicationPeriodRecords(GalleryPublicationPeriodRecord entity)
		{
			this.SendPropertyChanging();
			entity.CuratedGalleryRecord = null;
		}
        /// <summary>
        /// Publishes/republishes gallery
        /// </summary>
        /// <param name="userID">Gallery publisher</param>
        /// <param name="id">Unique gallery identifier</param>
        /// <param name="dtStartUTC">Publication start date</param>
        /// <param name="dtEnd">Publication end date</param>
        /// <returns></returns>
        public OperationResult<OperationResults, GalleryPublicationPeriod> Publish(int? userID, int id, DateTime dtStartUTC, DateTime? dtEndUTC)
        {
            using (var context = this.CreateMainContext())
            {
                var galleryRec = context.CuratedGalleryRecords.Where(x => x.ID == id).SingleOrDefault();

                if (galleryRec == null)
                    return new OperationResult<OperationResults, GalleryPublicationPeriod>() { Result = OperationResults.NotFound };

                if (galleryRec.StatusID == (int)CuratedGalleryStatuses.Published)
                    return new OperationResult<OperationResults, GalleryPublicationPeriod>() { Result = OperationResults.Failure };

                foreach (var item in context.GalleryPublicationPeriodRecords.Where(x => x.GalleryID == id).ToArray())
                    context.GalleryPublicationPeriodRecords.DeleteOnSubmit(item);

                var period = new GalleryPublicationPeriodRecord() { GalleryID = id, Start = dtStartUTC, End = dtEndUTC, PublisherID = userID };
                context.GalleryPublicationPeriodRecords.InsertOnSubmit(period);

                galleryRec.Editor = null;
                galleryRec.StatusID = (int)CuratedGalleryStatuses.Published;

                context.SubmitChanges();

                return new OperationResult<OperationResults, GalleryPublicationPeriod>() { Result = OperationResults.Success, Output = this.ObjectMapper.DoMapping<GalleryPublicationPeriod>(period) };
            }
        }