Exemple #1
0
        public static async Task Setup()
        {
            fileLocation = @"C:\TimeKeeper\TimeTest.xlsx";
            Context      = new TimeContext("PGS", "User ID=postgres; Password=osmanaga; Server=localhost; Port=5432; Database=testera; Integrated Security=true; Pooling=true;");
            Context.Database.EnsureDeleted();
            Context.Database.EnsureCreated();
            FileInfo file = new FileInfo(fileLocation);

            using (ExcelPackage package = new ExcelPackage(file))
            {
                var sheets = package.Workbook.Worksheets;
                await Teams.Collect(sheets["Teams"], Context);

                await Roles.Collect(sheets["Roles"], Context);

                await Customers.Collect(sheets["Customers"], Context);

                await Projects.Collect(sheets["Projects"], Context);

                await People.Collect(sheets["Employees"], Context);

                await Members.Collect(sheets["Engagement"], Context);
            }

            roles = new Repository <Role>(Context);
            teams = new Repository <Team>(Context);

            Assert.Pass();
        }
Exemple #2
0
        public static void Seed(this UnitOfWork unit, FileInfo file)
        {
            using (ExcelPackage package = new ExcelPackage(file))
            {
                unit.Context.Database.EnsureDeleted();
                unit.Context.Database.EnsureCreated();

                var sheets = package.Workbook.Worksheets;
                Teams.Collect(sheets["Teams"], unit);
                Roles.Collect(sheets["Roles"], unit);
                Customers.Collect(sheets["Customers"], unit);
                Projects.Collect(sheets["Projects"], unit);
                Employees.Collect(sheets["Employees"], unit);
                Members.Collect(sheets["Engagement"], unit);
                Calendar.Collect(sheets["Calendar"], unit);
                Assignments.Collect(sheets["Details"], unit);
            }
        }