public ProfessorController(
     IProfessorService professorService
     , IProfessorScoreService professorScoreService
     , IEducationalGroupService educationalGroupService
     , ICollegeService collegeService
     , ITermService termService
     , IIndicatorService indicatorService
     , IRoleAccessService roleAccessService
     , IUserRoleService userRoleService
     , ILogService logService
     , IEducationalClassService educationalClassService
     )
 {
     _professorService        = professorService;
     _professorScoreService   = professorScoreService;
     _educationalGroupService = educationalGroupService;
     _collegeService          = collegeService;
     _termService             = termService;
     _indicatorService        = indicatorService;
     _roleAccessService       = roleAccessService;
     _userRoleService         = userRoleService;
     _reportService           = new DapperService(educationalGroupService);
     _logService = logService;
     _educationalClassService = educationalClassService;
 }
 public ScheduleController(IScheduleService scheduleService,
                           ITermService termService,
                           IMappingService mappingService,
                           ICollegeService collegeService,
                           IEducationalGroupService educationalGroupService,
                           IProfessorService professorService,
                           IEducationalClassService educationalClassService,
                           IStudentEducationalClassService studentEducationalClassService,
                           IProfessorScoreService professorScoreService,
                           IIndicatorService indicatorService,
                           IMappingTypeService mappingTypeService,
                           IUniversityLevelMappingService universityLevelMappingService,
                           IEducationalGroupScoreService educationalGroupScoreService,
                           ILogService logService,
                           ILogTypeService logTypeService,
                           IUserService userService)
 {
     _scheduleService                = scheduleService;
     _termService                    = termService;
     _mappingService                 = mappingService;
     _collegeService                 = collegeService;
     _educationalGroupService        = educationalGroupService;
     _professorService               = professorService;
     _educationalClassService        = educationalClassService;
     _studentEducationalClassService = studentEducationalClassService;
     _professorScoreService          = professorScoreService;
     _indicatorService               = indicatorService;
     _logService                    = logService;
     _logTypeService                = logTypeService;
     _mappingTypeService            = mappingTypeService;
     _userService                   = userService;
     _universityLevelMappingService = universityLevelMappingService;
     _educationalGroupScoreService  = educationalGroupScoreService;
 }
Esempio n. 3
0
        //کلاس-Remove
        public static Dictionary <string, string> SyncRemoveEducationalClass(IEducationalClassService educationalClassService)
        {
            var educationalClasses = ClientHelper.GetValue <EducationalClassSyncModel>(StaticValue.EducationalClassRelativeAddress);
            var result             = new Dictionary <string, string>();
            var counter            = 1;

            educationalClasses.ForEach(x =>
            {
                if (x != null)
                {
                    if (educationalClassService.IsExist(y => y.CodeClass == x.CodeClass && y.Term.TermCode == x.Term))
                    {
                        var r = educationalClassService.Remove(x);
                        result.Add($"{x.Name}-{counter}", r.GetDeleteResualt());
                        ++counter;
                    }
                    else
                    {
                        result.Add($"{x.Name}-{counter}", 0.GetDeleteResualt());
                        ++counter;
                    }
                }
            });
            return(result);
        }
Esempio n. 4
0
        public PagesController(
            ITermService termService
            , ICollegeService collegeService
            , IEducationalGroupService educationalGroupService
            , IProfessorService professorService
            , IRoleService roleService
            , IRoleAccessService roleAccessService
            , IAccessService accessService
            , IUserRoleService userRoleService
            , IMappingService mappingService
            , IIndicatorService indicatorService
            , IUniversityLevelMappingService universityLevelMappingService
            , IUserService userService
            , IScheduleService scheduleService


            , IEducationalClassService educationalClassService
            , IStudentEducationalClassService studentEducationalClassService
            , IProfessorScoreService professorScoreService
            , IMappingTypeService mappingTypeService
            , IEducationalGroupScoreService educationalGroupScoreService
            , ILogService logService
            , ILogTypeService logTypeService
            , IServiceUsersMappingService serviceUsersMappingService
            )
        {
            _termService                   = termService;
            _collegeService                = collegeService;
            _educationalGroupService       = educationalGroupService;
            _professorService              = professorService;
            _roleService                   = roleService;
            _roleAccessService             = roleAccessService;
            _accessService                 = accessService;
            _userRoleService               = userRoleService;
            _mappingService                = mappingService;
            _indicatorService              = indicatorService;
            _universityLevelMappingService = universityLevelMappingService;
            _userService                   = userService;
            _scheduleService               = scheduleService;
            _logService                     = logService;
            _logTypeService                 = logTypeService;
            _educationalClassService        = educationalClassService;
            _studentEducationalClassService = studentEducationalClassService;
            _professorScoreService          = professorScoreService;
            _mappingTypeService             = mappingTypeService;
            _educationalGroupScoreService   = educationalGroupScoreService;
            _serviceUsersMappingService     = serviceUsersMappingService;
            //SyncService.RunAll(termService, mappingService, collegeService, educationalGroupService
            //    , professorService, educationalClassService, studentEducationalClassService, professorScoreService
            //    , indicatorService, mappingTypeService, universityLevelMappingService, educationalGroupScoreService
            //    , logService, logTypeService, userService);
            //var lastUpdate = _logService.LastUpdate();
        }
