public async Task <IActionResult> Edit(int id, [Bind("Id,DisciplineCode,PlanCode,DisciplineType,WorkPlanId,TeacherProfileId")] DisciplineInfo disciplineInfo) { if (id != disciplineInfo.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(disciplineInfo); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DisciplineInfoExists(disciplineInfo.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DisciplineCode"] = new SelectList(_context.Discipline, "Code", "Code", disciplineInfo.DisciplineCode); ViewData["PlanCode"] = new SelectList(_context.Plan, "Code", "Code", disciplineInfo.PlanCode); ViewData["WorkPlanId"] = new SelectList(_context.Set <Models.File>(), "Id", "BaseName", disciplineInfo.WorkPlanId); return(View(disciplineInfo)); }
public async Task <IActionResult> AddDisciplineInfo([Bind("Id,DisciplineCode,PlanCode,DisciplineType")] DisciplineInfo disciplineInfo) { if (ModelState.IsValid) { _context.Add(disciplineInfo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Details), new { id = disciplineInfo.PlanCode })); } return(RedirectToAction(nameof(Index))); }
public void CheckHourSpreadingForOutliers() { var themes = new List <(string, List <string>)>(); for (int i = 0; i < 5; i++) { themes.Add(("t" + i, new List <string> { "st" + i })); } var d = DisciplineInfo.CreateSecondPassDI("test", 3, (20, 40, 30), themes, true); }
public ParseInfo ParseInfoFromWebpage() { return(new ParseInfo { CourseName = GetCourseName(), CourseDesc = GetCourseDesc(), Teachers = GetTeachers(), Disciplines = new List <DisciplineInfo> { DisciplineInfo.CreateFirstPassDI(GetCourseName(), GetThemes()) } }); }
public async Task <IActionResult> Create([Bind("Id,DisciplineCode,PlanCode,DisciplineType,WorkPlanId")] DisciplineInfo disciplineInfo) { if (ModelState.IsValid) { _context.Add(disciplineInfo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DisciplineCode"] = new SelectList(_context.Discipline, "Code", "Code", disciplineInfo.DisciplineCode); ViewData["PlanCode"] = new SelectList(_context.Plan, "Code", "Code", disciplineInfo.PlanCode); ViewData["WorkPlanId"] = new SelectList(_context.Set <Models.File>(), "Id", "BaseName", disciplineInfo.WorkPlanId); return(View(disciplineInfo)); }
private static void FillDiscContentTable(Table dcTable, DisciplineInfo disc) { var rnd = new Random(); for (int i = 0; i < 5; i++) { dcTable.InsertRow(); var row = dcTable.Rows[i + 1]; row.Cells[0].Paragraphs[0].Alignment = Alignment.center; row.Cells[0].Paragraphs[0].Append((i + 1).ToString()); var para = row.Cells[1].Paragraphs[0]; para.Append(disc.Themes[i].title + (disc.Themes[i].title.EndsWith('.') ? "" : ".")); var topics = disc.Themes[i].topics.ToList(); for (int k = 0; k < Math.Max(topics.Count / 4.5, 1); k++) { var topic = topics[rnd.Next(0, topics.Count)]; row.Cells[2].Paragraphs[0].Append(topic + (topic.EndsWith('.') ? " " : ". ")); topics.Remove(topic); } } }
public ParseInfo ParseInfoFromSheet() { var dInfo = Handler.GetValues("page1!A5:F5"); var dName = Handler.GetValues("page1!B3"); var dThemes = Handler.GetValues("page1!B7:F8"); var pi = new ParseInfo { CourseName = Handler.GetValues("page1!B1").Values[0][0].ToString(), Disciplines = new List <DisciplineInfo> { DisciplineInfo.CreateSecondPassDI( dName.Values[0][0].ToString(), int.Parse(dInfo.Values[0][0].ToString()), (int.Parse(dInfo.Values[0][3].ToString()), int.Parse(dInfo.Values[0][4].ToString()), int.Parse(dInfo.Values[0][5].ToString())), GetThemeInfos(dThemes), dInfo.Values[0][1].ToString().Contains("Экзамен") ) } }; return(pi); }
public List <SeasonInfo> GetSeasons(DisciplineInfo discipline) { throw new NotImplementedException(); }
public Discipline(DisciplineInfo discipline) : this(discipline.Name) { }