Beispiel #1
0
        private void GetWorkParametr(int number, int curriculumId, int disciplineId, int journalCurriculumId)
        {
            var disciplineService        = new DisciplineService(_unit, _unit);
            var curriculumService        = new CurriculumService(_unit, _unit);
            var journalCurriculumService = new JournalCurriculumService(_unit, _unit);

            if (disciplineId != -1)
            {
                _discipline = disciplineService.GetDisciplineById(disciplineId);
            }
            if (journalCurriculumId != -1)
            {
                _journalCurriculum = journalCurriculumService.GetJournalCurriculumById(journalCurriculumId);
            }
            if (curriculumId != -1)
            {
                _curriculum = curriculumService.GetCurriculumById(curriculumId);
            }
            this.GetFormReportFromDb();
            textBox1.Text = _discipline.Name;
            if (number == 1)
            {
                btn_addDiscipline.Visible = true;
            }
            if (number == 2)
            {
                btn_updateDiscipline.Visible = true;
                TimeText = _journalCurriculum.Time;
                comboBox3.SelectedItem = _journalCurriculum.FormReport;
            }
        }
Beispiel #2
0
        private List <Discipline> GetDisciplineFromDb()
        {
            var disciplineService = new DisciplineService(_unit, _unit);
            var discipline        = disciplineService.GetAllDiscipline();

            return(discipline.ToList());
        }
        public async Task <IActionResult> UpdateDiscipline([FromServices] DisciplineService disciplineService, ResultModel <DisciplineVO> request)
        {
            string token = User.FindFirst("Token").Value;

            request.Object.CourseId = Guid.Parse(User.FindFirst("CourseId").Value);

            ResultModel <DisciplineVO> response = await disciplineService.UpdateDisciplineTaskAsync(request.Object, token);

            if (response.StatusCode != HttpStatusCode.Created)
            {
                return(View("/Views/Coordinator/Disciplines/Update.cshtml", new ResultModel <DisciplineVO>
                {
                    Object = request.Object,
                    Message = response.Message,
                    StatusCode = response.StatusCode
                }));
            }

            ResultModel <List <DisciplineVO> > disciplinesResponse = await disciplineService.GetDisciplinesByCoordIdTaskAsync(token);

            if (disciplinesResponse.StatusCode == HttpStatusCode.OK)
            {
                disciplinesResponse.Message    = response.Message;
                disciplinesResponse.StatusCode = response.StatusCode;
            }

            return(View("/Views/Coordinator/Disciplines/Index.cshtml", disciplinesResponse));
        }
        public async Task <IActionResult> Index([FromServices] DisciplineService disciplineService)
        {
            string token = User.FindFirst("Token").Value;

            ResultModel <List <DisciplineVO> > response = await disciplineService.GetDisciplinesByCoordIdTaskAsync(token);

            return(View("/Views/Coordinator/Disciplines/Index.cshtml", response));
        }
Beispiel #5
0
        public async Task ShowModal(int id)
        {
            Current = await PlanService.GetAsync(id).ConfigureAwait(false);

            Current.Lecturers = await LecturerService.GetAsync();

            Current.Disciplines = await DisciplineService.GetAsync();
        }
        public async Task <IActionResult> Update([FromServices] DisciplineService disciplineService, [Required] Guid disciplineId)
        {
            string token = User.FindFirst("Token").Value;

            ResultModel <DisciplineVO> response = await disciplineService.GetDisciplineByDisciplineIdTaskAsync(disciplineId, token);

            return(View("/Views/Coordinator/Disciplines/Update.cshtml", response));
        }
        public async Task Add()
        {
            await DisciplineService.AddAsync(Current).ConfigureAwait(false);

            Collection = await DisciplineService.GetAsync().ConfigureAwait(false);

            StateHasChanged();
        }
Beispiel #8
0
 public async Task ShowModal()
 {
     Current = new Plan
     {
         Lecturers   = await LecturerService.GetAsync(),
         Disciplines = await DisciplineService.GetAsync()
     };
 }
Beispiel #9
0
        private void GetAllDataFromDb()
        {
            var disciplineService = new DisciplineService(_unit, _unit);
            var discipline        = disciplineService.GetDisciplineById(_entityId);

            IdText   = discipline.Id.ToString();
            NameText = discipline.Name;
        }