Esempio n. 5
0
        public static void Run(IEducationalClassService educationalClassService, ILogService logService, ILogTypeService logTypeService, IUserService userService, User user, string termCode)
        {
            //The order of the execution on the commands is important
            //First-remove
            //Second-addOrUpdate

            //log start
            SyncService.LogSync(logService, logTypeService, userService, user, (int)LogTypeValue.شروع_سینک_کلاس);


            // var remove = SyncRemoveEducationalClass(educationalClassService);
            SyncAddOrUpdateEducationalClass(educationalClassService, logService, logTypeService, userService, user, termCode);

            //var resualt = new ReturnValue
            //{
            //    //Remove = remove,
            //    AddOrUpdate = addOrUpdate
            //};
            //return resualt;
        }
Esempio n. 6
0
 public EducationalClassesController(
     IEducationalClassService educationalClassService
     , IEducationalGroupService educationalGroupService
     , ITermService termService
     , IProfessorScoreService professorScoreService
     , IScoreService scoreService
     , IRoleAccessService roleAccessService
     , IUserRoleService userRoleService
     , IProfessorService professorService
     , IIndicatorService indicatorService
     )
 {
     _educationalClassService = educationalClassService;
     _educationalGroupService = educationalGroupService;
     _termService             = termService;
     _professorScoreService   = professorScoreService;
     _scoreService            = scoreService;
     _roleAccessService       = roleAccessService;
     _userRoleService         = userRoleService;
     _professorService        = professorService;
     _indicatorService        = indicatorService;
 }
        public static void RunAll(
            ITermService termService,
            IMappingService mappingService,
            ICollegeService collegeService,
            IEducationalGroupService educationalGroupService,
            IProfessorService professorService,
            IEducationalClassService educationalClassService,
            IStudentEducationalClassService studentEducationalClassService,
            IProfessorScoreService professorScoreService,
            IIndicatorService indicatorService,
            IMappingTypeService mappingTypeService,
            IUniversityLevelMappingService universityLevelMappingService,
            IEducationalGroupScoreService educationalGroupScoreService,
            ILogService logService,
            ILogTypeService logTypeService,
            IUserService userService,
            string termCode)
        {
            //The order of the execution on the commands is important


            var user = userService.Get(x => x.Username.ToLower() == "Sync".ToLower());

            if (string.IsNullOrEmpty(termCode))
            {
                termCode = ClientHelper.GetScalarValue <string>(StaticValue.CurrentTerm);
            }



            //TermSync.SyncAddOrUpdateTerms(termService, logService, logTypeService, userService, user);
            //MappingSync.Run(mappingService, logService, logTypeService, userService, user);
            //CollegeSync.Run(collegeService, logService, logTypeService, userService, user);
            //ProfessorSync.SyncAddOrUpdateProfessor(professorService, logService, logTypeService, userService, user, termCode);
            //EducationalGroupSync.SyncAddOrUpdateEducationalGroup(educationalGroupService, logService, logTypeService, userService, user, termCode);
            EducationalClassSync.Run(educationalClassService, logService, logTypeService, userService, user, termCode);
            StudentEducationalClassSync.Run(studentEducationalClassService, logService, logTypeService, userService, user, termCode);

            ProfessorSync.SyncProfessorRemoveScore(professorService, logService, logTypeService, userService, user, termCode);

            ProfessorSync.SyncProfessorAddScore(professorService, professorScoreService, indicatorService, termService,
                                                mappingService, mappingTypeService, educationalClassService, universityLevelMappingService,
                                                logService, logTypeService, userService, user, termCode);

            EducationalGroupSync.SyncEducationalGroupRemoveScore(educationalGroupService
                                                                 , logService, logTypeService, userService, user, termCode);

            EducationalGroupSync.SyncEducationalGroupAddScore(educationalGroupService, educationalGroupScoreService,
                                                              indicatorService, termService, professorService, professorScoreService, educationalClassService
                                                              , logService, logTypeService, userService, user, termCode);


            var groupManagerScores     = indicatorService.Get(w => w.CountOfType == ("g" + (int)IndicatorGroupName.ضریب_مدیر_گروه) && w.IsActive == true).Scores.Select(s => s.Id).ToList();
            var groupmanagerGroupScore = educationalGroupScoreService.GetMany(g => groupManagerScores.Contains(g.Score.Id) && g.Term.TermCode == termCode)
                                         .Select(s => s.EducationalGroup.EducationalGroupCode);
            var groupManagerReCalculateList = educationalGroupService
                                              .GetMany(w => !groupmanagerGroupScore.Contains(w.EducationalGroupCode) && w.Term.TermCode == termCode && w.IsActive == true).ToList();

            if (groupManagerReCalculateList.Count() > 0)
            {
                var professores = ClientHelper.GetValue <ProfessorSyncModel>(StaticValue.ProfessorRelativeAddress + $"/{termCode}");
                var reCalcProfs = professores.Where(w => groupManagerReCalculateList.Where(ww => ww.GroupManger != null).Select(s => s.GroupManger.ProfessorCode).Contains(w.ProfessoreCode)).ToList();
                foreach (var item in reCalcProfs)
                {
                    ProfessorSync.SyncGroupManagerProfessorScores(professorService, professorScoreService, indicatorService, termService, mappingService, mappingTypeService
                                                                  , educationalClassService, universityLevelMappingService, item, logService, logTypeService, userService, user, educationalGroupService);
                }

                var groups       = ClientHelper.GetValue <GroupSyncModel>(StaticValue.GroupRelativeAddress + $"/{termCode}");
                var reCalcGroups = groups.Where(w => groupManagerReCalculateList.Where(ww => ww.GroupManger != null).Select(s => s.EducationalGroupCode).Contains(w.EducationalGroupCode)).ToList();
                foreach (var item in reCalcGroups)
                {
                    EducationalGroupSync.SyncGroupManagerEducationalGroupScores(educationalGroupService, educationalGroupScoreService, indicatorService, termService
                                                                                , professorService, professorScoreService, item, educationalClassService, logService, logTypeService, userService, user);
                }
            }
        }
