示例#1
0
        internal static IPR.Balance Create(Entities edc, IPR _iprAccount, BalanceBatch parent, JSOXLib masterReport, List <BalanceIPR> iprCollection, NamedTraceLogger.TraceAction trace)
        {
            trace("Entering BalanceIPR.Create", 30, TraceSeverity.Verbose);
            BalanceIPR _newItem = new BalanceIPR()
            {
                Archival             = false,
                Balance              = -1,
                BalanceBatchIndex    = parent,
                BalanceIPR2JSOXIndex = masterReport,
                Batch            = _iprAccount.Batch,
                CustomsProcedure = _iprAccount.ClearenceIndex.ClearenceProcedure.ToString(),
                DocumentNo       = _iprAccount.DocumentNo,
                InvoiceNo        = _iprAccount.InvoiceNo,
                IPRIndex         = _iprAccount,
                OGLIntroduction  = _iprAccount.DocumentNo,
                SKU   = _iprAccount.SKU,
                Title = "Creating",
            };

            edc.BalanceIPR.InsertOnSubmit(_newItem);
            iprCollection.Add(_newItem);
            return(_newItem.Update(edc, trace));
        }
示例#2
0
        internal static BalanceBatchWrapper Create(Entities edc, IGrouping <string, IPR> iprGroups, JSOXLib parent, StockDictionary.BalanceStock balanceStock, NamedTraceLogger.TraceAction trace)
        {
            trace("Entering BalanceBatch.Create", 34, TraceSeverity.Verbose);
            BalanceBatchWrapper _ret;

            try
            {
                IPR          _firsTIPR = iprGroups.FirstOrDefault <IPR>();
                BalanceBatch _newBB    = new BalanceBatch()
                {
                    Archival = false,
                    Balance2JSOXLibraryIndex = parent,
                    Batch = iprGroups.Key,
                    Title = "creating",
                    SKU   = _firsTIPR == null ? "NA" : _firsTIPR.SKU,
                };
                edc.BalanceBatch.InsertOnSubmit(_newBB);
                List <BalanceIPR> _is = new List <BalanceIPR>();
                _newBB.Update(edc, iprGroups, balanceStock, _is, trace);
                _ret = new BalanceBatchWrapper()
                {
                    iprCollection = _is.ToArray <BalanceIPR>(), batch = _newBB
                };
            }
            catch (CAS.SharePoint.ApplicationError)
            {
                throw;
            }
            catch (Exception ex)
            {
                trace("ApplicationError at BalanceBatch.Create", 58, TraceSeverity.High);
                throw new SharePoint.ApplicationError("BalanceBatch.Create", "Body", ex.Message, ex);
            }
            trace("Finished BalanceBatch.Create", 61, TraceSeverity.Verbose);
            return(_ret);
        }