コード例 #1
0
        /// <summary>
        /// Получение всех подразделений.
        /// </summary>
        private void GetAlldepartments()
        {
            if (GetAll != null)
            {
                GetAll();
            }

            Departments = Filters();

            if (Departments.Any())
            {
                btnNext.Enabled = true;
                btnPrev.Enabled = true;
            }
            else
            {
                btnNext.Enabled = false;
                btnPrev.Enabled = false;
            }
        }
コード例 #2
0
        internal void EnsureSeedData()
        {
            if (Departments.Any())
            {
                return;
            }

            Department department1 = new Department {
                Name = "Music"
            };
            Department department2 = new Department {
                Name = "Journalism"
            };
            Department department3 = new Department {
                Name = "Management"
            };

            Departments.Add(department1);
            Departments.Add(department2);
            Departments.Add(department3);

            Courses.AddRange(new[] {
                new Course {
                    Title = "First", Department = department1
                },
                new Course {
                    Title = "Second", Department = department1
                },
                new Course {
                    Title = "Third", Department = department1
                },

                new Course {
                    Title = "First", Department = department2
                },
                new Course {
                    Title = "Second", Department = department2
                },
                new Course {
                    Title = "Third", Department = department2
                },

                new Course {
                    Title = "First", Department = department3
                },
                new Course {
                    Title = "Second", Department = department3
                },
                new Course {
                    Title = "Third", Department = department3
                },
            });

            Employees.AddRange(new[] {
                new Employee {
                    Name = "Frankie West PhD", Department = department1
                },
                new Employee {
                    Name = "Jett Mitchell", Department = department1
                },
                new Employee {
                    Name = "Garrick Stiedemann DVM", Department = department1
                },
                new Employee {
                    Name = "Hettie Runte", Department = department1
                },
                new Employee {
                    Name = "Gabe Flatley", Department = department2
                },
                new Employee {
                    Name = "Zetta Beatty", Department = department2
                },
                new Employee {
                    Name = "Ms. Luis Jewess", Department = department2
                },
                new Employee {
                    Name = "Jefferey Legros III", Department = department3
                },
                new Employee {
                    Name = "Margaretta Roberts", Department = department3
                },
            });

            SaveChanges();
        }