Exemplo n.º 1
0
        /// <summary>
        /// Example showing how to save multiple items of the same model at a time.
        /// </summary>
        /// <param name="serviceOrderItemsModel1">This contains a standard ServiceOrderItemsModel object.  A partial model mith missing properties is allowed.</param>
        /// <param name="bulkOperation1">Contains "create" or "update"</param>
        /// <param name="serviceOrderItemsModel2">This contains a standard ServiceOrderItemsModel object.  A partial model mith missing properties is allowed.</param>
        /// <param name="bulkOperation2">Contains "create" or "update"</param>
        /// <param name="continueOnError">The bulk process is transactional and will save nothing if an item errors.  If you are submitting a list of unrelated items to save, set this as false and the bulk save process will attempt to continue saving if an item fails to save.  Note that certain errors will always result in the bulk operation halting.</param>
        /// <returns></returns>
        public BulkResponseModel Bulk(ServiceOrderItemsModel serviceOrderItemsModel1, string bulkOperation1, ServiceOrderItemsModel serviceOrderItemsModel2, string bulkOperation2, bool continueOnError)
        {
            /* If one item fails, you have the option to continue without it (see BulkRequestModel.ContinueOnError).  Use this for large updates of unrelated items.
             *  -You can track items via the BulkItemIndex tracker.*/

            var myBulkRequest = new BulkRequestModel
            {
                ContinueOnError = continueOnError
            };

            var mybulkRequestItem = new BulkRequestItem()
            {
                UngerboeckModel = serviceOrderItemsModel1, //This is a standard Ungerboeck Model found in our SDK
                Action          = bulkOperation1,          //contains "create" or "update".  Every item action can be independent.
                BulkItemIndex   = 1                        //Use this index to track items in the response.  Whether an item succeeds or fails, it will preserve the index you assign it.
            };

            myBulkRequest.BulkRequestItems.Add(mybulkRequestItem);

            mybulkRequestItem = new BulkRequestItem()
            {
                UngerboeckModel = serviceOrderItemsModel2,
                Action          = bulkOperation2,
                BulkItemIndex   = 2
            };

            myBulkRequest.BulkRequestItems.Add(mybulkRequestItem);

            return(APIUtil.DoBulk <ServiceOrderItemsModel>(USISDKClient, myBulkRequest));
        }
Exemplo n.º 2
0
        /// <summary>
        /// A basic add example
        /// </summary>
        /// <param name="orgCode">Organization Code</param>
        /// <param name="orderNumber">The order number of the item's parent order</param>
        /// <param name="units">The amount of items you want on the order</param>
        /// <param name="priceListDetailSeqNbr">This should be filled in as the Price List Sequence number (CC716_SEQ) of the item you wish to add.  It should belong to the Order's price list items (Check CC716_PRICE_LIST_DTL).  You can see this value by going to v20->main menu->price lists-> edit price list-> price list item grid -> show column "Sequence"</param>
        public ServiceOrderItemsModel Add(string orgCode, int orderNumber, int units, int priceListDetailSeqNbr)
        {
            var myServiceOrderItem = new ServiceOrderItemsModel
            {
                OrganizationCode      = orgCode,
                OrderNumber           = orderNumber,
                Units                 = units,
                StartDate             = System.DateTime.Now,
                EndDate               = System.DateTime.Now,
                StartTime             = System.DateTime.Now,
                EndTime               = System.DateTime.Now,
                PriceListDetailSeqNbr = priceListDetailSeqNbr,
            };

            return(APIUtil.AddServiceOrderItem(USISDKClient, myServiceOrderItem));
        }