Esempio n. 1
0
 public static int SetBranchOfStudentInactive(int studentId)
 {
     try
     {
         int update = 0;
         BranchesStudents branchesStudent   = BranchStudentDataManager.GetActiveBranchesOfStudent(studentId, Student.Includes.Branch);
         string           releaseHebrewDate = DateConverter.GetHebrewDate(DateTime.UtcNow);
         foreach (BranchStudent branchStudent in branchesStudent)
         {
             update = BranchStudentDataManager.SetStudentInactiveInBranch(studentId, branchStudent.Branch.Id, releaseHebrewDate);
             BranchManager.ReduceNumberOfStudents(branchStudent.Branch.Id);
         }
         return(update);
     }
     catch (Exception ex)
     {
         _logger.Debug("Failed to set the student to inactive in his branches.");
         throw;
     }
 }
Esempio n. 2
0
 public static int SetStudentInactiveInBranch(int studentId, int branchId)
 {
     try
     {
         string releaseHebrewDate = DateConverter.GetHebrewDate(DateTime.UtcNow);
         int    update            = BranchStudentDataManager.SetStudentInactiveInBranch(studentId, branchId, releaseHebrewDate);
         if (update == 1)
         {
             BranchManager.ReduceNumberOfStudents(branchId);
         }
         BranchesStudents branchStudents = BranchStudentDataManager.GetActiveBranchesOfStudent(studentId);
         if (branchStudents.Count() == 0)
         {
             StudentDataManager.SetStudentInactive(studentId);
         }
         return(update);
     }
     catch (Exception)
     {
         _logger.Debug("Failed to set the student to inactive in this branch.");
         throw;
     }
 }