Beispiel #1
0
        public void TestJobDetail()
        {
            using (var db = new PurchaseSQLDBContext(Utilites.TestDbContextOptions()))
            {
                var n = db.Job.Where(c => c.job_id == 1265).Select(p => new JobDetailsDto
                {
                    JobID          = p.job_id,
                    JobName        = p.jobname,
                    JobCostName    = p.jobdesc,
                    JobOrdersTotal = p.PurchaseOrders.Count > 0 ? p.PurchaseOrders.Sum(w => w.OrderTotal).Value : 0.0m,
                    JobOrders      = db.PurchaseOrder.Where(d => d.Job_id == 1265).Select(s => new OrderDto
                    {
                        PurchaseOrderID = s.OrderNum,
                        OrderDate       = s.OrderDate.ToShortDateString(),
                        Purchaser       = s.Employee.lastname,
                        Supplier        = s.Supplier.SupplierName,
                        OrderTotal      = s.OrderTotal.Value.ToString(),
                        Received        = s.Recieved.Value
                    }).ToList()
                }).SingleOrDefault();

                Assert.True(n.JobID == 1265);
                ;
            }
        }
Beispiel #2
0
 public void TestTransactionTypesFind()
 {
     using (var db = new PurchaseSQLDBContext(Utilites.TestDbContextOptions()))
     {
         var result = db.TransActionType.Find(1);
         Assert.True(result.TransactionsTypeID == 1);
     }
 }
Beispiel #3
0
 public void TestTransactionTypes()
 {
     using (var db = new PurchaseSQLDBContext(Utilites.TestDbContextOptions()))
     {
         var result = db.TransActionType.ToList();
         Assert.True(result.Count > 0);
     }
 }
Beispiel #4
0
        public List <PurchaseOrder> GetAll()
        {
            List <PurchaseOrder> result = new List <PurchaseOrder>();

            using (var context = new PurchaseSQLDBContext())
            {
                result = context.PurchaseOrder.AsNoTracking().ToList();
            }
            return(result);
        }
        public void TestMethod1()
        {
            List <PurchaseOrder> result = new List <PurchaseOrder>();

            using (var context = new PurchaseSQLDBContext())
            {
                PurchaseOrderService service = new PurchaseOrderService();
                result = service.GetAll();
            }


            Assert.IsTrue(result.Count > 200);
        }
Beispiel #6
0
        public async Task TestInventoryGetTransActions()
        {
            var result = new List <InventoryDto>();


            using (var db = new PurchaseSQLDBContext(Utilites.TestDbContextOptions()))
            {
                var _service = new InventoryService(db);
                result = await _service.GetTransActions(3613);
            }


            Assert.True(result.Count() == 6);
        }
Beispiel #7
0
        public async Task TestInventoryGetStockLevel()
        {
            decimal result;


            using (var db = new PurchaseSQLDBContext(Utilites.TestDbContextOptions()))
            {
                var _service = new InventoryService(db);
                result = await _service.GetStockLevel(3354);
            }


            Assert.True(result == 0.0m);
        }
        public void ViewModelTest()
        {
            List <PurchaseOrder> result = new List <PurchaseOrder>();

            using (var context = new PurchaseSQLDBContext())
            {
                PurchaseOrderService service = new PurchaseOrderService();

                MainViewModel view = new MainViewModel(service);

                view.Load();
            }


            Assert.IsTrue(result.Count > 200);
        }
Beispiel #9
0
        public async Task TestInventoryPushPart()
        {
            decimal result;
            decimal after;

            using (var db = new PurchaseSQLDBContext(Utilites.TestDbContextOptions()))
            {
                var _service = new InventoryService(db);
                result = await _service.GetStockLevel(3354);

                _service.PushPart(3354, 10.0m);
                after = await _service.GetStockLevel(3354);
            }



            Assert.True(after == result + 10.0m);
        }
Beispiel #10
0
        public void TestProjectsMappingEmployees()
        {
            using (var db = new PurchaseSQLDBContext(Utilites.TestDbContextOptions()))
            {
                //var part = db.Part.Include(d => d.PartsLink).Where(c => c.PartID == 5717).SingleOrDefault();
                var r = db.Part.Include(d => d.PartsLink).Where(c => c.PartID == 5720).Select(p => new PartEditDto
                {
                    PartID              = p.PartID,
                    Description         = p.ItemDescription,
                    SupplierDescription = p.SupplierDescription,
                    ItemName            = p.ItemName,
                    PartNumber          = p.PartNum,
                    SupplierID          = p.SupplierID.Value,
                    Location            = p.Location,
                    SupplierName        = p.Supplier.SupplierName,
                    Manufacturer        = db.Manu.Where(f => f.ManuID == p.ManuID).Select(d => d.Manufacturer).FirstOrDefault().ToString(),
                    DateAdded           = p.DateAdded.HasValue ? p.DateAdded.Value : DateTime.Today,
                    LastModified        = p.ModifiedDate.HasValue ? p.ModifiedDate.Value : DateTime.Today,
                    ManuID              = p.ManuID.HasValue ? p.ManuID.Value : 0,
                    ManuPartNum         = p.ManuPartNum,
                    //PartTypeID = p.PartTypeID.HasValue ? p.PartTypeID.Value : 0,
                    ModifiedBy      = p.ModifiedBy,
                    Cost            = p.Cost.Value,
                    UID             = p.UID.HasValue ? p.UID.Value : 0,
                    UnitOfMeasure   = db.UnitOfMeasure.Where(o => o.UID == p.UID).Select(e => e.UOM).SingleOrDefault().ToString(),
                    Weight          = p.Weight.Value,
                    Waste           = p.Waste.Value,
                    MarkUp          = p.MarkUp.Value,
                    SKU             = p.SKU,
                    UseSupplierName = p.UseSupplierNameFlag,
                    Documents       = p.PartsLink.Select(f => new PartDocumentsDto
                    {
                        DocID        = f.Documents.DocID,
                        Description  = f.Documents.Description,
                        DocumentView = f.Documents.DocumentView,
                        Path         = f.Documents.DocumentPath
                    }).ToList()
                }).SingleOrDefault();

                var text = r;
                Assert.True(r.PartID == 5720);
            }
        }
Beispiel #11
0
 public SupplierListModel(PurchaseSQLDBContext context)
 {
     _context = context;
 }
Beispiel #12
0
 public indexModel(PurchaseSQLDBContext context)
 {
     _context = context;
 }
Beispiel #13
0
 public editModel(PurchaseSQLDBContext context)
 {
     _context = context;
 }
Beispiel #14
0
 public OrderDetailModel(PurchaseSQLDBContext context)
 {
     _context = context;
 }
 public JobService(PurchaseSQLDBContext context)
 {
     _db = context;
 }
Beispiel #16
0
 public JobOrdersModel(PurchaseSQLDBContext context)
 {
     _context = context;
 }
Beispiel #17
0
 public JobDetailModel(PurchaseSQLDBContext context, QQestContext timeContext)
 {
     _context     = context;
     _timeContext = timeContext;
 }
 public InventoryListModel(PurchaseSQLDBContext context)
 {
     _context = context;
 }
Beispiel #19
0
 public EmployeeListModel(PurchaseSQLDBContext context)
 {
     _context = context;
 }
 public InventoryService(PurchaseSQLDBContext db)
 {
     _db = db;
 }
 public SuppliersList(PurchaseSQLDBContext context)
 {
     _db = context;
 }
Beispiel #22
0
 public SupplierOrdersModel(PurchaseSQLDBContext context)
 {
     _context = context;
 }