Beispiel #10
0
        public IEnumerable <AttemptResult> GetAllAttempts()
        {
            List <AttemptResult> result = new List <AttemptResult>();
            LearningStoreJob     job    = LStore.CreateJob();

            RequestAllAttempts(job);
            DataTable dataTable = job.Execute <DataTable>();

            foreach (DataRow dataRow in dataTable.AsEnumerable())
            {
                AttemptItemIdentifier attemptItemId;
                LStoreHelper.CastNonNull(dataRow[Schema.AllAttemptsResults.AttemptId], out attemptItemId);
                long attemptId = attemptItemId.GetKey();

                String userKey;
                LStoreHelper.CastNonNull(dataRow[Schema.AllAttemptsResults.UserItemKey], out userKey);
                User user = UserService.GetUsers().Single(curr => curr.Id.ToString() == userKey);
                if (user == null)
                {
                    throw new NoNullAllowedException("Error while getting user with id = " + userKey);
                }

                Int32 topicId;
                LStoreHelper.CastNonNull(dataRow[Schema.AllAttemptsResults.ThemeId], out topicId);
                Topic topic = DisciplineService.GetTopic(topicId);
                if (topic == null)
                {
                    throw new NoNullAllowedException("Error while getting topic with id = " + topicId);
                }

                Microsoft.LearningComponents.CompletionStatus completionStatus;
                LStoreHelper.CastNonNull(dataRow[Schema.AllAttemptsResults.CompletionStatus], out completionStatus);
                IUDICO.Common.Models.Shared.Statistics.CompletionStatus iudicoCompletionStatus = (IUDICO.Common.Models.Shared.Statistics.CompletionStatus)completionStatus;

                Microsoft.LearningComponents.AttemptStatus attemptStatus;
                LStoreHelper.CastNonNull(dataRow[Schema.AllAttemptsResults.AttemptStatus], out attemptStatus);
                IUDICO.Common.Models.Shared.Statistics.AttemptStatus iudicoAttemptStatus = (IUDICO.Common.Models.Shared.Statistics.AttemptStatus)attemptStatus;

                Microsoft.LearningComponents.SuccessStatus successStatus;
                LStoreHelper.CastNonNull(dataRow[Schema.AllAttemptsResults.SuccessStatus], out successStatus);
                IUDICO.Common.Models.Shared.Statistics.SuccessStatus iudicoSuccessStatus = (IUDICO.Common.Models.Shared.Statistics.SuccessStatus)successStatus;

                DateTime?startTime;
                LStoreHelper.Cast(dataRow[Schema.AllAttemptsResults.StartedTimestamp], out startTime);

                DateTime?finishTime;
                LStoreHelper.Cast(dataRow[Schema.AllAttemptsResults.FinishedTimestamp], out finishTime);


                float?scaledScore;
                LStoreHelper.Cast <float>(dataRow[Schema.AllAttemptsResults.Score], out scaledScore);

                // Create AttemptResult object
                AttemptResult attemptResult = new AttemptResult(attemptId, user, topic, iudicoCompletionStatus, iudicoAttemptStatus, iudicoSuccessStatus, startTime, finishTime, scaledScore);
                result.Add(attemptResult);
            }
            return(result);
        }
Beispiel #11
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            var disciplineService = new DisciplineService(_unit, _unit);
            var discipline        = disciplineService.CreatDiscipline(NameText);

            _unit.Commit();
            _context.Dispose();
            this.Close();
        }
Beispiel #12
0
        private void DeleteDiscipline(object sender, EventArgs e)
        {
            var disciplineService = new DisciplineService(_unit, _unit);

            disciplineService.RemoveDiscipline((Discipline)disciplineGV.CurrentRow.DataBoundItem);
            _unit.Commit();
            _unit = new UnitOfWork(_context);
            this.SearchDiscipline(13, _tBox_searchValue);
        }
Beispiel #13
0
 public async Task ShowModal()
 {
     Current = new Control
     {
         Lecturers   = await LecturerService.GetAsync(),
         Disciplines = await DisciplineService.GetAsync(),
         Students    = await StudentService.GetAsync()
     };
 }
