public List <Workload> GetAllWorkloadsByYear(StudyYear selectedStudyYear) { using (Db.BeginReadOnlyWork()) { return(_workloadRepository.GetMany(w => w.LocalWorkload.StudyYearId == selectedStudyYear.Id, w => w.LocalWorkload.DisciplineYear.Discipline, w => w.LocalWorkload.Group, w => w.LocalWorkload.Semester, w => w.Employee, w => w.LocalWorkload.Group.Speciality.Faculty)); } }
public List<TimetableItem> GetTimetableForYear(StudyYear year, HalfYear halfYear = HalfYear.None) { List<TimetableItem> timetable; string tempYear = Enum.GetName(typeof(StudyYear), year); string tempHalfYear = Enum.GetName(typeof(HalfYear), halfYear); if (tempHalfYear == "None") tempHalfYear = String.Empty; try { HtmlWeb hw = new HtmlWeb(); HtmlDocument doc = hw.Load(String.Format("http://thor.info.uaic.ro/~orar/participanti/orar_{0}{1}.html", tempYear, halfYear)); doc.DocumentNode.InnerHtml = doc.DocumentNode.InnerHtml.Replace("\r\n", ""); timetable = ParseTable(doc, TimetableType.Year); } catch (WebException ex) { Logger.ExceptionLogger.Log(ex); timetable = null; } catch (NotSupportedException ex) { Logger.ExceptionLogger.Log(ex); timetable = null; } return timetable; }
public void AddOrUpdateStudyYear(StudyYear studyYear) { using (var scope = Db.BeginWork()) { _studyYearRepository.AddOrUpdate(studyYear); scope.SaveChanges(); } }
private static string GetAdmissionYearText(StudyYear admissionYear) { if (admissionYear != null) { return(String.Concat(admissionYear.Name, " ", Resources.Resources.yearOfAdmission)); } return(String.Empty); }
public List <DisciplineWorkload> GetAllDisciplineWorkloadsByYearAndSemester(StudyYear selectedStudyYear, Semester selectedSemester) { using (Db.BeginReadOnlyWork()) { return(_disciplineWorkloadRepository .GetMany(w => w.StudyYearId == selectedStudyYear.Id && w.SemesterId == selectedSemester.Id, w => w.Group, w => w.DisciplineYear, w => w.DisciplineYear.Discipline).ToList()); } }
public List <DisciplineWorkload> GetAllDisciplineWorkloadsByYear(StudyYear year) { using (Db.BeginReadOnlyWork()) { return(_disciplineWorkloadRepository .GetMany(w => w.StudyYearId == year.Id, w => w.Group, w => w.DisciplineYear, w => w.DisciplineYear.Discipline, w => w.Semester, w => w.Group.Speciality.Faculty, w => w.Group.Speciality).ToList()); } }
public async Task <ActionResult> DeleteConfirmed(int id) { StudyYear studyYear = await db.StudyYears.FindAsync(id); db.StudyYears.Remove(studyYear); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Name")] StudyYear studyYear) { if (ModelState.IsValid) { db.Entry(studyYear).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(studyYear)); }
// POST api/studyyear public IActionResult Post([FromBody] StudyYear newYear) { if (newYear == null || !ModelState.IsValid) { return(BadRequest()); } this.context.StudyYears.Add(newYear); this.context.SaveChanges(); return(Ok()); }
public async Task <ActionResult> Create([Bind(Include = "Id,Name")] StudyYear studyYear) { if (ModelState.IsValid) { db.StudyYears.Add(studyYear); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(studyYear)); }
// GET api/studyyear/3 public IActionResult Get(int id) { StudyYear studyYear = this.context.StudyYears .Where(currentYear => currentYear.StudyYearId == id) .FirstOrDefault(); if (studyYear != null) { return(Ok(studyYear)); } return(NotFound()); }
private void Initialize(StudyYear year) { _year = year; Panel = new PanelManager { RightButtons = new List <PanelButtonManager> { new PanelButtonManager { OnButtonAction = o => Save(), Icon = PackIconModernKind.Save, Text = "Save" } } }; }
// GET: StudentArea/StudyYears/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } StudyYear studyYear = await db.StudyYears.FindAsync(id); if (studyYear == null) { return(HttpNotFound()); } return(View(studyYear)); }
/** * <summary> Constructor from known parameters. </summary> * <param name="id"> Group's ID in the DB. </param> * <param name="abbreviation"> Abbreaviation of the program the students are in. </param> * <param name="name"> Name of the program the students are in. </param> * <param name="year"> Year/grade to which students belong to. </param> * <param name="semester"> Semester in which the students are. </param> * <param name="form"> Form of study the students attend. </param> * <param name="type"> Type of study the students are in. </param> * <param name="language"> Language of study in which the student use. </param> * <param name="studentCount"> Number of student's in a study group. </param> */ public StudentGroup(UInt32 id, string abbreviation, string name, StudyYear year, StudySemester semester, StudyForm form, StudyType type, StudyLanguage language, UInt16 studentCount) { this.Id = id; this.Abbreviation = abbreviation; this.Name = name; this.Year = year; this.Semester = semester; this.Form = form; this.Type = type; this.Language = language; this.StudentCount = studentCount; this.Subjects = new Dictionary <UInt32, Subject>(); }
public void Execute(CreateStudyYearCommand command) { if (command == null) { throw new ArgumentNullException("command"); } if (_repository == null) { throw new InvalidOperationException("Repository is not initialized."); } var aggregate = new StudyYear(command.Id, command._definedSubjects); aggregate.Version = -1; _repository.Save(aggregate, aggregate.Version); }
public Guid[] GetAllLastWorkloadEmployees(Discipline discipline, StudyYear studyYear) { using (Db.BeginReadOnlyWork()) { if (_workloadRepository.Count() == 0) { return(null); } var workloads = _workloadRepository.GetMany( w => w.LocalWorkload.DisciplineYear.DisciplineId == discipline.Id //&& w.LocalWorkload.Group.SpecialityId == group.SpecialityId && w.LocalWorkload.StudyYear.Year == studyYear.Year - 1); return(workloads?.Where(w => w.EmployeeId != null).Select(w => (Guid)w.EmployeeId).ToArray()); } }
public Guid?GetLastWorkloadEmployeeId(Discipline discipline, Group group, StudyYear studyYear) { using (Db.BeginReadOnlyWork()) { if (_workloadRepository.Count() == 0) { return(null); } var workload = _workloadRepository.Get( w => w.LocalWorkload.DisciplineYear.DisciplineId == discipline.Id //&& w.LocalWorkload.Group.SpecialityId == group.SpecialityId && w.LocalWorkload.StudyYear.Year == studyYear.Year - 1); return(workload?.EmployeeId); } }
public IActionResult Delete(int id) { StudyYear studyYear = this.context.StudyYears .Where(currentYear => currentYear.StudyYearId == id) .FirstOrDefault(); if (studyYear != null) { this.context.StudyYears.Remove(studyYear); this.context.SaveChanges(); return(Ok()); } return(NotFound()); }
public static void ExportIndividualPlan(Employee employee, StudyYear year) { string path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Templates\IndPlanTemplate.xltx"); Microsoft.Office.Interop.Excel.Application ObjExcel = new Microsoft.Office.Interop.Excel.Application(); Workbook ObjWorkBook; Worksheet ObjWorkSheet; //Книга. ObjWorkBook = ObjExcel.Workbooks.Add(path); //System.Reflection.Missing.Value); ObjWorkSheet = (Worksheet)ObjWorkBook.Sheets[1]; ObjWorkBook.Title = string.Format("Индивидуальный план {0} ({1} / {2})", employee.Name, year.Year, Convert.ToInt32(year.Year) + 1); ObjWorkSheet.Cells[Properties.IndPlanExport.Default.YearsDescriptionRowCell.X, Properties.IndPlanExport.Default.YearsDescriptionRowCell.Y] = string.Format("На {0} / {1} учебный год", year.Year, Convert.ToInt32(year.Year) + 1); ObjWorkSheet.Cells[Properties.IndPlanExport.Default.TeacherFIORowCell.X, Properties.IndPlanExport.Default.TeacherFIORowCell.Y] = employee.Name; PrintSemester(employee, SemesterType.Autumm, year, ObjWorkBook); //осенний семестр PrintSemester(employee, SemesterType.Spring, year, ObjWorkBook); //весенний семестр ObjExcel.Visible = true; ObjExcel.UserControl = true; }
// PUT api/studyyear/3 public IActionResult Put(int id, [FromBody] StudyYear updatedYear) { if (updatedYear != null && ModelState.IsValid) { StudyYear studyYear = this.context.StudyYears .Where(currentYear => currentYear.StudyYearId == id) .FirstOrDefault(); if (studyYear != null) { studyYear.Name = updatedYear.Name; this.context.StudyYears.Update(studyYear); this.context.SaveChanges(); return(Ok()); } return(NotFound()); } return(BadRequest()); }
public string GetXMLTimetableForMastersYear(StudyYear year) { var subjectsBL = new SubjectsBL(); return _exporter.ConvertToXML(_parser.GetTimetableForYear(year), subjectsBL.GetAllSubjects()); }
public List<FiiTimetableItem> GetTimetableForMastersYear(StudyYear year) { return _parser.GetTimetableForYear(year); }
public List<FiiTimetableItem> GetTimetableForBachelorYear(StudyYear year, HalfYear halfYear) { return _parser.GetTimetableForYear(year, halfYear); }
public bool ImportDataFromExcel(string path, int year) { xlApp = new Excel.Application(); xlWorkBook = xlApp.Workbooks.Open(path, 0, true, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0); xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1); //Проход по обоим листам if (_studyYear == null) { if (_studyYears.FirstOrDefault(s => s.Year == year) == null) { _studyYear = new StudyYear { Year = year } } ; else { _studyYear = _studyYears.FirstOrDefault(s => s.Year == year); } } string semester = path.Split('_').LastOrDefault()?.Split('.').FirstOrDefault(); if (semester == null) { Log.Add($"ФАТАЛЬНО: В конце имени файла не сожержится информация о номере семестра"); return(false); } xlWorkSheet = xlWorkBook.Worksheets[1]; int counter = Properties.Import.Default.StartRow; while (xlWorkSheet.GetCellText(counter, Properties.Import.Default.Department) != "") { var department = xlWorkSheet.GetCellText(counter, Properties.Import.Default.Department); if (department != "ПО") { counter++; continue; } string specialityName = "ПИН.РИС"; string disciplineName = xlWorkSheet.GetCellText(counter, Properties.Import.Default.Discipline); int lectures = xlWorkSheet.GetCellText(counter, Properties.Import.Default.Lectures) != "" ? Convert.ToInt32(xlWorkSheet.GetCellText(counter, Properties.Import.Default.Lectures)) : 0; int labs = xlWorkSheet.GetCellText(counter, Properties.Import.Default.Labs) != "" ? Convert.ToInt32(xlWorkSheet.GetCellText(counter, Properties.Import.Default.Labs)) : 0; int practices = xlWorkSheet.GetCellText(counter, Properties.Import.Default.Practicies) != "" ? Convert.ToInt32(xlWorkSheet.GetCellText(counter, Properties.Import.Default.Practicies)) : 0; bool kr = xlWorkSheet.GetCellText(counter, Properties.Import.Default.KR) != ""; bool kp = xlWorkSheet.GetCellText(counter, Properties.Import.Default.KP) != ""; bool ekz = xlWorkSheet.GetCellText(counter, Properties.Import.Default.EKZ) != ""; bool zach = xlWorkSheet.GetCellText(counter, Properties.Import.Default.ZACH) != ""; Discipline discipline = _allDisciplines.FirstOrDefault(d => d.Name == disciplineName); if (discipline == null) { discipline = _newDisciplines.FirstOrDefault(d => d.Name == disciplineName); if (discipline == null) { bool isSpecial = !(kr || kp || ekz || zach); bool hasWeeks = lectures + labs + practices != 0; PracticeKind?type = null; if (!hasWeeks && isSpecial)//выбрасываем всё кроме практик и учебных дисциплин { counter++; continue; } else if (isSpecial) { type = GetSpecial(disciplineName);//определяем тип практики } discipline = new Discipline { Department = _defaultDepartment, Name = disciplineName, PracticeType = type, TypeOfDiscipline = type == null ? DisciplineType.EASY : DisciplineType.PRACTICE }; _newDisciplines.Add(discipline); Log.Add($"Неизвестная дисциплина:'[{discipline.Name}]'"); } } DisciplineYear disciplineYear = new DisciplineYear { Discipline = discipline }; disciplineYear.CountOfLecture = lectures; disciplineYear.CountOfPractice = practices; disciplineYear.CountOfLabs = labs; disciplineYear.HasKR = kr; disciplineYear.HasKP = kp; disciplineYear.HasEx = ekz; disciplineYear.HasCR = zach; _disciplineYears.Add(disciplineYear); int course = 1; if (semester != "") { course = (int)Math.Ceiling(Convert.ToInt32(semester) / 2f); } int entryYear = (Convert.ToInt32(year) - course + 1); DisciplineWorkload workload = new DisciplineWorkload { DisciplineYear = disciplineYear, Semester = _semesters.FirstOrDefault(s => s.Number == Convert.ToInt32(semester)) }; if (workload.Semester == null) { Log.Add($"ФАТАЛЬНО: Не найден семестр {semester}. Строка {counter}"); return(false); } workload.StudyYear = _studyYear; var gr = _groups.FirstOrDefault(g => g.EntryYear == entryYear && g.Speciality.Name == specialityName); if (gr == null) { var speciality = _specialities.FirstOrDefault(s => s.Name == specialityName); if (speciality == null) { Log.Add($"ФАТАЛЬНО: Не найдена специальность {specialityName}. Строка {counter}"); return(false); } if ((gr = _newGroups.FirstOrDefault(g => g.Speciality == speciality && g.EntryYear == entryYear)) == null) { _newGroups.Add(gr = new Group { EntryYear = entryYear, Name = $"{specialityName}{entryYear}", Speciality = speciality }); } Log.Add($"Неизвестная группа {specialityName} поступившая в {entryYear} год. Строка {counter}"); } workload.Group = gr; _workloads.Add(workload); counter++; } xlWorkBook.Close(true, misValue, misValue); xlApp.Quit(); ReleaseObject(xlWorkSheet); ReleaseObject(xlWorkBook); ReleaseObject(xlApp); return(true); }
public static void ExportSemester(StudyYear year, SemesterType semester) { string path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Templates\SemesterTemplate.xltx"); Dictionary <string, int> counts = new Dictionary <string, int>() { { "ФИТ", 0 }, { "МСФ", 0 }, { "ИДПО", 0 }, { "МАГ", 0 } }; List <DisciplineWorkload> workloads = _service.GetAllDisciplineWorkloadsByYearAndSemesterType(year.Year, semester); workloads = workloads.OrderBy(w => w.Semester.Number).ToList(); if (workloads.Count > 0) { Microsoft.Office.Interop.Excel.Application ObjExcel = new Microsoft.Office.Interop.Excel.Application(); Workbook ObjWorkBook; Worksheet ObjWorkSheet; ObjWorkBook = ObjExcel.Workbooks.Add(path); ObjWorkSheet = (Worksheet)ObjWorkBook.Sheets[1]; ObjWorkBook.Title = string.Format("Отчет {0} семестр({1} / {2})", semester.ToDescriptionString(), year.Year, year.Year + 1); ObjWorkSheet.Cells[3, 1] = string.Format("экзаменационной сессии за {0} семестр {1} / {2} учебного года", semester.ToDescriptionString(), year.Year, year.Year + 1); foreach (var w in workloads) { int rowCounter = SemesterExport.Default.FITStartRow; if (w.DisciplineYear.Discipline.TypeOfDiscipline == DisciplineType.SPECIAL) { rowCounter++; continue; } Group group = w.Group; int cource = year.Year - group.EntryYear + 1; Discipline discipline = w.DisciplineYear.Discipline; int countStud = group.CountOfStudents; int weeks = w.Semester.CountOfWeeks; int lec = w.DisciplineYear.CountOfLecture; int prac = w.DisciplineYear.CountOfPractice; int lab = w.DisciplineYear.CountOfLabs; bool kr = w.DisciplineYear.HasKR; bool kp = w.DisciplineYear.HasKP; bool ekz = w.DisciplineYear.HasEx; bool zach = w.DisciplineYear.HasCR; float summ = WorkloadsCalculator.GetWorkloadCost(w); int index = 0; if (w.Group.StudyForm != StudyForm.FullTime) { rowCounter = counts["ФИТ"] + counts["ИДПО"] + counts["МСФ"] + SemesterExport.Default.IDPOStartRow; counts["ИДПО"]++; index = counts["ИДПО"]; } else if (w.Group.Speciality.Faculty.ShortName == "ФИТ") { if (w.Group.Qualification != Qualification.Magistracy) { rowCounter += counts["ФИТ"]; counts["ФИТ"]++; index = counts["ФИТ"]; } else { rowCounter = counts["ФИТ"] + counts["ИДПО"] + counts["МАГ"] + counts["МСФ"] + SemesterExport.Default.MAGStartRow; counts["МАГ"]++; index = counts["МАГ"]; } } else if (w.Group.Speciality.Faculty.ShortName == "МСФ") { rowCounter = counts["ФИТ"] + counts["МСФ"] + SemesterExport.Default.MSFStartRow; counts["МСФ"]++; index = counts["МСФ"]; } { Range line = (Range)ObjWorkSheet.Rows[rowCounter]; line.Insert(); ObjWorkSheet.Cells[rowCounter, SemesterExport.Default.IndexColumn] = index; ObjWorkSheet.Cells[rowCounter, SemesterExport.Default.GroupColumn] = group.Speciality.Name; ObjWorkSheet.Cells[rowCounter, SemesterExport.Default.CourceColumn] = cource; ObjWorkSheet.Cells[rowCounter, SemesterExport.Default.DisciplineColumn] = w.DisciplineYear.Discipline.Name; ObjWorkSheet.Cells[rowCounter, SemesterExport.Default.DisciplineCostColumn] = summ; ObjWorkSheet.Cells[rowCounter, SemesterExport.Default.LecFactColumn] = lec * weeks; ObjWorkSheet.Cells[rowCounter, SemesterExport.Default.StudentsColumn] = countStud; ObjWorkSheet.Cells[rowCounter, SemesterExport.Default.DisciplineColumn].EntireRow.AutoFit(); //применить автовысоту } rowCounter++; } ObjExcel.Visible = true; ObjExcel.UserControl = true; } }
private static void PrintSemester(Employee employee, SemesterType semesterType, StudyYear year, Workbook objWorkBook) { int descrList = semesterType == SemesterType.Autumm ? 2 : 3; int paramsList = semesterType == SemesterType.Autumm ? 4 : 5; List <DisciplineWorkload> workloads = semesterType == SemesterType.Autumm ? _service.GetAllEmloyeeWorkloadsByYearAutumm(employee, year.Year) : _service.GetAllEmloyeeWorkloadsByYearSpring(employee, year.Year); workloads = workloads.OrderBy(w => w.Semester.Number).ToList(); if (workloads.Count > 0) { Worksheet DescrSheet = (Worksheet)objWorkBook.Sheets[descrList]; Worksheet ParamsSheet = (Worksheet)objWorkBook.Sheets[paramsList]; int currentRow = IndPlanExport.Default.DisciplinesStartRow; foreach (var w in workloads) { DescrSheet.Cells[currentRow, IndPlanExport.Default.DisciplineNameColumn] = w.DisciplineYear.Discipline.ToString(); if (w.DisciplineYear.Discipline.SpecialType == SpecialDisciplineKind.RUK_KAF) { ParamsSheet.Cells[currentRow - 1, IndPlanExport.Default.DisciplineSettingsStartColumn + 14] = CalculationSettings.Default.RukKaf; currentRow += 2; continue; } int cource = year.Year - w.Group.EntryYear + 1; string descr = string.Format("{0},{1},{2} курс", w.Group.Speciality.Faculty, w.Group.Speciality, cource); DescrSheet.Cells[currentRow, IndPlanExport.Default.DisciplineDescrColumn] = descr; DescrSheet.Cells[currentRow, IndPlanExport.Default.StudentsCountColumn] = w.Group.CountOfStudents; int weeks = w.Semester.CountOfWeeks; int countStud = w.Group.CountOfStudents; float lecFact = weeks * w.DisciplineYear.CountOfLecture * Properties.CalculationSettings.Default.LectureCost; float pracFact = weeks * w.DisciplineYear.CountOfPractice * Properties.CalculationSettings.Default.PracticeCost; float labFact = weeks * w.DisciplineYear.CountOfLabs * Properties.CalculationSettings.Default.LabCost; float ekzFact = w.DisciplineYear.HasEx ? Properties.CalculationSettings.Default.ExamControlCost * countStud : 0; //float konsFact = Convert.ToBoolean(reader[14]) ? Properties.CalculationSettings.Default.KonsCost * Convert.ToInt32(reader[6]) * weeks + (ekzFact!=0?2:0) : 0;\ float konsFact = Properties.CalculationSettings.Default.KonsCost * w.DisciplineYear.CountOfLecture * weeks + (ekzFact != 0 ? 2 : 0); float zachFact = w.DisciplineYear.HasCR ? Properties.CalculationSettings.Default.ZachCost * countStud : 0; float KPFact = w.DisciplineYear.HasKP ? Properties.CalculationSettings.Default.KPCost * countStud : 0; float KRFact = w.DisciplineYear.HasKR ? Properties.CalculationSettings.Default.KRCost * countStud : 0; ParamsSheet.Cells[currentRow - 1, Properties.IndPlanExport.Default.DisciplineSettingsStartColumn] = lecFact; ParamsSheet.Cells[currentRow - 1, Properties.IndPlanExport.Default.DisciplineSettingsStartColumn + 1] = pracFact; ParamsSheet.Cells[currentRow - 1, Properties.IndPlanExport.Default.DisciplineSettingsStartColumn + 2] = labFact; ParamsSheet.Cells[currentRow - 1, Properties.IndPlanExport.Default.DisciplineSettingsStartColumn + 3] = konsFact; ParamsSheet.Cells[currentRow - 1, Properties.IndPlanExport.Default.DisciplineSettingsStartColumn + 4] = ekzFact; ParamsSheet.Cells[currentRow - 1, Properties.IndPlanExport.Default.DisciplineSettingsStartColumn + 5] = zachFact; ParamsSheet.Cells[currentRow - 1, Properties.IndPlanExport.Default.DisciplineSettingsStartColumn + 6] = KPFact; ParamsSheet.Cells[currentRow - 1, Properties.IndPlanExport.Default.DisciplineSettingsStartColumn + 7] = KRFact; double other = 0; double geks = 0; double ruk = 0; double uchPr = w.DisciplineYear.CountOfLearnigPracticeWeeks * Properties.CalculationSettings.Default.UchPr; double prPr = w.DisciplineYear.CountOfManufacturePracticeWeeks * Properties.CalculationSettings.Default.PrPr; double preddipPr = w.DisciplineYear.CountOfUndergraduatePracticeWeeks * Properties.CalculationSettings.Default.PreddipPr; double NIIR = w.DisciplineYear.CountOfNIIR * Properties.CalculationSettings.Default.NIIR * countStud; //нир double GEK = w.DisciplineYear.Discipline.SpecialType == SpecialDisciplineKind.GEK ? (Properties.CalculationSettings.Default.GEK * countStud) : 0; //ГЭК. double GAKpred = w.DisciplineYear.Discipline.SpecialType == SpecialDisciplineKind.GAK_PRED ? (Properties.CalculationSettings.Default.GEK * countStud) : 0; double GAK = w.DisciplineYear.Discipline.SpecialType == SpecialDisciplineKind.GAK ? (Properties.CalculationSettings.Default.GAK * countStud) : 0; //ГAК double rukMag = w.DisciplineYear.Discipline.SpecialType == SpecialDisciplineKind.MAG_RUK ? (Properties.CalculationSettings.Default.MAGRuk * countStud) : 0; //рук маг geks = GEK + GAK + GAKpred; ruk += w.DisciplineYear.Discipline.SpecialType == SpecialDisciplineKind.ASP_RUK ? (Properties.CalculationSettings.Default.AspRuk * countStud) : 0f; ruk += rukMag; ruk += w.DisciplineYear.Discipline.SpecialType == SpecialDisciplineKind.BAK_RUK ? (countStud * Properties.CalculationSettings.Default.DPruk) : 0f; ruk += w.DisciplineYear.Discipline.SpecialType == SpecialDisciplineKind.MAG_RETZ ? countStud * CalculationSettings.Default.MagRetz : 0f; //MagRetz ruk += w.DisciplineYear.Discipline.SpecialType == SpecialDisciplineKind.RUK_KAF ? countStud : 0f; //руководство кафедрой other += NIIR; /*string disciplineName = reader[0].ToString(); * if (disciplineName.ToLower().Contains("норм") && disciplineName.ToLower().Contains("маг")) * other += countStud * Properties.CalculationSettings.Default.NormocontrolMag; * if (disciplineName.ToLower().Contains("доп") && disciplineName.ToLower().Contains("маг")) * other += countStud * Properties.CalculationSettings.Default.DopuskDissMag;*/ ParamsSheet.Cells[currentRow - 1, Properties.IndPlanExport.Default.DisciplineSettingsStartColumn + 8] = 0; ParamsSheet.Cells[currentRow - 1, Properties.IndPlanExport.Default.DisciplineSettingsStartColumn + 9] = uchPr; //уч пр. ParamsSheet.Cells[currentRow - 1, Properties.IndPlanExport.Default.DisciplineSettingsStartColumn + 10] = prPr; //пр пр. ParamsSheet.Cells[currentRow - 1, Properties.IndPlanExport.Default.DisciplineSettingsStartColumn + 11] = preddipPr; //преддип пр. ParamsSheet.Cells[currentRow - 1, Properties.IndPlanExport.Default.DisciplineSettingsStartColumn + 12] = 0; ParamsSheet.Cells[currentRow - 1, Properties.IndPlanExport.Default.DisciplineSettingsStartColumn + 13] = geks; ParamsSheet.Cells[currentRow - 1, Properties.IndPlanExport.Default.DisciplineSettingsStartColumn + 14] = ruk; ParamsSheet.Cells[currentRow - 1, Properties.IndPlanExport.Default.DisciplineSettingsStartColumn + 15] = other; currentRow += 2; } } }
public static void ExportWorkload(StudyYear year) { string path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Templates\WorkloadTemplate.xltx"); Microsoft.Office.Interop.Excel.Application ObjExcel = new Microsoft.Office.Interop.Excel.Application(); Workbook ObjWorkBook; Worksheet ObjWorkSheet; ObjWorkBook = ObjExcel.Workbooks.Add(path);//System.Reflection.Missing.Value); ObjWorkSheet = (Worksheet)ObjWorkBook.Sheets[1]; ObjWorkBook.Title = string.Format("Нагрузка ({0} / {1})", year.Year, year.Year + 1); // for (int i = 1; i < Math.Min(ObjWorkBook.Sheets.Count, 18); i++) { ObjWorkBook.Sheets[i].Cells[1, 17] = string.Format("{0} / {1}", year.Year, year.Year + 1); } List <DisciplineWorkload> dis_workloads = _service.GetAllDisciplineWorkloadsByYear(year).OrderBy(s => s.Semester.Number).ToList(); Dictionary <Worksheet, int> rowCounters = new Dictionary <Worksheet, int>(); //пишем данные for (int i = 2; i <= 17; i++) { rowCounters.Add(ObjWorkBook.Sheets[i], 6); } foreach (var d in dis_workloads) { List <Worksheet> toWriteList = new List <Worksheet>(); Dictionary <Worksheet, Workload> assignsForTeachers = new Dictionary <Worksheet, Workload>(); if (d.DisciplineYear.Discipline.SpecialType == SpecialDisciplineKind.RUK_KAF) { var buf = _service.GetAllWorkloadsByLocalWorkload(d.Id); if (buf.Count == 1) { string teacherName = buf[0].Employee?.Name; var sheet = ObjWorkBook.Sheets[teacherName]; toWriteList.Add(sheet); assignsForTeachers.Add(sheet, buf[0]); } continue; } if (d.Group.Speciality.Faculty.ShortName == "МСФ") { toWriteList.Add(ObjWorkBook.Sheets[6]); } else { if (d.Group.StudyForm == StudyForm.PartTime) { toWriteList.Add(ObjWorkBook.Sheets[5]); } else { if (d.Group.Qualification == Qualification.Bachelor) { toWriteList.Add(ObjWorkBook.Sheets[4]); } else { toWriteList.Add(ObjWorkBook.Sheets[8]); } } } List <Workload> assigns = _service.GetAllWorkloadsByLocalWorkload(d.Id); if (assigns.Count != 0) { foreach (var assign in assigns) { string teacherName = assign.Employee?.Name; if (teacherName != null) { Worksheet sheet = null; try { sheet = ObjWorkBook.Sheets[teacherName]; } catch { throw new Exception($"В книге нет листа для преподавателя '{teacherName}' "); } if (sheet != null) { toWriteList.Add(sheet); assignsForTeachers.Add(sheet, assign); } } } } else { if (d.Group.Qualification == Qualification.Bachelor) { toWriteList.Add(ObjWorkBook.Sheets[2]); } else { toWriteList.Add(ObjWorkBook.Sheets[3]); } } foreach (Worksheet sheet in toWriteList) { int countStud = d.Group.CountOfStudents; /*if (sheet.Index > 8 && Convert.ToBoolean(reader[34])) * { * Workload assign = DataManager.SharedDataManager().GetWorkloadAssign(Convert.ToInt32(reader[1]), sheet.Name); * countStud = assign.StudentsCount; * }*/ ExportNotAssign(d, sheet, rowCounters, countStud); } } ObjExcel.Visible = true; ObjExcel.UserControl = true; }
private List<TimetableItem> ParseTable(HtmlDocument document, TimetableType type, StudyYear studyYear = StudyYear.None, HalfYear halfYear = HalfYear.None, string groupNumber = "") { List<TimetableItem> timetable = new List<TimetableItem>(); if (document.DocumentNode.Descendants("table").Count() > 0) { foreach (HtmlNode table in document.DocumentNode.Descendants("table")) { DayOfWeek day = DayOfWeek.Monday; foreach (HtmlNode tableRow in table.Descendants("tr")) { bool isDirty = false; if (tableRow.Attributes.Count == 0) { TimetableItem item = null; int index = 0; foreach (HtmlNode tableCell in tableRow.Descendants("td")) { string innerText = tableCell.InnerText.Trim(); if (tableCell.Attributes.Count > 0 && tableCell.Attributes[0].Value == "10") { day = new DayOfWeek(); day = GetDayFromCell(innerText); } else { switch (index) { case 0: item = new TimetableItem(); item.Day = day; int startHours; int startMinutes; if (Int32.TryParse(innerText.Substring(0, 2), out startHours) && Int32.TryParse(innerText.Substring(3, 2), out startMinutes)) { item.StartTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, startHours, startMinutes, 0); } break; case 1: int endHours; int endMinutes; if (Int32.TryParse(innerText.Substring(0, 2), out endHours) && Int32.TryParse(innerText.Substring(3, 2), out endMinutes)) { item.EndTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, endHours, endMinutes, 0); } break; case 2: if (type == TimetableType.Year) { item.StudyGroup = GetGroupFromCell(innerText); index--; type = TimetableType.Group; isDirty = true; } else { item.ClassName = innerText; if (item.StudyGroup == null) { item.StudyGroup = new Group { YearOfStudy = studyYear, HalfYearOfStudy = halfYear, Number = groupNumber }; } if (isDirty) type = TimetableType.Year; } break; case 3: item.TypeOfClass = GetClassTypeFromCell(innerText); break; case 4: item.TeacherName = innerText; break; case 5: item.RoomNumber = innerText; break; case 6: item.Frequency = GetFrequencyFromCell(innerText); break; case 7: item.OptionalPackage = GetOptionalPackageFromCell(innerText); break; } index++; } } if (item != null) timetable.Add(item); } } } } return timetable; }
public Student(string name, string group, StudyYear studyYear) { this.name = name; this.group = group; this.studyYear = studyYear; }
public void displayCursus() { //panel.Children.Clear(); //studyYearGrid.ItemsSource = null; studyYears.Children.Clear(); Console.WriteLine("displaycursus.clear"); if (cursus != null && cursus.StudyYears != null) { Console.WriteLine("cursus not null"); if(displayedStudyYear == null) { displayedStudyYear = cursus.StudyYears.ElementAt(0); } foreach (Module m in displayedStudyYear.Modules) { Border myBorder1 = new Border(); myBorder1.Background = Brushes.SkyBlue; myBorder1.BorderBrush = Brushes.Black; myBorder1.BorderThickness = new Thickness(1); StackPanel m_panel = new StackPanel(); m_panel.Orientation = Orientation.Vertical; TextBox tb_m = new TextBox(); tb_m.Text = m.Name + " : " + m.getAverage().ToString(); tb_m.Foreground = Brushes.Black; tb_m.FontSize = 14; tb_m.FontWeight = FontWeights.Bold; Button btn_addLecture = new Button(); btn_addLecture.Width = 150; btn_addLecture.Content = "Add Lecture"; btn_addLecture.Click += (sender, e) => { var dialog = new NewLecture(); if(dialog.ShowDialog() == true) { Lecture newLecture = new Lecture(dialog.LectureName, dialog.Weight); m.addLecture(newLecture); } displayCursus(); }; m_panel.Children.Add(tb_m); m_panel.Children.Add(btn_addLecture); myBorder1.Child = m_panel; studyYears.Children.Add(myBorder1); foreach (Lecture l in m.Lectures) { StackPanel l_panel = new StackPanel(); l_panel.Orientation = Orientation.Vertical; TextBox tb_l = new TextBox(); setLectureAverage(l, tb_l); l_panel.Children.Add(tb_l); m_panel.Children.Add(l_panel); DataGrid dg_l = new DataGrid(); dg_l.Name = "test"; dg_l.Width = 250; dg_l.Height = 30 + (l.Grades.Count + 1) * 25; //dg_l.MouseUp += Dg_l_MouseUp; //dg_l.SelectionChanged += Dg_l_SelectionChanged; try { dg_l.ItemsSource = l.Grades; } catch (System.InvalidOperationException) { MessageBox.Show("Please validate your entry or modification with 'enter' key"); } dg_l.CanUserAddRows = true; m_panel.Children.Add(dg_l); Button b = new Button(); b.Width = 150; b.Content = "Delete selected grade"; b.Click += (sender, e) => { l.removeGrade(dg_l.SelectedItem); displayCursus(); }; l_panel.Children.Add(b); } } } }
public AddWorkloadManager(StudyYear year) { Workload = new Workload(); Title = "Добавить дисциплину"; Initialize(year); }
public AddWorkloadManager(Workload workload, StudyYear year) { Workload = workload; Title = "Изменить дисциплину"; Initialize(year); }