Ejemplo n.º 1
0
        public Error SendPurchaseOrderToSupplier(PurchaseOrderHeaderTempModel poht, UserModel sender, CompanyModel company)
        {
            // Create PO PDF and CSV, then send to Warehouse
            string pdfFile = "";
            var    error   = CreatePurchaseOrderPdf(poht, company.POSupplierTemplateId, null, ref pdfFile);

            if (!error.IsError)
            {
                FilePackagerService.FilePackagerService fpService = new FilePackagerService.FilePackagerService(db);
                error = fpService.SendPurchaseOrderToSupplier(poht.Id, sender, pdfFile);
            }
            if (error.IsError)
            {
                MediaService.MediaService.DeleteFile(pdfFile);
            }
            return(error);
        }
        public void SendPurchaseOrderToFreightForwarderTest()
        {
            // Get a test user and test company
            var testUser    = GetTestUser();
            var testCompany = GetTestCompany(testUser, true);

            CreateTestTransfers(testCompany, testUser);

            // Create a purchase order with items
            var poh = GetTestPurchaseOrderHeader(testCompany, testUser, 10);

            // Copy the purchase order to the temp tables
            var poht = PurchasingService.CopyPurchaseOrderToTemp(testCompany, poh, testUser);

            // Send the purchase order
            FilePackagerService.FilePackagerService fpService = new FilePackagerService.FilePackagerService(db);
            var error = fpService.SendPurchaseOrderToFreightForwarder(poht.Id);

            Assert.IsTrue(!error.IsError, error.Message);
        }
        public void SendPurchaseOrderToWarehouseTest()
        {
            // This test places a file in an FTP 'send' folder but does not actually send the file.
            // It also queues an EMail, so make sure TaskProcessor email sending is switched off!

            // Get a test user and test company
            var testUser    = GetTestUser();
            var testCompany = GetTestCompany(testUser, true);

            CreateTestTransfers(testCompany, testUser);

            // Create a purchase order with items
            var poh = GetTestPurchaseOrderHeader(testCompany, testUser, 10);

            // Copy the purchase order to the temp tables
            var poht = PurchasingService.CopyPurchaseOrderToTemp(testCompany, poh, testUser);

            // Send the purchase order
            FilePackagerService.FilePackagerService fpService = new FilePackagerService.FilePackagerService(db);
            var error = fpService.SendPurchaseOrderToWarehouse(poht.Id);

            Assert.IsTrue(!error.IsError, error.Message);
        }
        public void SendPurchaseOrderToSupplierTest()
        {
            // Get a test user and test company
            var testUser    = GetTestUser();
            var testCompany = GetTestCompany(testUser, true);
            var poh         = GetTestPurchaseOrderHeader(testCompany, testUser, 58);

            // Copy the purchase order to the temp tables
            var poht = PurchasingService.CopyPurchaseOrderToTemp(testCompany, poh, testUser);

            // Create the PDF
            string pdfFile = "";
            var    error   = PurchasingService.CreatePurchaseOrderPdf(poh,
                                                                      testCompany.POSupplierTemplateId, //DocumentTemplateType.PurchaseOrder,
                                                                      null,
                                                                      ref pdfFile);

            Assert.IsTrue(!error.IsError, error.Message);

            // Send the purchase order
            FilePackagerService.FilePackagerService fpService = new FilePackagerService.FilePackagerService(db);
            error = fpService.SendPurchaseOrderToSupplier(poht.Id, testUser, pdfFile);
            Assert.IsTrue(!error.IsError, error.Message);
        }
Ejemplo n.º 5
0
 public Error SendPurchaseOrderToFreightForwarder(int purchaseOrderHeaderTempId)
 {
     // Create PO CSV, then send to Warehouse
     FilePackagerService.FilePackagerService fpService = new FilePackagerService.FilePackagerService(db);
     return(fpService.SendPurchaseOrderToFreightForwarder(purchaseOrderHeaderTempId));
 }