예제 #1
0
 public UnitOfWork(ApplicationDbContext context)
 {
     _context             = context;
     StockItems           = new StockRepository(_context);
     Invoices             = new InvoiceRepository(_context);
     JobCards             = new JobCardRepository(_context);
     JobStatuses          = new JobStatusRepository(_context);
     Suppliers            = new SupplierRepository(_context);
     JobTypes             = new JobTypeRepository(_context);
     Customers            = new CustomerRepository(_context);
     ServiceContracts     = new ServiceContractRepository(_context);
     MaintenanceContracts = new MaintenanceContractRepository(_context);
     Areas                     = new AreaRepository(_context);
     PurchaseOrders            = new PurchaseOrderRepository(_context);
     PurchaseOrderItems        = new PurchaseOrderItemRepository(_context);
     ApplicationUserSignatures = new ApplicationUserSignatureRepository(_context);
     CustomerSignatures        = new CustomerSignatureRepository(_context);
     JobStatusHistory          = new JobStatusHistoryRepository(_context);
     Quotes                    = new QuotationRepository(_context);
     StockItemQuantities       = new StockItemQuantityRepository(_context);
 }
예제 #2
0
        public void SetUp()
        {
            this.transactionScope          = new TransactionScope();
            this.applicationUserRepository = new ApplicationUserRepository(ConfigurationManager.ConnectionStrings["BBOS"].ConnectionString);
            this.jobStatusRepository       = new JobStatusRepository(ConfigurationManager.ConnectionStrings["BBOS"].ConnectionString);
            this.jobRepository             = new JobRepository(ConfigurationManager.ConnectionStrings["BBOS"].ConnectionString);
            this.jobStatusTypeRepository   = new JobStatusTypeRepository(ConfigurationManager.ConnectionStrings["BBOS"].ConnectionString);

            this.user = BuildMeA.ApplicationUser("UserName");
            this.applicationUserRepository.Create(user);
            this.job            = BuildMeA.Job(DateTime.Now, DateTime.Now, DateTime.Now, String.Empty, "dfsdfjdf");
            this.job.ManCoDocID = 10;
            this.job.UserID     = this.user.Id;
            this.jobRepository.Create(this.job);

            this.jobStatusType = BuildMeA.JobStatusType("descrip");
            this.jobStatusTypeRepository.Create(this.jobStatusType);

            this.jobStatus       = BuildMeA.JobStatus(DateTime.Now).WithJobStatusType(this.jobStatusType);
            this.jobStatus.JobID = this.job.JobID;
        }