예제 #1
0
 public void Save(IBulletinRepository rep)
 {
     try
     {
         if (!IsNew & IsDeleted)
         {
             /* [Delete] an existing object marked for deletion */
             //dc.BulletinDelete(_id);
         }
         else
         {
             /* Exception will cause the transaction to rollback */
             if (IsNew)
             {
                 /* [Insert] a new and valid object to be saved */
                 this.Id = rep.Insert(BuildInteface(false));
                 rep.InsertContent(BuildInteface(true));
             }
             else if (!IsNew & IsDirty)
             {
                 /* [Update] a existing, but changed object to be saved */
                 rep.Update(BuildInteface(true));
             }
         }
         MarkOld();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #2
0
        public static BulletinBase LoadForGallery(int galleryId, IBulletinRepository bRep)
        {
            var bulletin = bRep.FetchOnGalleryId(galleryId);
            var obj      = ((BulletinBase)Reflector.CreateObject(bulletin.BulletinType.Assembly, bulletin.BulletinType.Class, new[] { bulletin })).Desrialize(bulletin.Content.ToString());

            obj.BulletinType = new BulletinType(bRep.FetchType(bulletin.BulletinType.BulletinTypeId));
            obj.MarkOld();
            return(obj);
        }
예제 #3
0
        public static CollectionBase <BulletinBase> GetAll(ILookupRepository lRep, IBulletinRepository bRep)
        {
            var bulletins = new CollectionBase <BulletinBase>();

            bulletins.AddRange(bRep.FetchList().Select(bulletin =>
                                                       ((BulletinBase)Reflector.CreateObject(bulletin.BulletinType.Assembly, bulletin.BulletinType.Class, new[] { bulletin })).
                                                       Desrialize(bulletin.Content.ToString())));
            bulletins.ForEach(b =>
            {
                b.MarkOld();
                b.LoadCategoryInfo(lRep);
            });
            return(bulletins);
        }
예제 #4
0
 public BulletinController(ILookupRepository lookupRepository, IBulletinRepository bulletinRepository)
 {
     _lookupRepository   = lookupRepository;
     _bulletinRepository = bulletinRepository;
 }
예제 #5
0
 public BulletinService(IDistributedCache cache, IBulletinRepository repository)
 {
     _cache      = cache;
     _repository = repository;
 }
예제 #6
0
 public BulletinManager(IBulletinRepository bulletinRepository, UserManager <ApplicationUser> userManager)
 {
     _bulletinRepository = bulletinRepository;
     _userManager        = userManager;
 }