public TfdByMonth(ScheduleRepository repo) { InitializeComponent(); _repo = repo; form = this; }
public ChooseRings(ScheduleRepository repo, Teacher teacher) { InitializeComponent(); _repo = repo; _teacher = teacher; }
public IncompatiblePairView(ScheduleRepository repo, CustomDisciplineAttribute cda) { CdaId = cda.CustomDisciplineAttributeId; const string separator = " @ "; var disciplineSummary = ""; disciplineSummary += cda.Discipline.StudentGroup.Name + separator; disciplineSummary += cda.Discipline.Name + separator; disciplineSummary += (Constants.Attestation.ContainsKey(cda.Discipline.Attestation) ? Constants.Attestation[cda.Discipline.Attestation] : "") + separator; disciplineSummary += cda.Discipline.AuditoriumHours; Disc1 = disciplineSummary; int discId; int.TryParse(cda.Value, out discId); var disc2 = repo.Disciplines.GetDiscipline(discId); if (disc2 != null) { disciplineSummary = ""; disciplineSummary += disc2.StudentGroup.Name + separator; disciplineSummary += disc2.Name + separator; disciplineSummary += (Constants.Attestation.ContainsKey(disc2.Attestation) ? Constants.Attestation[disc2.Attestation] : "") + separator; disciplineSummary += disc2.AuditoriumHours; Disc2 = disciplineSummary; } else { Disc2 = ""; } }
private Dictionary<int, int> CountDow(ScheduleRepository repo, bool printOut) { var result = new Dictionary<int, int>(); for (int i = 1; i <= 7; i++) { result.Add(i, 0); } foreach (var calendar in repo.Calendars.GetAllCalendars()) { if (calendar.State == Calendar.Normal) { result[Constants.DowRemap[(int) calendar.Date.DayOfWeek]]++; } } if (printOut) { for (int i = 1; i <= 7; i++) { M(Constants.DowLocal[i] + " - " + result[i], LogLevel.ErrorsOnly); } } return result; }
public EditLesson(ScheduleRepository repo, int groupId, int dow, string time) { InitializeComponent(); _repo = repo; _dow = dow; _ring = _repo.FindRing(DateTime.ParseExact(time, "H:mm", CultureInfo.InvariantCulture)); var sStarts = _repo.GetSemesterStarts(); var gl = _repo.GetGroupedGroupLessons(groupId, sStarts); _curLessons = new Dictionary<int, Tuple<string, List<Lesson>>>(); if (gl.ContainsKey(dow + " " + time)) { _curLessons = gl[dow + " " + time]; _curTFDIndex = 0; } else { _curTFDIndex = -1; tfdIndex.Text = "Пусто тут барин!"; } DisplayTFD(_curTFDIndex); }
internal static void AltExportSchedulePage( Dictionary<int, Dictionary<string, Dictionary<int, Tuple<string, List<Lesson>>>>> schedule, string facultyName, string filename, string dow, ScheduleRepository _repo, bool save, bool quit, bool print) { Schedule = schedule; FacultyName = facultyName; Filename = filename; Dow = dow; _Repo = _repo; Save = save; Quit = quit; Print = print; using (WordprocessingDocument package = WordprocessingDocument.Create(filename, WordprocessingDocumentType.Document)) { CreateParts(package); } var eprst = 999; using (WordprocessingDocument package2 = WordprocessingDocument.Open(filename, true)) { int pageCount = int.Parse(package2.ExtendedFilePropertiesPart.Properties.Pages.InnerText); } }
public MainForm() { InitializeComponent(); _repo = new SessionRepository("data source=tcp:" + "127.0.0.1" + ",1433;Database=Session-S-13-14-1;User ID = sa;Password = ghjuhfvvf;multipleactiveresultsets=True"); _sRepo = new ScheduleRepository("data source=tcp:" + "127.0.0.1" + ",1433;Database=S-13-14-1;User ID = sa;Password = ghjuhfvvf;multipleactiveresultsets=True"); }
public Analysis(ScheduleRepository repo) { InitializeComponent(); _repo = repo; FillLogLevels(); }
public StudentList(ScheduleRepository repo) { InitializeComponent(); _repo = repo; viewGrid.RowsDefaultCellStyle.WrapMode = DataGridViewTriState.True; }
public DailyLessons(ScheduleRepository repo) { InitializeComponent(); _uiScheduler = TaskScheduler.FromCurrentSynchronizationContext(); _repo = repo; }
public AddLesson(ScheduleRepository repo, int tfdId) { InitializeComponent(); _repo = repo; _tfdId = tfdId; }
public LessonListByTfd(ScheduleRepository repo, int startId = -1) { InitializeComponent(); _repo = repo; StartId = startId; }
public static void ExportWholeSchedule( string filename, ScheduleRepository repo, bool save, bool quit, bool print) { throw new NotImplementedException(); }
public DisciplineByOrder(ScheduleRepository repo) { InitializeComponent(); _repo = repo; discsView.AllowDrop = true; LoadDisciplines(); }
public StudentList(ScheduleRepository repo) { InitializeComponent(); _repo = repo; var groups = _repo.GetAllStudentGroups(); studentGroups.DataSource = groups; studentGroups.DisplayMember = "Name"; studentGroups.ValueMember = "StudentGroupId"; }
public EditLesson(ScheduleRepository repo, int groupId, int dow, string time, bool putProposedLessons) { InitializeComponent(); _repo = repo; _groupId = groupId; _dow = dow; _time = time; _ring = _repo.Rings.FindRing(DateTime.ParseExact(_time, "H:mm", CultureInfo.InvariantCulture)); _putProposedLesson = putProposedLessons; }
public Changes(ScheduleRepository repo, int groupId) { InitializeComponent(); Icon = Resources.diffIcon; _uiScheduler = TaskScheduler.FromCurrentSynchronizationContext(); _repo = repo; _initialGroupId = groupId; _groupId = groupId; }
public TeacherSchedule(ScheduleRepository repo) { InitializeComponent(); _repo = repo; weekFilter.Items.Clear(); for (int i = 1; i <= 20; i++) { weekFilter.Items.Add(i); } }
public static void UploadNotes(ScheduleRepository repo, CancellationToken cToken) { var jsonSerializer = new JavaScriptSerializer { MaxJsonLength = 10000000 }; cToken.ThrowIfCancellationRequested(); var notes = repo.ScheduleNotes.GetAllScheduleNotes(); var mySqlNotes = MySQLScheduleNote.FromNotes(notes); var wud = new WnuUploadData { dbPrefix = "", tableSelector = "scheduleNotes", data = jsonSerializer.Serialize(mySqlNotes) }; string json = jsonSerializer.Serialize(wud); UploadTableData(json, @"http://wiki.nayanova.edu/_php/includes/"); }
public StudentProperties(StudentList parent, ScheduleRepository repo, int studentId, StudentDetailsMode mode) { InitializeComponent(); _studentList = parent; _repo = repo; _student = _repo.Students.GetStudent(studentId); _mode = mode; if ((_student == null) && mode == StudentDetailsMode.Edit) { Close(); } }
public static List<ExamView> FromExamList(ScheduleRepository repo, List<Exam> list) { return (from exam in list let disc = repo.Disciplines.GetFirstFiltredDisciplines(d => d.DisciplineId == exam.DisciplineId) let consAud = exam.ConsultationAuditoriumId != 0 ? repo.Auditoriums.Get(exam.ConsultationAuditoriumId).Name : "" let examAud = (exam.ExamAuditoriumId != 0) ? repo.Auditoriums.Get(exam.ExamAuditoriumId).Name : "" let tfd = repo.TeacherForDisciplines.GetFirstFiltredTeacherForDiscipline(tefd => tefd.Discipline.DisciplineId == exam.DisciplineId) let teacherFio = (tfd != null && tfd.Teacher != null) ? tfd.Teacher.FIO : "" select new ExamView { ExamId = exam.ExamId, ConsultationAuditorium = consAud, ConsultationDateTime = exam.ConsultationDateTime, DisciplineName = disc.Name, ExamAuditorium = examAud, ExamDateTime = exam.ExamDateTime, GroupName = disc.StudentGroup.Name, TeacherFIO = teacherFio }).ToList(); }
public static void ExportSchedulePage( Dictionary<int, Dictionary<string, Dictionary<int, Tuple<string, List<Tuple<Lesson, int>>, string>>>> schedule, string facultyName, string filename, string dow, ScheduleRepository repo, bool save, bool quit, bool print) { double scheduleFontsize = 10; int pageCount; Document document; do { // Create a new PDF document document = CreateDocument(repo, facultyName, dow, schedule, scheduleFontsize); // Create a renderer and prepare (=layout) the document var docRenderer = new DocumentRenderer(document); docRenderer.PrepareDocument(); pageCount = docRenderer.FormattedDocument.PageCount; scheduleFontsize -= 0.5; } while (pageCount > 1); // Render the file var pdfRenderer = new PdfDocumentRenderer(true, PdfFontEmbedding.Always) {Document = document}; pdfRenderer.RenderDocument(); // Save the document... if (save) { pdfRenderer.PdfDocument.Save(filename); } // ...and start a viewer. //Process.Start(filename); if (print) { if (!save) { pdfRenderer.PdfDocument.Save(filename); } SendToPrinter(filename); } }
public static void PrintWholeSchedule(ScheduleRepository repo) { /*foreach (var faculty in _repo.GetAllFaculties().OrderBy(f => f.SortingOrder)) {*/ //var facultyId = faculty.FacultyId; var facultyId = repo.Faculties.GetFirstFiltredFaculty(f => f.Letter == "Т").FacultyId; var facultyName = repo.Faculties.GetFaculty(facultyId).Name; for (int i = 1; i <= 6; i++) { //var i = 4; var facultyDowLessons = repo.Lessons.GetFacultyDowSchedule(facultyId, i, false, -1, false, false); ExportSchedulePage(facultyDowLessons, facultyName, "Export.pdf", Constants.DowLocal[i], repo, false, false, true); } //} }
public ExamProperties(ScheduleRepository repo, int examToUpdateId, ExamPropertiesMode mode) { InitializeComponent(); _repo = repo; _mode = mode; if (_mode == ExamPropertiesMode.Edit) { _exam = _repo.Exams.GetExam(examToUpdateId); } if (_mode == ExamPropertiesMode.New) { _exam = new Exam(); } }
private void makeACopy_Click(object sender, EventArgs e) { if (sqlExpressDB.Checked) { var dbName = SQLExpressDatabaseName.Text; var connectionString = "data source=tcp:127.0.0.1,1433; Database=" + dbName + ";User ID = " + Schedule.Properties.Settings.Default.DBUserName + ";Password = " + Schedule.Properties.Settings.Default.DBPassword; var newRepo = new ScheduleRepository(connectionString); newRepo.CreateDB(); newRepo.cloneDB(mainForm._repo); Close(); } }
public ZachDates(ScheduleRepository repo) { this.repo = repo; InitializeComponent(); var groups = repo.StudentGroups.GetAllStudentGroups().OrderBy(sg => sg.Name).ToList(); groupList.ValueMember = "StudentGroupId"; groupList.DisplayMember = "Name"; groupList.DataSource = groups; var teachers = repo.Teachers.GetAllTeachers().OrderBy(t => t.FIO).ToList(); teachersList.ValueMember = "TeacherId"; teachersList.DisplayMember = "FIO"; teachersList.DataSource = teachers; }
public GroupAttributesView(ScheduleRepository repo, List<CustomStudentGroupAttribute> attrList) { if (attrList.Count != 0) { StudentGroupId = attrList[0].StudentGroup.StudentGroupId; StudentGroup = attrList[0].StudentGroup.Name; var building = attrList.FirstOrDefault(csga => csga.Key == "Building"); Building = (building != null) ? repo.Buildings.GetBuilding(int.Parse(building.Value)).Name : ""; var auditorium = attrList.FirstOrDefault(csga => csga.Key == "Auditorium"); Auditorium = (auditorium != null) ? repo.Auditoriums.Get(int.Parse(auditorium.Value)).Name : ""; var shift = attrList.FirstOrDefault(csga => csga.Key == "Shift"); Shift = (shift != null) ? repo.Shifts.GetShift(int.Parse(shift.Value)).Name : ""; } }
public static List<ExamView> FromExamList(ScheduleRepository _repo, List<Exam> list) { var result = new List<ExamView>(); string consAud; string examAud; foreach (var exam in list) { var disc = _repo.GetFirstFiltredDisciplines(d => d.DisciplineId == exam.DisciplineId); if (exam.ConsultationAuditoriumId != 0) { consAud = _repo.GetAuditorium(exam.ConsultationAuditoriumId).Name; } else { consAud = ""; } if (exam.ExamAuditoriumId != 0) { examAud = _repo.GetAuditorium(exam.ExamAuditoriumId).Name; } else { examAud = ""; } result.Add(new ExamView() { ExamId = exam.ExamId, ConsultationAuditorium = consAud, ConsultationDateTime = exam.ConsultationDateTime, DisciplineName = disc.Name, ExamAuditorium = examAud, ExamDateTime = exam.ExamDateTime, GroupName = disc.StudentGroup.Name }); } return result; }
public static List<TeacherForDisciplineView> FromTfdList(List<TeacherForDiscipline> list, ScheduleRepository repo) { return list.Select(tfd => new TeacherForDisciplineView { TfdId = tfd.TeacherForDisciplineId, DisciplineId = tfd.Discipline.DisciplineId, DisciplineName = tfd.Discipline.Name, GroupName = tfd.Discipline.StudentGroup.Name, PlanHours = tfd.Discipline.AuditoriumHours, Attestation = Constants.Attestation[tfd.Discipline.Attestation], ScheduleHours = repo.CommonFunctions.GetTfdHours(tfd.TeacherForDisciplineId), HoursDone = repo.Lessons.GetFiltredLessons(l => (l.State == 1) && l.TeacherForDiscipline.TeacherForDisciplineId == tfd.TeacherForDisciplineId && (l.Calendar.Date.Date + l.Ring.Time.TimeOfDay) < DateTime.Now).Count*2, PlannedHours = repo.Lessons.GetFiltredLessons(l => l.State == 2 && l.TeacherForDiscipline.TeacherForDisciplineId == tfd.TeacherForDisciplineId && (l.Calendar.Date.Date + l.Ring.Time.TimeOfDay) > DateTime.Now).Count*2 }).ToList(); }
public DisciplineView(ScheduleRepository repo, Discipline discipline) { DisciplineId = discipline.DisciplineId; Name = discipline.Name; Attestation = Constants.Constants.Attestation.ContainsKey(discipline.Attestation) ? Constants.Constants.Attestation[discipline.Attestation] : ""; AuditoriumHours = discipline.AuditoriumHours; LectureHours = discipline.LectureHours; PracticalHours = discipline.PracticalHours; StudentGroupName = discipline.StudentGroup.Name; var tefd = repo.GetFirstFiltredTeacherForDiscipline(tfd => tfd.Discipline.DisciplineId == discipline.DisciplineId); if (tefd != null) { TeacherFIO = tefd.Teacher.FIO; ScheduleHours = repo.getTFDHours(tefd.TeacherForDisciplineId); } else { TeacherFIO = "нет"; ScheduleHours = 0; } }