コード例 #1
0
ファイル: TfdByMonth.cs プロジェクト: BesuglovS/UchOtd
        public TfdByMonth(ScheduleRepository repo)
        {
            InitializeComponent();

            _repo = repo;
            form = this;
        }
コード例 #2
0
ファイル: ChooseRings.cs プロジェクト: BesuglovS/UchOtd
        public ChooseRings(ScheduleRepository repo, Teacher teacher)
        {
            InitializeComponent();

            _repo = repo;
            _teacher = teacher;
        }
コード例 #3
0
        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 = "";
            }
        }
コード例 #4
0
ファイル: Analysis.cs プロジェクト: BesuglovS/UchOtd
        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;
        }
コード例 #5
0
ファイル: EditLesson.cs プロジェクト: BesuglovS/Schedule
        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);
        }
コード例 #6
0
ファイル: NewWordExport.cs プロジェクト: BesuglovS/Schedule
        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);
            }
        }
コード例 #7
0
ファイル: MainForm.cs プロジェクト: BesuglovS/Session
        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");
        }
コード例 #8
0
ファイル: Analysis.cs プロジェクト: BesuglovS/UchOtd
        public Analysis(ScheduleRepository repo)
        {
            InitializeComponent();

            _repo = repo;

            FillLogLevels();
        }
コード例 #9
0
ファイル: StudentList.cs プロジェクト: BesuglovS/UchOtd
        public StudentList(ScheduleRepository repo)
        {
            InitializeComponent();

            _repo = repo;

            viewGrid.RowsDefaultCellStyle.WrapMode = DataGridViewTriState.True;
        }
コード例 #10
0
ファイル: DailyLessons.cs プロジェクト: BesuglovS/UchOtd
        public DailyLessons(ScheduleRepository repo)
        {
            InitializeComponent();

            _uiScheduler = TaskScheduler.FromCurrentSynchronizationContext();

            _repo = repo;
        }
コード例 #11
0
ファイル: AddLesson.cs プロジェクト: BesuglovS/UchOtd
        public AddLesson(ScheduleRepository repo, int tfdId)
        {
            InitializeComponent();

            _repo = repo;

            _tfdId = tfdId;
        }
コード例 #12
0
ファイル: LessonListByTFD.cs プロジェクト: BesuglovS/UchOtd
        public LessonListByTfd(ScheduleRepository repo, int startId = -1)
        {
            InitializeComponent();

            _repo = repo;

            StartId = startId;
        }
コード例 #13
0
ファイル: PDFExport.cs プロジェクト: BesuglovS/UchOtd
 public static void ExportWholeSchedule(
     string filename, 
     ScheduleRepository repo,
     bool save,
     bool quit,
     bool print)
 {
     throw new NotImplementedException();
 }
コード例 #14
0
ファイル: DisciplineByOrder.cs プロジェクト: BesuglovS/UchOtd
        public DisciplineByOrder(ScheduleRepository repo)
        {
            InitializeComponent();

            _repo = repo;

            discsView.AllowDrop = true;

            LoadDisciplines();
        }
コード例 #15
0
ファイル: StudentList.cs プロジェクト: BesuglovS/Schedule
        public StudentList(ScheduleRepository repo)
        {
            InitializeComponent();

            _repo = repo;

            var groups = _repo.GetAllStudentGroups();
            studentGroups.DataSource = groups;
            studentGroups.DisplayMember = "Name";
            studentGroups.ValueMember = "StudentGroupId";
        }
コード例 #16
0
ファイル: EditLesson.cs プロジェクト: BesuglovS/UchOtd
        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;
        }
コード例 #17
0
ファイル: Changes.cs プロジェクト: BesuglovS/UchOtd
        public Changes(ScheduleRepository repo, int groupId)
        {
            InitializeComponent();

            Icon = Resources.diffIcon;

            _uiScheduler = TaskScheduler.FromCurrentSynchronizationContext();

            _repo = repo;
            _initialGroupId = groupId;
            _groupId = groupId;
        }
コード例 #18
0
ファイル: TeacherSchedule.cs プロジェクト: BesuglovS/UchOtd
        public TeacherSchedule(ScheduleRepository repo)
        {
            InitializeComponent();
            
            _repo = repo;

            weekFilter.Items.Clear();
            for (int i = 1; i <= 20; i++)
            {
                weekFilter.Items.Add(i);
            }
        }
コード例 #19
0
ファイル: WnuUpload.cs プロジェクト: BesuglovS/UchOtd
        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/");
        }
コード例 #20
0
ファイル: StudentProperties.cs プロジェクト: BesuglovS/UchOtd
        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();
            }
        }
コード例 #21
0
ファイル: ExamView.cs プロジェクト: BesuglovS/UchOtd
 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();
 }
コード例 #22
0
ファイル: PDFExport.cs プロジェクト: BesuglovS/UchOtd
        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);
            }
        }
コード例 #23
0
ファイル: PDFExport.cs プロジェクト: BesuglovS/UchOtd
        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);
                }
            //}
        }
コード例 #24
0
ファイル: ExamProperties.cs プロジェクト: BesuglovS/UchOtd
        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();
            }
        }
コード例 #25
0
ファイル: CopyDB.cs プロジェクト: BesuglovS/Schedule
        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();
            }
        }
コード例 #26
0
ファイル: ZachDates.cs プロジェクト: BesuglovS/UchOtd
        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;
        }
コード例 #27
0
        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 : "";
            }
        }
コード例 #28
0
ファイル: ExamView.cs プロジェクト: BesuglovS/Session
        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;
        }
コード例 #29
0
 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();
 }
コード例 #30
0
ファイル: DisciplineView.cs プロジェクト: BesuglovS/Schedule
        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;
            }
        }