Esempio n. 1
0
        /// <summary>
        /// Disposes goods for selected batch.
        /// </summary>
        /// <param name="entities">The entities representing SharePoint lists.</param>
        /// <param name="batch">The batch.</param>
        /// <param name="parentRequestLib">The parent request library.</param>
        /// <param name="xmlData">The XML data to be disposed.</param>
        /// <exception cref="CAS.SharePoint.ApplicationError">CustomsWarehouse.Dispose;ending;null</exception>
        public static void Dispose(Entities entities, string batch, DisposalRequestLib parentRequestLib, CustomsWarehouseDisposal.XmlData xmlData)
        {
            List <CustomsWarehouse> _available = GetOrderedQueryable4Batch(entities, batch);
            CustomsWarehouse        _noValue   = _available.FirstOrDefault <CustomsWarehouse>(x => !x.Value.HasValue);

            if (_noValue != null)
            {
                string _msg = String.Format("No Value assigned to the account {0} dept day: {1}", _noValue.DocumentNo, _noValue.CustomsDebtDate);
                throw new CAS.SharePoint.ApplicationError("CustomsWarehouse.Dispose", "No Value", _msg, null);
            }
            if (_available.Count == 0)
            {
                string _batchMsg = String.Format("I cannot find any account for the batch: {0}", batch);
                throw new CAS.SharePoint.ApplicationError("CustomsWarehouse.Dispose", "GetOrderedQueryable4Batch", _batchMsg, null);
            }
            foreach (CustomsWarehouse _cwx in _available)
            {
                _cwx.Dispose(entities, parentRequestLib, ref xmlData);
                if (xmlData.DeclaredQuantity + xmlData.AdditionalQuantity <= 0)
                {
                    return;
                }
            }
            string _msg2 = String.Format("there is not enough tobacco {0} to dispose the batch: {1}", xmlData.DeclaredQuantity + xmlData.AdditionalQuantity, batch);

            throw new CAS.SharePoint.ApplicationError("CustomsWarehouse.Dispose", "ending", _msg2, null);
        }
Esempio n. 2
0
        /// <summary>
        /// Goods the name.
        /// </summary>
        /// <param name="entities">The entities.</param>
        /// <returns></returns>
        public string GoodsName(Entities entities)
        {
            CustomsWarehouse _cw = CWL_CWDisposal2CustomsWarehouseID;

            return(Settings.FormatGoodsName(entities, _cw.TobaccoName, _cw.Grade, _cw.SKU, _cw.Batch, this.ClearingType.Value, _cw.DocumentNo));
        }