Esempio n. 8
0
        //کلاس-Add Or Update
        public static void SyncAddOrUpdateEducationalClass(IEducationalClassService educationalClassService, ILogService logService, ILogTypeService logTypeService, IUserService userService, User user, string termCode)
        {
            var educationalClasses = ClientHelper.GetValue <EducationalClassSyncModel>(StaticValue.EducationalClassRelativeAddress + $"/{termCode}");

            //log get From service
            SyncService.LogSync(logService, logTypeService, userService, user, (int)LogTypeValue.دریافت_کلاس_از_سرویس);

            var addOrUpdateResualt   = new Dictionary <string, int>();
            var counter              = 1;
            var preventedContentType = new List <int?> {
                10, 11, 24, 7, 6, 49, 50, 38
            };
            var preventedHoldingType = new List <decimal?> {
                5, 7
            };

            if (educationalClasses != null)
            {
                var exceptions = educationalClasses.Where(w => preventedContentType.Contains(w.ContentType) ||
                                                          preventedHoldingType.Contains(w.HoldingType) || w.HoldingExamDate == null);
                educationalClasses.Except(exceptions).ToList().ForEach(x =>
                {
                    if (x.ContentType != null && !preventedContentType.Contains(x.ContentType) &&
                        x.HoldingExamDate != null &&
                        x.HoldingType != null && !preventedHoldingType.Contains(x.HoldingType))
                    {
                        if (x != null)
                        {
                            if (HasNullProperty(x))
                            {
                                addOrUpdateResualt.Add($"{x.GroupId}-{x.CodeClass}-{x.Name}-{counter}", 4);
                            }
                            else
                            {
                                var r = educationalClassService.AddOrUpdate(x);
                                addOrUpdateResualt.Add($"{x.GroupId}-{x.CodeClass}-{x.Name}-{counter}", r);
                            }
                        }
                        ++counter;
                    }
                });
            }
            var added            = addOrUpdateResualt.Count(x => x.Value == 1);
            var updatetd         = addOrUpdateResualt.Count(x => x.Value == 2);
            var warrning         = addOrUpdateResualt.Count(x => x.Value == 3);
            var notFounded       = addOrUpdateResualt.Count(x => x.Value == 4);
            var stringWarrning   = string.Empty;
            var stringNotFounded = string.Empty;

            foreach (var s in addOrUpdateResualt.Where(x => x.Value == 3).Select(x => x.Key))
            {
                stringWarrning = $"تعداد {warrning}" + " || " + s + " | ";
            }
            foreach (var s in addOrUpdateResualt.Where(x => x.Value == 4).Select(x => x.Key))
            {
                stringNotFounded = $"تعداد {notFounded}" + " || " + s + " | ";
            }

            stringWarrning   = !string.IsNullOrEmpty(stringWarrning.Trim()) ? stringWarrning : "بدون مشکل";
            stringNotFounded = !string.IsNullOrEmpty(stringNotFounded.Trim()) ? stringNotFounded : "بدون مشکل";

            SyncService.LogSync(logService, logTypeService, userService, user, (int)LogTypeValue.کلاس_اضافه_گردید, $"تعداد {added}");
            SyncService.LogSync(logService, logTypeService, userService, user, (int)LogTypeValue.کلاس_آپدیت_گردید, $"تعداد {updatetd}");
            SyncService.LogSync(logService, logTypeService, userService, user, (int)LogTypeValue.عملیات_ناموفق_در_بروزرسانی_کلاس, stringWarrning);
            SyncService.LogSync(logService, logTypeService, userService, user, (int)LogTypeValue.عملیات_ناموفق_به_دلیل_عدم_وجود_حداقل_یک_مقدار_از_کلاس, stringNotFounded);

            //return result;
        }