예제 #1
0
        private void patronymicLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            var       librarianRepository = new LibrarianRepository();
            LinkLabel thisLinkLabel       = (sender as LinkLabel);

            var readers = librarianRepository.Get().Select(r => new {
                r.Id,
                r.Name,
                r.Surname,
                r.Patronymic,
                r.DateOfBirth,
                r.TelephoneNumber
            });

            if (thisLinkLabel.Text.Contains("˄"))
            {
                dataGridView1.DataSource = readers.OrderBy(r => r.Patronymic).ToList();
                thisLinkLabel.Text       = thisLinkLabel.Text.Split('˄')[0] + "˅";
            }
            else
            {
                dataGridView1.DataSource = readers.OrderByDescending(r => r.Patronymic).ToList();
                thisLinkLabel.Text       = thisLinkLabel.Text.Split('˅')[0] + "˄";
            }
        }
예제 #2
0
        public void SetDataGridView()
        {
            var librarianRepository = new LibrarianRepository();
            var readers             = from reader in librarianRepository.Get()
                                      select new
            {
                reader.Id,
                reader.Name,
                reader.Surname,
                reader.Patronymic,
                reader.DateOfBirth,
                reader.TelephoneNumber
            };

            this.dataGridView1.DataSource = readers.ToList();
        }