Beispiel #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;
     }
 }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #4
0
 public BulletinController(ILookupRepository lookupRepository, IBulletinRepository bulletinRepository)
 {
     _lookupRepository   = lookupRepository;
     _bulletinRepository = bulletinRepository;
 }
Beispiel #5
0
 public BulletinService(IDistributedCache cache, IBulletinRepository repository)
 {
     _cache      = cache;
     _repository = repository;
 }
Beispiel #6
0
 public BulletinManager(IBulletinRepository bulletinRepository, UserManager <ApplicationUser> userManager)
 {
     _bulletinRepository = bulletinRepository;
     _userManager        = userManager;
 }