Exemplo n.º 1
0
        public KindergardenManager(KindergardenContext context)
        {
            var repositoryFactory = new RepositoryFactory();

            repository = repositoryFactory.GetRepository(context);

            this.context = context;
        }
Exemplo n.º 2
0
 public KindergardenManager(KindergardenContext context, Repository repo)
 {
     repository = repo;
 }
        public void Initialize()
        {
            context = new KindergardenContext(options);

            context.Kindergarden.Add(new Kindergarden()
            {
                Id     = 1,
                Name   = "kindergarden1",
                Groups = new List <Group>()
                {
                    new Group()
                    {
                        Id                 = 1,
                        Name               = "group1",
                        KindergardenId     = 1,
                        GroupChildRelation = new List <GroupChild>()
                        {
                            new GroupChild()
                            {
                                ChildId = 1,
                                GroupId = 1,
                                Current = true,
                                //Id = 1,
                                Child = new Child()
                                {
                                    Id = 1,
                                    RegisteredInCity = true,
                                    Attendance       = new List <Attendance>()
                                    {
                                        new Attendance()
                                        {
                                            ChildId      = 1,
                                            NoReasons    = 0,
                                            Sick         = 2,
                                            OtherReasons = 0,
                                        }
                                    }
                                }
                            }
                        }
                    },
                    new Group()
                    {
                        Id                 = 2,
                        Name               = "group2",
                        KindergardenId     = 1,
                        GroupChildRelation = new List <GroupChild>()
                        {
                            new GroupChild()
                            {
                                ChildId = 2,
                                GroupId = 2,
                                Current = true,
                                //Id = 1,
                                Child = new Child()
                                {
                                    Id = 2,
                                    RegisteredInCity = true,
                                    Attendance       = new List <Attendance>()
                                    {
                                        new Attendance()
                                        {
                                            ChildId      = 2,
                                            NoReasons    = 0,
                                            Sick         = 0,
                                            OtherReasons = 0,
                                        }
                                    }
                                }
                            },
                            new GroupChild()
                            {
                                ChildId = 3,
                                GroupId = 2,
                                Current = true,
                                //Id = 1,
                                Child = new Child()
                                {
                                    Id = 3,
                                    RegisteredInCity = true,
                                    Attendance       = new List <Attendance>()
                                    {
                                        new Attendance()
                                        {
                                            ChildId      = 3,
                                            NoReasons    = 1,
                                            Sick         = 1,
                                            OtherReasons = 0,
                                        }
                                    }
                                }
                            },
                        }
                    },
                }
            });
            context.Kindergarden.Add(new Kindergarden()
            {
                Id     = 2,
                Name   = "kindergarden2",
                Groups = new List <Group>()
                {
                    new Group()
                    {
                        Id                 = 3,
                        Name               = "group3",
                        KindergardenId     = 2,
                        GroupChildRelation = new List <GroupChild>()
                        {
                            new GroupChild()
                            {
                                ChildId = 4,
                                GroupId = 3,
                                Current = true,
                                //Id = 1,
                                Child = new Child()
                                {
                                    Id = 4,
                                    RegisteredInCity = true,
                                    Attendance       = new List <Attendance>()
                                    {
                                        new Attendance()
                                        {
                                            ChildId      = 4,
                                            NoReasons    = 0,
                                            Sick         = 5,
                                            OtherReasons = 0,
                                        }
                                    }
                                }
                            }
                        }
                    },
                    new Group()
                    {
                        Id                 = 4,
                        Name               = "group1",
                        KindergardenId     = 2,
                        GroupChildRelation = new List <GroupChild>()
                        {
                            new GroupChild()
                            {
                                ChildId = 5,
                                GroupId = 4,
                                Current = true,
                                //Id = 1,
                                Child = new Child()
                                {
                                    Id = 5,
                                    RegisteredInCity = true,
                                    Attendance       = new List <Attendance>()
                                    {
                                        new Attendance()
                                        {
                                            ChildId      = 5,
                                            NoReasons    = 0,
                                            Sick         = 10,
                                            OtherReasons = 0,
                                        }
                                    }
                                }
                            }
                        }
                    },
                }
            });

            context.SaveChanges();

            kindergardenManager = new KindergardenManager(context);
        }
 public void Cleanup()
 {
     context.Database.EnsureDeleted();
     kindergardenManager = null;
     context             = null;
 }
 public FileManager(KindergardenContext context)
 {
     this.context = context;
 }
Exemplo n.º 6
0
 public StreamManager(KindergardenContext context)
 {
     this.context = context;
 }