Esempio n. 1
0
 private IEnumerable <Workorder> LoadFilledWorkorders()
 {
     using (var context = new ExampleOrderIntegration.WorkorderContext())
     {
         return(context.Workorders
                .Where(w => w.FilledUTC != null)
                .Include(w => w.Parts)
                .AsNoTracking()
                .ToList());
     }
 }
Esempio n. 2
0
        public SqliteWorkorderTest()
        {
            using (var context = new ExampleOrderIntegration.WorkorderContext())
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();
            }

            initialWorkorders = new List <Workorder>();

            using (var context = new ExampleOrderIntegration.WorkorderContext())
            {
                initialWorkorders.Add(new Workorder
                {
                    WorkorderId = "work1",
                    Priority    = 100,
                    DueDate     = DateTime.Today.AddDays(5),
                    Parts       = new List <WorkorderDemand> {
                        new WorkorderDemand {
                            WorkorderId = "work1", Part = "part1", Quantity = 44
                        },
                        new WorkorderDemand {
                            WorkorderId = "work1", Part = "part2", Quantity = 66
                        }
                    }
                });
                initialWorkorders.Add(new Workorder
                {
                    WorkorderId = "work2",
                    Priority    = 200,
                    DueDate     = DateTime.Today.AddDays(15),
                    Parts       = new List <WorkorderDemand> {
                        new WorkorderDemand {
                            WorkorderId = "work2", Part = "part1", Quantity = 55
                        },
                        new WorkorderDemand {
                            WorkorderId = "work2", Part = "part2", Quantity = 77
                        }
                    }
                });
                initialWorkorders.Add(new Workorder
                {
                    WorkorderId = "work3",
                    Priority    = 300,
                    DueDate     = DateTime.Today.AddDays(30),
                    Parts       = new List <WorkorderDemand> {
                        new WorkorderDemand {
                            WorkorderId = "work3", Part = "part1", Quantity = 111
                        },
                        new WorkorderDemand {
                            WorkorderId = "work3", Part = "part3", Quantity = 222
                        }
                    }
                });

                foreach (var w in initialWorkorders)
                {
                    context.Workorders.Add(w);
                }

                context.SaveChanges();
            }
        }