Beispiel #14
0
        private void btn_update_Click(object sender, EventArgs e)
        {
            var disciplineService = new DisciplineService(_unit, _unit);
            var discipline        = disciplineService.GetDisciplineById(_entityId);

            discipline.Name = NameText;
            disciplineService.UpdateDiscipline(discipline);
            _unit.Commit();
            _context.Dispose();
            this.Close();
        }
Beispiel #15
0
        // Конструктор по умолчанию
        public frmChangeDiscipline()
        {
            InitializeComponent();
            // Получение строки подключения к источнику данных
            string connectionString = ConfigurationManager.ConnectionStrings["EnrolleeContext"].ConnectionString;

            // Инициализация сервисов
            disciplineService        = new DisciplineService(connectionString);
            basisForAssessingService = new BasisForAssessingService(connectionString);
            // Инициализация списка дисциплин
            InitializeDisciplineComboBox();
            logger.Info($"Регистрация замены дисциплины абитуриента.");
        }
 public async Task Update()
 {
     if (Collection is List <Discipline> disciplines)
     {
         disciplines[disciplines.FindIndex(r => r.Id == Current.Id)] = Current;
     }
     else
     {
         Collection = await DisciplineService.GetAsync().ConfigureAwait(false);
     }
     StateHasChanged();
     Current = await DisciplineService.UpdateAsync(Current).ConfigureAwait(false);
 }
Beispiel #17
0
        public void SetUp()
        {
            _disciplineRepository = Mock.Of <IDisciplineRepository>();
            _disciplineService    = new DisciplineService(_disciplineRepository);

            _discipline = new DisciplineItem()
            {
                Id        = 1,
                ShortName = "test",
                FullName  = "test_full",
                Mem       = "Описание"
            };
        }
Beispiel #18
0
        static int DeleteScript1()
        {
            Discipline model = new Discipline()
            {
                Name = "Random Discipline"
            };

            DateTime startTime = DateTime.Now;

            DisciplineService.Delete(model);
            DateTime finishTime = DateTime.Now;

            return((int)(finishTime - startTime).TotalMilliseconds);
        }
        /// <summary>
        /// Инициализация сервисов доступа данных
        /// </summary>
        private void InitializeDataAccessServices()
        {
            // Инициализация строки подключения данных
            logger.Info($"Получение строки подключения к источнику данных");
            string connectionString = ConfigurationManager.ConnectionStrings["EnrolleeContext"].ConnectionString;

            // Инициализация сервисов доступа данных
            assessmentService  = new AssessmentService(connectionString);
            enrolleeService    = new EnrolleeService(connectionString);
            examSchemaService  = new ExamSchemaService(connectionString);
            disciplineService  = new DisciplineService(connectionString);
            facultyService     = new FacultyService(connectionString);
            formOfStudyService = new FormOfStudyService(connectionString);
            specialityService  = new SpecialityService(connectionString);
            viewService        = new ViewService(connectionString);
        }
Beispiel #20
0
 private void SearchDiscipline(int code, string value)
 {
     if (code == 13 && cmBox_search.SelectedIndex == 0 && value != "" && EntitiesIndex == 4)
     {
         var disciplineService = new DisciplineService(_unit, _unit);
         var discipline        = disciplineService.GetDisciplineById(Convert.ToInt32(_tBox_searchValue));
         disciplineGV.DataSource = new List <Discipline>()
         {
             discipline
         };
     }
     if (code == 13 && cmBox_search.SelectedIndex == 1 && value != "")
     {
         var disciplineService = new DisciplineService(_unit, _unit);
         var discipline        = disciplineService.GetDisciplineByName(_tBox_searchValue);
         disciplineGV.DataSource = new List <Discipline>()
         {
             discipline
         };
     }
 }
        public async Task <IActionResult> Delete([FromServices] DisciplineService disciplineService, [Required] Guid disciplineId)
        {
            if (ModelState.IsValid)
            {
                string token = User.FindFirst("Token").Value;

                ResultModel <bool> response = await disciplineService.DeleteDisciplineTaskAsync(disciplineId, token);

                ResultModel <List <DisciplineVO> > disciplinesResponse = await disciplineService.GetDisciplinesByCoordIdTaskAsync(token);

                if (disciplinesResponse.StatusCode == HttpStatusCode.OK)
                {
                    disciplinesResponse.StatusCode = response.StatusCode;
                    disciplinesResponse.Message    = response.Message;
                }

                return(View("/Views/Coordinator/Disciplines/Index.cshtml", disciplinesResponse));
            }

            return(BadRequest());
        }
