Exemplo n.º 1
0
        public void RemoveSupplierTest()
        {
            Factory factory      = Factory.GetInstance();
            string  supplierCode = "RIBI-100"; // TODO: Initialize to an appropriate value

            try
            {
                ISupplierSvc supplierSvc = (ISupplierSvc)factory.GetService(typeof(ISupplierSvc).Name);
                supplierSvc.RemoveSupplier(supplierCode);//adds product
            }
            catch (Exception e)
            {
                Assert.Fail(e.ToString());//force fail of test
            }
        }
 //removes a supplier
 public void RemoveSupplier(string supplierCode)
 {
     try
     {
         ISupplierSvc supplierSvc = (ISupplierSvc)GetService(typeof(ISupplierSvc).Name);
         supplierSvc.RemoveSupplier(supplierCode);
     }
     catch (ServiceLoadException e)
     {
         throw new SupplierMgrException(e.Message);
     }
     catch (DBProcessingException e)
     {
         throw new SupplierMgrException(e.Message);
     }
 }
 //updates a supplier
 public void UpdateSupplier(Supplier supplier)
 {
     try
     {
         ISupplierSvc supplierSvc = (ISupplierSvc)GetService(typeof(ISupplierSvc).Name);
         supplierSvc.UpdateSupplier(supplier);
     }
     catch (ServiceLoadException e)
     {
         throw new SupplierMgrException(e.Message);
     }
     catch (DBProcessingException e)
     {
         throw new SupplierMgrException(e.Message);
     }
 }
Exemplo n.º 4
0
        public void AddSupplierTest()
        {
            Factory  factory  = Factory.GetInstance();
            Supplier supplier = new Supplier(); // TODO: Initialize to an appropriate value

            supplier.SupplierCode  = "RIBI-100";
            supplier.SupplierName  = "Richels's Juices";
            supplier.StreetAddress = "22 Hope Road Kingston";
            supplier.ParishID      = 1;

            try
            {
                ISupplierSvc supplierSvc = (ISupplierSvc)factory.GetService(typeof(ISupplierSvc).Name);
                supplierSvc.AddSupplier(supplier);//adds product
            }
            catch (Exception e)
            {
                Assert.Fail(e.ToString());//force fail of test
            }
        }
        //searches for a supplier via supplier code
        public Supplier SearchSupplier(string supplierCode)
        {
            Supplier supplier = new Supplier();

            try
            {
                ISupplierSvc supplierSvc = (ISupplierSvc)GetService(typeof(ISupplierSvc).Name);
                supplier = supplierSvc.SearchSupplier(supplierCode);
            }
            catch (ServiceLoadException e)
            {
                throw new SupplierMgrException(e.Message);
            }
            catch (DBProcessingException e)
            {
                throw new SupplierMgrException(e.Message);
            }


            return(supplier);
        }