示例#1
0
 public static int SetStudentActiveInBranch(int studentId, int branchId)
 {
     try
     {
         int insert = RegistrationStudentToBranch(studentId, branchId);
         BranchManager.IncreaseNumberOfStudents(branchId);
         StudentDataManager.SetStudentActive(studentId);
         return(insert);
     }
     catch (Exception)
     {
         _logger.Debug("Failed to set the student to active in this branch.");
         throw;
     }
 }
示例#2
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;
     }
 }
示例#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 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;
     }
 }
示例#5
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;
     }
 }