Beispiel #22
0
 /// <summary>
 /// Создание сервиса дисциплин.
 /// </summary>
 public DisciplineController()
 {
     _disciplineService = new DisciplineService();
 }
        public async Task <IActionResult> UpdateLesson([FromServices] LessonService lessonService, [FromServices] DisciplineService disciplineService, ResultModel <LessonVO> request)
        {
            string token = User.FindFirst("Token").Value;

            request.Object.CourseId = Guid.Parse(User.FindFirst("CourseId").Value);

            ResultModel <LessonVO> response = await lessonService.UpdateLessonTaskAsync(request.Object, token);

            if (response.StatusCode != HttpStatusCode.Created)
            {
                return(View("/Views/Coordinator/Lessons/Update.cshtml", new ResultModel <LessonVO>
                {
                    Object = request.Object,
                    Message = response.Message,
                    StatusCode = response.StatusCode
                }));
            }

            ResultModel <List <DisciplineVO> > disciplines = await disciplineService.GetDisciplinesByCoordIdTaskAsync(token);

            ResultModel <List <LessonDisciplineVO> > lessonsResponse = await lessonService.GetAllLessonsByDisciplineIDsTaskAsync(token, disciplines.Object.Select(x => x.DisciplineId).ToList());

            if (lessonsResponse.StatusCode == HttpStatusCode.OK)
            {
                lessonsResponse.Message    = response.Message;
                lessonsResponse.StatusCode = response.StatusCode;
            }

            return(View("/Views/Coordinator/Lessons/Index.cshtml", lessonsResponse));
        }
        public async Task <IActionResult> Index([FromServices] LessonService lessonService, [FromServices] DisciplineService disciplineService)
        {
            string token = User.FindFirst("Token").Value;

            ResultModel <List <DisciplineVO> > disciplines = await disciplineService.GetDisciplinesByCoordIdTaskAsync(token);

            ResultModel <List <LessonDisciplineVO> > lessons = await lessonService.GetAllLessonsByDisciplineIDsTaskAsync(token, disciplines.Object.Select(x => x.DisciplineId).ToList());

            return(View("/Views/Coordinator/Lessons/Index.cshtml", lessons));
        }
        public async Task <IActionResult> Delete([FromServices] LessonService lessonService, [FromServices] DisciplineService disciplineService, [Required] Guid lessonId)
        {
            if (ModelState.IsValid)
            {
                string token = User.FindFirst("Token").Value;

                ResultModel <bool> response = await lessonService.RemoveLessonTaskAsync(lessonId, token);

                ResultModel <List <DisciplineVO> > disciplines = await disciplineService.GetDisciplinesByCoordIdTaskAsync(token);

                ResultModel <List <LessonDisciplineVO> > lessons = await lessonService.GetAllLessonsByDisciplineIDsTaskAsync(token, disciplines.Object.Select(x => x.DisciplineId).ToList());

                if (disciplines.StatusCode == HttpStatusCode.OK && lessons.StatusCode == HttpStatusCode.OK)
                {
                    lessons.StatusCode = response.StatusCode;
                    lessons.Message    = response.Message;
                }

                return(View("/Views/Coordinator/Lessons/Index.cshtml", lessons));
            }

            return(BadRequest());
        }
Beispiel #26
0
 public DisciplinesPeriodsService(DisciplineService disciplineService, IHttpContextAccessor httpContextAccessor)
 {
     _disciplineService   = disciplineService;
     _httpContextAccessor = httpContextAccessor;
 }
 public async Task Delete(int id)
 {
     Collection = Collection.Where(r => r.Id != id).ToList();
     StateHasChanged();
     await DisciplineService.DeleteAsync(id).ConfigureAwait(false);
 }
 public async Task ShowModal(int id)
 {
     Current = await DisciplineService.GetAsync(id).ConfigureAwait(false);
 }
 protected override async Task OnInitAsync()
 {
     Collection = await DisciplineService.GetAsync().ConfigureAwait(false);
 }
Beispiel #30
0
 public DisciplineController(DisciplineService disciplineService)
 {
     _disciplineService = disciplineService;
 }