Ejemplo n.º 1
0
        public void EditSetup()
        {
            SupplierManager mySupMan = new SupplierManager();

            mySupMan.AddANewSupplier(testSupp, "Test");
            modSupp = getSupplierListCompName(suppList);
            itemListingToEdit.SupplierID = modSupp.SupplierID;
            ItemListingAccessor.AddItemListing(itemListingToTest);
            itemListingToTest            = getItemListingTestObject(itemList);
            itemListingToEdit.SupplierID = modSupp.SupplierID;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Matt Lapka
 /// Created: 2015/02/14
 /// Send a new ItemListing object to the Data Access Layer to be added to the database
 /// </summary>
 /// <param name="newItemListing">ItemListing object that contains the information to be added</param>
 /// <returns>An int reflecting the number of rows affected -- 1 if successful, 0 if not</returns>
 public listResult AddItemListing(ItemListing newItemListing)
 {
     try
     {
         if (ItemListingAccessor.AddItemListing(newItemListing) == 1)
         {
             DataCache._currentItemListingList    = ItemListingAccessor.GetItemListingList();
             DataCache._ItemListingListTime       = DateTime.Now;
             DataCache._currentAllItemListingList = ItemListingAccessor.GetAllItemListingList();
             DataCache._AllItemListingListTime    = DateTime.Now;
             return(listResult.Success);
         }
         return(listResult.NotAdded);
     }
     catch (Exception)
     {
         return(listResult.DatabaseError);
     }
 }
Ejemplo n.º 3
0
        public void AddItemListing_ValidItemListing()
        {
            int expected = 1;

            setup();

            SupplierAccessor.AddSupplier(testSupp, "Test", "Password#1");
            modSupp = getSupplierListCompName(suppList);
            itemListingToTest.SupplierID = modSupp.SupplierID;

            int actual = ItemListingAccessor.AddItemListing(itemListingToTest);

            ItemListingAccessor.DeleteItemListingTestItem(itemListingToTest);
            testSupp.SupplierID = modSupp.SupplierID;
            testLog             = sLA.RetrieveSupplierLogin("Password#1", "Test");
            SupplierLoginAccessor.DeleteTestSupplierLogin(testLog);
            TestCleanupAccessor.DeleteTestSupplier(testSupp);

            Assert.AreEqual(expected, actual);
        }