/// <summary> /// Method to delete a list of mapped products. /// </summary> /// <param name="mappedProductIDs">List of mapped product ids.</param> /// <param name="loginObject">Object containing the login credentials.</param> public static void DeleteMappedProducts(int[] mappedProductIDs, ref Login loginObject) { // // throw an exception if the mappedProductIDs is null // if (mappedProductIDs == null) { ArgumentNullException argumentNullException = new ArgumentNullException("mappedProductIDs", "The parameter cannot be null."); throw new FeedException("mappedProductIDs parameter cannot be null.", argumentNullException); } // // check to verify the mapped product ids contain alteast one element. // if (mappedProductIDs.Length < 1) { ArgumentOutOfRangeException argumentOutOfRangeException = new ArgumentOutOfRangeException("mappedProductIDs", "The parameter should have atleast one element."); throw new FeedException("mappedProductIDs int array should have atleast one element.", argumentOutOfRangeException); } // // create a name value collection object to hold the mapped product ids // NameValueCollection mappedProductIDCollection = new NameValueCollection(mappedProductIDs.Length); foreach (int mappedProductID in mappedProductIDs) { mappedProductIDCollection.Add("mappedproductid", mappedProductID.ToString()); } // // call the base ProcessRequest method to send the request and process the response // MappedObjectBase.ProcessRequest("deletemappedproducts.aspx", mappedProductIDCollection, ref loginObject); }
/// <summary> /// Method to delete the file from a list of mapped products. /// </summary> /// <param name="mappedProductIDs">List of mapped product ids.</param> /// <param name="loginObject">Object containing the login credentials.</param> public void DeleteFromMappedProducts(int[] mappedProductIDs, ref Login loginObject) { // // throw an exception if the mappedProductIDs is null // if (mappedProductIDs == null) { ArgumentNullException argumentNullException = new ArgumentNullException("mappedProductIDs", "The parameter cannot be null."); throw new FeedException("mappedProductIDs parameter cannot be null.", argumentNullException); } // // throw an exception if the mappedProductIDs array does not have a single element // if (mappedProductIDs.Length < 1) { ArgumentOutOfRangeException argumentOutOfRangeException = new ArgumentOutOfRangeException("mappedProductIDs", "The parameter should have atleast one element."); throw new FeedException("mappedProductIDs int array should have atleast one element.", argumentOutOfRangeException); } // // create a name value collection object to hold the mapped file id and product ids // NameValueCollection deleteFileFromProductsCollection = new NameValueCollection(mappedProductIDs.Length + 1); // // add the mapped file id to the collection // deleteFileFromProductsCollection.Add("mappedfileid", this.ID.ToString()); // // add the list of mapped product ids to the collection // foreach (int mappedProductID in mappedProductIDs) { deleteFileFromProductsCollection.Add("mappedproductid", mappedProductID.ToString()); } // // call the base ProcessRequest method to send the request and process the response // MappedObjectBase.ProcessRequest("deletemappedfilefromproducts.aspx", deleteFileFromProductsCollection, ref loginObject); }