Exemplo n.º 1
0
        public void SendAppointmentToClass(long appointmentId, long classId)
        {
            Account              currentUser         = Server.HttpContext.Session["Account"] as Account;
            Appointment          a                   = GetObject(appointmentId);
            IClassInfoRepository classInfoRepository = StructureMap.ObjectFactory.GetInstance <IClassInfoRepository>();
            ClassInfo            group               = classInfoRepository.GetObjectById(classId);

            if (a == null)
            {
                throw new Exception("日程信息不存在");
            }

            if (group == null)
            {
                throw new Exception("班级信息不存在");
            }

            if (group.InstructorId != currentUser.Id)
            {
                throw new Exception("只有该班的辅导员才能添加班级日程");
            }

            group.Appointments.Add(a);
            classInfoRepository.Save(group);
        }
Exemplo n.º 2
0
        public void SendAppointmentToClass(Appointment appointment, long classId)
        {
            Account currentUser = Server.HttpContext.Session["Account"] as Account;
            IClassInfoRepository classInfoRepository = StructureMap.ObjectFactory.GetInstance <IClassInfoRepository>();
            ClassInfo            group = classInfoRepository.GetObjectById(classId);

            if (appointment == null)
            {
                throw new Exception("日程信息不存在");
            }

            if (group == null)
            {
                throw new Exception("班级信息不存在");
            }

            if (group.InstructorId != currentUser.Id)
            {
                throw new Exception("只有该班的辅导员才能添加班级日程");
            }

            IClassAppointmentRepository classAppointmentRepository = StructureMap.ObjectFactory.GetInstance <IClassAppointmentRepository>();

            classAppointmentRepository.Add(new ClassAppointment()
            {
                Appointments_Id = appointment.Id,
                Classes_Id      = classId,
            });
            classAppointmentRepository.SaveChanges();
        }
Exemplo n.º 3
0
 public StudentService(IStudentInfoRepository studentInfoRepository, IMapper iMapper, ISchoolInfoRepository schoolInfoRepository,
                       IGradeInfoRepository gradeInfoRepository, IClassInfoRepository classInfoRepository, IUserInfoRepository userInfoRepository,
                       IDeleteStudentInfoRepository deleteStudentInfo)
 {
     _studentInfoRepository = studentInfoRepository;
     _IMapper = iMapper;
     _schoolInfoRepository = schoolInfoRepository;
     _gradeInfoRepository  = gradeInfoRepository;
     _classInfoRepository  = classInfoRepository;
     _userInfoRepository   = userInfoRepository;
     _deleteStudentInfo    = deleteStudentInfo;
 }
Exemplo n.º 4
0
 public ValideService(IStudentInfoRepository studentInfoRepository, IClassInfoRepository classInfoRepository, IGradeInfoRepository gradeInfoRespository, ISchoolInfoRepository schoolInfoRespository, IStationInfoRepository stationInfoRespository, IDepartInfoRepository departInfoRespository, IUserInfoRepository userInfoRepository, IReadLogRepository readLogRepository, IStaffClassRelateRepository staffClassRelateRepository, IFacultystaffInfoRepository facultystaffInfoRepository, IMapper iMapper)
 {
     _StudentInfoRepository      = studentInfoRepository;
     _classInfoRepository        = classInfoRepository;
     _gradeInfoRespository       = gradeInfoRespository;
     _schoolInfoRespository      = schoolInfoRespository;
     _stationInfoRespository     = stationInfoRespository;
     _departInfoRespository      = departInfoRespository;
     _userInfoRepository         = userInfoRepository;
     _readLogRepository          = readLogRepository;
     _staffClassRelateRepository = staffClassRelateRepository;
     _facultystaffInfoRepository = facultystaffInfoRepository;
     _IMapper = iMapper;
 }
Exemplo n.º 5
0
 public ClassService(IClassInfoRepository classInfoRepository, IMapper mapper)
 {
     this.classInfoRepository = classInfoRepository;
     this.mapper = mapper;
 }