예제 #1
0
 public IEnumerable <WorkShop> GetReservableWorkshop(Guid congressId)
 {
     try
     {
         var workShopBo = new WorkShopBO();
         var lst        = workShopBo.Where(this.ConnectionHandler, x => x.CongressId == congressId);
         new WorkShopBO().SetCapacity(ConnectionHandler, lst, congressId);
         var list = new List <WorkShop>();
         foreach (var workShop in lst)
         {
             if (string.IsNullOrEmpty(workShop.Subject))
             {
                 continue;
             }
             if (workShop.FreeCapicity > 0)
             {
                 list.Add(workShop);
             }
         }
         return(list);
     }
     catch (KnownException ex)
     {
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
     catch (Exception ex)
     {
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
 }
예제 #2
0
        public override bool Delete(params object[] keys)
        {
            try
            {
                this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                this.FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                var fileTransactionalFacade =
                    FileManagerComponent.Instance.FileTransactionalFacade(this.FileManagerConnection);
                var obj = new WorkShopBO().Get(this.ConnectionHandler, keys);
                var workShopTeacherBO = new WorkShopTeacherBO();
                var list = workShopTeacherBO.Where(this.ConnectionHandler,
                                                   teacher => teacher.WorkShopId == obj.Id);
                if (list.Any(guid => !workShopTeacherBO.Delete(this.ConnectionHandler, guid.WorkShopId, guid.TeacherId)))
                {
                    throw new Exception(Resources.Congress.ErrorInDeleteWorkShopTeacher);
                }
                if (!new WorkShopBO().Delete(this.ConnectionHandler, keys))
                {
                    throw new Exception(Resources.Congress.ErrorInDeleteWorkShop);
                }
                if (obj.ProgramAttachId != null)
                {
                    if (!fileTransactionalFacade.Delete(obj.ProgramAttachId))
                    {
                        throw new Exception(Resources.Congress.ErrorInDeleteWorkShopprogramFile);
                    }
                }
                if (obj.FileAttachId != null)
                {
                    if (!fileTransactionalFacade.Delete(obj.FileAttachId))
                    {
                        throw new Exception(Resources.Congress.ErrorInEditWorkShopAttachFile);
                    }
                }

                this.ConnectionHandler.CommitTransaction();
                this.FileManagerConnection.CommitTransaction();
                return(true);
            }
            catch (KnownException ex)
            {
                this.ConnectionHandler.RollBack();
                this.FileManagerConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            catch (Exception ex)
            {
                this.ConnectionHandler.RollBack();
                this.FileManagerConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
        }
예제 #3
0
        public List <WorkShop> GetByCongressId(Guid congressId)
        {
            try
            {
                var workShopBo = new WorkShopBO();
                var lst        = workShopBo.Where(this.ConnectionHandler, x => x.CongressId == congressId);
                new WorkShopBO().SetCapacity(ConnectionHandler, lst, congressId);

                return(lst);
            }
            catch (KnownException ex)
            {
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            catch (Exception ex)
            {
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
        }