Ejemplo n.º 1
0
        void Handler_ColumnHeaderClick(object sender, DataEventArgs e)
        {
            JournalColumnHeader header = sender as JournalColumnHeader;
            if (header == null)
            {
                return;
            }

            if (this.selectedColumnHeader != null)
            {
                this.selectedColumnHeader.DetectChanges();
            }

            this.selectedColumnHeader = header;
            foreach (var i in this.columnHeaders)
            {
                if (i != header)
                {
                    i.IsSelected = false;
                    i.Column.ActivateCells(false);
                    i.Column.HighlightCells(false);
                }
            }

            header.IsSelected = !header.IsSelected;
            if (header.IsSelected)
            {
                this.tbTopic.Text = header.Topic;
                this.tbTask.Text = header.Task;

                if (this.IsEditable)
                {
                    header.Column.ActivateCells(true);
                }
                else
                {
                    header.Column.HighlightCells(true);
                }
            }
            else
            {
                this.tbTask.Text = "";
                this.tbTopic.Text = "";
                header.Column.HighlightCells(false);
                header.Column.ActivateCells(false);
            }

            foreach (var i in this.rowHeaders)
            {
                if (i.IsSelected)
                {
                    i.Row.HighlightCells(true);
                }
            }
            
        }
Ejemplo n.º 2
0
        void SetSubjectAndMonth(string subject, DateTime d)
        {
            this.ClearTable();
            List<lesson> list = DBModel.Instance.GetLessonBy_GroupId_SubjectName_Month_Year(this.tableHeader.StudentsGroup.Id, subject, d.Month,d.Year);

            for (int i = 0; i < list.Count; ++i)
            {
                JournalColumnHeader h = new JournalColumnHeader();
                h.OnClick += this.Handler_ColumnHeaderClick;
                h.SetData(list[i]);
                this.grid1.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
                Grid.SetColumn(h, i + 1);
                Grid.SetRow(h, 0);
                this.grid1.Children.Add(h);
                this.columnHeaders.Add(h);
                for (int j = 0; j < this.rowHeaders.Count; ++j)
                {
                    JournalCell c = new JournalCell();
                    c.Fill(DBModel.Instance.GetJournalEntriesBy_StudentId_LessonId(this.rowHeaders[j].Student.Id, list[i].Id));
                    Grid.SetRow(c, j + 1);
                    Grid.SetColumn(c, i + 1);
                    this.grid1.Children.Add(c);
                    h.Column.Cells.Add(c);
                    this.rowHeaders[j].Row.Cells.Add(c);
                }
            }

        }