Пример #1
0
        public BagResult CreateBag(FrayteeCommerceBag bag)
        {
            BagResult result = new BagResult();

            result = new eCommerceAppRepository().CreateBag(bag);
            if (bag.BagClosed)
            {
                result.ManifestNumber = "";
            }
            return(result);
        }
Пример #2
0
        public BagResult CreateBag(FrayteeCommerceBag bag)
        {
            // If bagmanifest is not available and BagClosed is false the create a new bag manifest and create a new  bag for shipments
            // If bagmanifest is available and BagClosed is false the create new bag
            // If bagmanifest is available and BagClosed is true the create new bag

            BagResult result = new BagResult();

            try
            {
                result.Messages = new List <ErrorMessage>();

                string bagManifestName = string.Empty;

                if (string.IsNullOrEmpty(bag.BagManifest) || bag.BagClosed)
                {
                    // create a new bag manifest
                    bagManifestName = createBagManifest(bag);
                    // create bag
                }
                else
                {
                    bagManifestName = bag.BagManifest;
                }
                int id = createBag(bagManifestName);
                // add shipments in the bag
                addShipmentsInBag(bag, id);
                result.Status         = true;
                result.ManifestNumber = bagManifestName;
            }
            catch (Exception ex)
            {
                result.Status = false;
            }
            return(result);
        }