예제 #1
0
 public static int MakeBranchInactive(int id)
 {
     try
     {
         using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
         {
             var numAffected = BranchDataManager.MakeBranchInactive(id);
             BranchStudentManager.MakeBranchStudentsInactive(id);
             scope.Complete();
             return(numAffected);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #2
0
 public static int SetStudentInactive(int studentId)
 {
     try
     {
         using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
         {
             //TODO- not in that sprint:
             //all the requests,attendance... become Inactive
             BranchStudentManager.SetBranchOfStudentInactive(studentId);
             int update = StudentDataManager.SetStudentInactive(studentId);
             scope.Complete();
             return(update);
         }
     }
     catch (Exception ex)
     {
         _logger.Debug($"Failed to set the student {studentId} to inactive.", ex);
         throw;
     }
 }
예제 #3
0
 public static int ApprovalRegistration(BranchStudent branchStudent)
 {
     try
     {
         using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
         {
             int update = BranchStudentManager.ApprovalRegistrationStudent(branchStudent.Id);
             StudentDataManager.SetStudentActive(branchStudent.Student.Id);
             if (update == 1)
             {
                 BranchManager.IncreaseNumberOfStudents(branchStudent.Branch.Id);
             }
             scope.Complete();
             return(update);
         }
     }
     catch (Exception ex)
     {
         _logger.Debug($"Failed to set the student {branchStudent.Student.Id} to active in branch {branchStudent.Branch.Id}.", ex);
         throw;
     }
 }
예제 #4
0
 public static int SetStudentActive(int studentId, int branchId)
 {
     try
     {
         using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
         {
             //TODO- not in that sprint:
             //all the requests,attendance... branchs become active?
             int update = StudentDataManager.SetStudentActive(studentId);
             if (update == 1)
             {
                 BranchStudentManager.RegistrationStudentToBranch(studentId, branchId);
                 BranchManager.IncreaseNumberOfStudents(branchId);
             }
             scope.Complete();
             return(update);
         }
     }
     catch (Exception ex)
     {
         _logger.Debug($"Failed to set the student {studentId} to active.", ex);
         throw;
     }
 }