コード例 #1
0
        /// <summary>
        /// Calculates the amount base on given percentage. The ration determines a factor of the total
        /// amount to be paid based on amount given. Ratio is mostly used for pro-rated fees.
        /// </summary>
        public static decimal CalculateAmount(TransactionCode code, decimal percentage,
                                              decimal ratio = 1M)
        {
            var amount = code.GetLatestPriceAmount();

            return(Math.Min(percentage * amount, ratio * amount));
        }
コード例 #2
0
ファイル: Features.cs プロジェクト: Chunjie/win-xenguestagent
        void handleTransaction(TransactionCode tc)
        {
            bool handled = false;

            while (!handled)
            {
                wmisession.StartTransaction();
                try
                {
                    tc();
                    try
                    {
                        wmisession.CommitTransaction();
                        handled = true;
                    }
                    catch
                    {
                        // an exception during the commit means handled doesn't get set
                    }
                }
                catch (Exception e)
                {
                    throw e;
                }
                finally
                {
                    if (!handled)
                    {
                        wmisession.AbortTransaction();
                    }
                }
            }
        }
コード例 #3
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 26, Configuration.FieldSeparator),
                       Id,
                       SetIdFt1.HasValue ? SetIdFt1.Value.ToString(culture) : null,
                       TransactionId,
                       TransactionBatchId,
                       TransactionDate.HasValue ? TransactionDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       TransactionPostingDate.HasValue ? TransactionPostingDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       TransactionType,
                       TransactionCode?.ToDelimitedString(),
                       TransactionDescription,
                       TransactionDescriptionAlt,
                       TransactionQuantity.HasValue ? TransactionQuantity.Value.ToString(Consts.NumericFormat, culture) : null,
                       TransactionAmountExtended?.ToDelimitedString(),
                       TransactionAmountUnit?.ToDelimitedString(),
                       DepartmentCode?.ToDelimitedString(),
                       HealthPlanId?.ToDelimitedString(),
                       InsuranceAmount?.ToDelimitedString(),
                       AssignedPatientLocation?.ToDelimitedString(),
                       FeeSchedule,
                       PatientType,
                       DiagnosisCodeFt1 != null ? string.Join(Configuration.FieldRepeatSeparator, DiagnosisCodeFt1.Select(x => x.ToDelimitedString())) : null,
                       PerformedByCode?.ToDelimitedString(),
                       OrderedByCode?.ToDelimitedString(),
                       UnitCost?.ToDelimitedString(),
                       FillerOrderNumber?.ToDelimitedString(),
                       EnteredByCode?.ToDelimitedString(),
                       ProcedureCode?.ToDelimitedString()
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
コード例 #4
0
        public ActionResult DeleteConfirmed(string id)
        {
            TransactionCode transactionCode = db.transactionCodes.Find(id);

            db.transactionCodes.Remove(transactionCode);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #5
0
        /// <summary>
        /// Выполняет код в транзакции запроса к базам данных.
        /// </summary>
        /// <param name="transactionCode">Код для выполнения в транзакции.</param>
        /// <param name="createNew">При установленном значении true, создаёт новую транзакцию даже при наличии транзакции уже инициализированной в контексте выполнения кода,
        /// в ином случае использует существующую инициализированную транзакцию в контексте выполнения кода.</param>
        public void ExecuteTransaction(TransactionCode transactionCode, bool createNew)
        {
            if (transactionCode == null)
            {
                throw new ArgumentNullException("transactionCode");
            }

            this.ExecuteTransactionInternal(transactionCode, createNew);
        }
コード例 #6
0
ファイル: CertificationFee.cs プロジェクト: israelsam/Qantler
        async Task Stage1CertFee(IList <BillLineItem> container, TransactionCode code,
                                 BillRequestLineItem item)
        {
            var duration = item.SubScheme == SubScheme.ShortTerm
        ? (item.ExpiresOn - item.StartsFrom).Days + 1
        : BillingUtils.CalculateNoOfMonths(item.StartsFrom.Date, item.ExpiresOn.Date);

            var factor = await _context.Stage1Factor();

            // Full payment for stage 1
            if (item.Scheme == Scheme.Endorsement ||
                item.SubScheme == SubScheme.Canteen ||
                item.SubScheme == SubScheme.ShortTerm)
            {
                factor = 1M;
            }
            // Short term billed per 7 days
            else if (item.SubScheme == SubScheme.ShortTerm)
            {
                factor = Math.Ceiling(duration / 7M);
            }
            else
            {
                factor = Math.Min(factor, duration / 12M);
            }

            // For case where the pro-rated value is less than stage 1 expected factor.
            factor = Math.Min(duration / 12, factor);

            var unitPrice = code.GetLatestPriceAmount();
            var gst       = await _context.GST();

            var qty       = factor;
            var fee       = qty * unitPrice;
            var gstAmount = fee * gst;

            var section = BillingUtils.LineItemSection(BillType.Stage1);

            var    yearPrefix  = duration > 12 ? " - Year 1" : "";
            string prorateText = duration < 12 ? $" ({duration} of 12 months)" : "";

            container.Add(new BillLineItem
            {
                SectionIndex = section.Item1,
                Section      = section.Item2,
                Qty          = qty,
                CodeID       = code.ID,
                Code         = code.Code,
                Descr        = $"{code.Text}{yearPrefix}{prorateText}",
                UnitPrice    = code.GetLatestPriceAmount(),
                Amount       = decimal.Round(fee, 2),
                GSTAmount    = decimal.Round(gstAmount, 2),
                GST          = gst,
                WillRecord   = true
            });
        }
コード例 #7
0
        public async Task UnassignCode(Guid id, string codeName)
        {
            var code = new TransactionCode {
                TransactionId = id, CodeName = codeName
            };

            _dataContext.TransactionCodes.Attach(code);
            _dataContext.TransactionCodes.Remove(code);
            await _dataContext.SaveChangesAsync();
        }
コード例 #8
0
 public ActionResult Edit([Bind(Include = "transCode,transTitle")] TransactionCode transactionCode)
 {
     if (ModelState.IsValid)
     {
         db.Entry(transactionCode).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(transactionCode));
 }
コード例 #9
0
        public static decimal GetLatestPriceAmount(this TransactionCode self,
                                                   DateTimeOffset?refDate = null)
        {
            refDate ??= DateTimeOffset.UtcNow;

            return(self.PriceHistory?.Where(e => e.EffectiveFrom <= refDate)
                   .OrderByDescending(e => e.EffectiveFrom)
                   .FirstOrDefault()
                   .Amount ?? 0);
        }
コード例 #10
0
        public ActionResult Create([Bind(Include = "transCode,transTitle")] TransactionCode transactionCode)
        {
            if (ModelState.IsValid)
            {
                db.transactionCodes.Add(transactionCode);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(transactionCode));
        }
コード例 #11
0
        /// <inheritdoc />
        public ILine Parse(string codaLine)
        {
            var transactionCode = new TransactionCode(codaLine.Substring(31, 8));

            return(new InformationPart1Line(
                       new SequenceNumber(codaLine.Substring(2, 4)),
                       new SequenceNumberDetail(codaLine.Substring(6, 4)),
                       new BankReference(codaLine.Substring(10, 21)),
                       transactionCode,
                       new MessageOrStructuredMessage(codaLine.Substring(39, 74), transactionCode)
                       ));
        }
コード例 #12
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 44, Configuration.FieldSeparator),
                       Id,
                       SetIdFt1.HasValue ? SetIdFt1.Value.ToString(culture) : null,
                       TransactionId,
                       TransactionBatchId,
                       TransactionDate?.ToDelimitedString(),
                       TransactionPostingDate.HasValue ? TransactionPostingDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       TransactionType?.ToDelimitedString(),
                       TransactionCode?.ToDelimitedString(),
                       TransactionDescription,
                       TransactionDescriptionAlt,
                       TransactionQuantity.HasValue ? TransactionQuantity.Value.ToString(Consts.NumericFormat, culture) : null,
                       TransactionAmountExtended?.ToDelimitedString(),
                       TransactionAmountUnit?.ToDelimitedString(),
                       DepartmentCode?.ToDelimitedString(),
                       HealthPlanId?.ToDelimitedString(),
                       InsuranceAmount?.ToDelimitedString(),
                       AssignedPatientLocation?.ToDelimitedString(),
                       FeeSchedule?.ToDelimitedString(),
                       PatientType?.ToDelimitedString(),
                       DiagnosisCodeFt1 != null ? string.Join(Configuration.FieldRepeatSeparator, DiagnosisCodeFt1.Select(x => x.ToDelimitedString())) : null,
                       PerformedByCode != null ? string.Join(Configuration.FieldRepeatSeparator, PerformedByCode.Select(x => x.ToDelimitedString())) : null,
                       OrderedByCode != null ? string.Join(Configuration.FieldRepeatSeparator, OrderedByCode.Select(x => x.ToDelimitedString())) : null,
                       UnitCost?.ToDelimitedString(),
                       FillerOrderNumber?.ToDelimitedString(),
                       EnteredByCode != null ? string.Join(Configuration.FieldRepeatSeparator, EnteredByCode.Select(x => x.ToDelimitedString())) : null,
                       ProcedureCode?.ToDelimitedString(),
                       ProcedureCodeModifier != null ? string.Join(Configuration.FieldRepeatSeparator, ProcedureCodeModifier.Select(x => x.ToDelimitedString())) : null,
                       AdvancedBeneficiaryNoticeCode?.ToDelimitedString(),
                       MedicallyNecessaryDuplicateProcedureReason?.ToDelimitedString(),
                       NdcCode?.ToDelimitedString(),
                       PaymentReferenceId?.ToDelimitedString(),
                       TransactionReferenceKey != null ? string.Join(Configuration.FieldRepeatSeparator, TransactionReferenceKey.Select(x => x.ToString(Consts.NumericFormat, culture))) : null,
                       PerformingFacility != null ? string.Join(Configuration.FieldRepeatSeparator, PerformingFacility.Select(x => x.ToDelimitedString())) : null,
                       OrderingFacility?.ToDelimitedString(),
                       ItemNumber?.ToDelimitedString(),
                       ModelNumber,
                       SpecialProcessingCode != null ? string.Join(Configuration.FieldRepeatSeparator, SpecialProcessingCode.Select(x => x.ToDelimitedString())) : null,
                       ClinicCode?.ToDelimitedString(),
                       ReferralNumber?.ToDelimitedString(),
                       AuthorizationNumber?.ToDelimitedString(),
                       ServiceProviderTaxonomyCode?.ToDelimitedString(),
                       RevenueCode?.ToDelimitedString(),
                       PrescriptionNumber,
                       NdcQtyAndUom?.ToDelimitedString()
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
コード例 #13
0
 public PpdEntryDetailRecord(TransactionCode a_TransactionCode, string a_ReceivingDfiRoutingNumber, string a_ReceivingDfiAccountNumber,
                             double a_Amount, int a_AddendaRecordIndicator, int a_TraceNumber, string a_IndividualIdNumber, string a_IndividualName)
 {
     transactionCode           = a_TransactionCode;
     receivingDfiRoutingNumber = a_ReceivingDfiRoutingNumber;
     receivingDfiAccountNumber = a_ReceivingDfiAccountNumber;
     amount = a_Amount;
     addendaRecordIndicator = a_AddendaRecordIndicator;
     traceNumber            = a_TraceNumber;
     _individualIdNumber    = a_IndividualIdNumber;
     _individualName        = a_IndividualName;
 }
コード例 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InformationPart1Line"/> class.
 /// </summary>
 /// <param name="sequenceNumber">The continous sequence number</param>
 /// <param name="sequenceNumberDetail">The detail number.</param>
 /// <param name="bankReference">The reference number added by the bank.</param>
 /// <param name="transactionCode">The transaction code.</param>
 /// <param name="messageOrStructuredMessage">The communication in structured or unstructered format.</param>
 public InformationPart1Line(
     SequenceNumber sequenceNumber,
     SequenceNumberDetail sequenceNumberDetail,
     BankReference bankReference,
     TransactionCode transactionCode,
     MessageOrStructuredMessage messageOrStructuredMessage)
 {
     SequenceNumber             = sequenceNumber;
     SequenceNumberDetail       = sequenceNumberDetail;
     BankReference              = bankReference;
     TransactionCode            = transactionCode;
     MessageOrStructuredMessage = messageOrStructuredMessage;
 }
コード例 #15
0
        // GET: TransactionCodes/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TransactionCode transactionCode = db.transactionCodes.Find(id);

            if (transactionCode == null)
            {
                return(HttpNotFound());
            }
            return(View(transactionCode));
        }
コード例 #16
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 5, Configuration.FieldSeparator),
                       Id,
                       SetIdPce.HasValue ? SetIdPce.Value.ToString(culture) : null,
                       CostCenterAccountNumber?.ToDelimitedString(),
                       TransactionCode?.ToDelimitedString(),
                       TransactionAmountUnit?.ToDelimitedString()
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
コード例 #17
0
ファイル: AchFile.cs プロジェクト: nunyaa/NachaClassLibrary
        internal static bool IsCredit(TransactionCode code)
        {
            switch (code)
            {
            case TransactionCode.CheckingCredit:
            case TransactionCode.CheckingCreditPrenote:
            case TransactionCode.SavingCredit:
            case TransactionCode.SavingCreditPrenote:
                return(true);

            default:
                return(false);
            }
        }
コード例 #18
0
        public async Task <IList <TransactionCode> > IndexData(long id            = 0,
                                                               string code        = null,
                                                               string glentry     = null,
                                                               string description = null)
        {
            var options = new TransactionCode
            {
                ID      = id,
                Code    = code,
                GLEntry = glentry,
                Text    = description
            };

            return(await _transactionCodeService.Search(options));
        }
コード例 #19
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 39, Configuration.FieldSeparator),
                       Id,
                       ItemIdentifier?.ToDelimitedString(),
                       ItemDescription,
                       ItemStatus?.ToDelimitedString(),
                       ItemType?.ToDelimitedString(),
                       ItemCategory?.ToDelimitedString(),
                       SubjectToExpirationIndicator?.ToDelimitedString(),
                       ManufacturerIdentifier?.ToDelimitedString(),
                       ManufacturerName,
                       ManufacturerCatalogNumber,
                       ManufacturerLabelerIdentificationCode?.ToDelimitedString(),
                       PatientChargeableIndicator?.ToDelimitedString(),
                       TransactionCode?.ToDelimitedString(),
                       TransactionAmountUnit?.ToDelimitedString(),
                       StockedItemIndicator?.ToDelimitedString(),
                       SupplyRiskCodes?.ToDelimitedString(),
                       ApprovingRegulatoryAgency != null ? string.Join(Configuration.FieldRepeatSeparator, ApprovingRegulatoryAgency.Select(x => x.ToDelimitedString())) : null,
                       LatexIndicator?.ToDelimitedString(),
                       RulingAct != null ? string.Join(Configuration.FieldRepeatSeparator, RulingAct.Select(x => x.ToDelimitedString())) : null,
                       ItemNaturalAccountCode?.ToDelimitedString(),
                       ApprovedToBuyQuantity.HasValue ? ApprovedToBuyQuantity.Value.ToString(Consts.NumericFormat, culture) : null,
                       ApprovedToBuyPrice?.ToDelimitedString(),
                       TaxableItemIndicator?.ToDelimitedString(),
                       FreightChargeIndicator?.ToDelimitedString(),
                       ItemSetIndicator?.ToDelimitedString(),
                       ItemSetIdentifier?.ToDelimitedString(),
                       TrackDepartmentUsageIndicator?.ToDelimitedString(),
                       ProcedureCode?.ToDelimitedString(),
                       ProcedureCodeModifier != null ? string.Join(Configuration.FieldRepeatSeparator, ProcedureCodeModifier.Select(x => x.ToDelimitedString())) : null,
                       SpecialHandlingCode?.ToDelimitedString(),
                       HazardousIndicator?.ToDelimitedString(),
                       SterileIndicator?.ToDelimitedString(),
                       MaterialDataSafetySheetNumber?.ToDelimitedString(),
                       UnitedNationsStandardProductsAndServicesCode?.ToDelimitedString(),
                       ContractDate?.ToDelimitedString(),
                       ManufacturerContactName?.ToDelimitedString(),
                       ManufacturerContactInformation?.ToDelimitedString(),
                       ClassOfTrade,
                       FieldLevelEventCode
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
コード例 #20
0
        public TransactionCode Map(
            TransactionCode transactionCode,
            Condition condition = null,
            Log log             = null,
            Price price         = null)
        {
            if (!_cache.TryGetValue(transactionCode.ID, out TransactionCode result))
            {
                _cache[transactionCode.ID] = transactionCode;
                result = transactionCode;
            }

            if ((price?.ID ?? 0) > 0 &&
                !_priceCache.ContainsKey(price.ID))
            {
                if (result.PriceHistory == null)
                {
                    result.PriceHistory = new List <Price>();
                }
                result.PriceHistory.Add(price);
                _priceCache[price.ID] = price;
            }

            if ((condition?.ID ?? 0) > 0 &&
                !_conditionCache.ContainsKey(condition.ID))
            {
                if (result.Conditions == null)
                {
                    result.Conditions = new List <Condition>();
                }
                _conditionCache[condition.ID] = condition;
                result.Conditions.Add(condition);
            }

            if ((log?.ID ?? 0) > 0 &&
                !_logCache.ContainsKey(log.ID))
            {
                if (result.Logs == null)
                {
                    result.Logs = new List <Log>();
                }
                _logCache[log.ID] = log;
                result.Logs.Add(log);
            }

            return(result);
        }
コード例 #21
0
        /// <inheritdoc />
        public ILine Parse(string codaLine)
        {
            var transactionCode = new TransactionCode(codaLine.Substring(53, 8));

            return(new TransactionPart1Line(
                       new SequenceNumber(codaLine.Substring(2, 4)),
                       new SequenceNumberDetail(codaLine.Substring(6, 4)),
                       new BankReference(codaLine.Substring(10, 21)),
                       new Amount(codaLine.Substring(31, 1) + codaLine.Substring(32, 15), true),
                       new Date(codaLine.Substring(47, 6)),
                       transactionCode,
                       new MessageOrStructuredMessage(codaLine.Substring(61, 54), transactionCode),
                       new Date(codaLine.Substring(115, 6)),
                       new StatementSequenceNumber(codaLine.Substring(121, 3)),
                       new GlobalizationCode(codaLine.Substring(124, 1))
                       ));
        }
コード例 #22
0
        public MessageOrStructuredMessage(string value, TransactionCode transactionCode)
        {
            Helpers.ValidateStringMultipleLengths(value, new[] { 54, 74 }, "MessageOrStructuredMessage");

            var hasStructuredMessage = value.Substring(0, 1) == "1" ? true : false;

            StructuredMessage = null;
            Message           = null;

            if (hasStructuredMessage)
            {
                StructuredMessage = new StructuredMessage(value.Substring(1), transactionCode);
            }
            else
            {
                Message = new Message(value.Substring(1));
            }
        }
コード例 #23
0
        private void configRequest(byte[] request, TransactionCode transactionCode, long destinationOffset)
        {
            // bytes 0-1 reserved (destination id)
            // assumes lower 2 bits are zeroed
            request[2] = (byte)transactionLabel;
            // assumes lower 4 bits are zeroed
            request[3] = (byte)transactionCode;
            // shift source id lower 18 bits into bytes 4-5 (big-endian)
            request[4] = (byte)(sourceId >> 8 & 0xff);
            request[5] = (byte)(sourceId & 0xff);
            // shift destination offset into bytes 6-11 (big-endian)
            var dof = destinationOffset;

            for (var i = 0; i < 6; i++)
            {
                request[11 - i] = (byte)(dof & 0xff);
                dof           >>= 8;
            }
        }
コード例 #24
0
        private void checkResponse(byte[] response, TransactionCode transactionCode)
        {
            // 40h returned for required powerup clear
            // 50h returned for invalid address
            var _resultCode = response.Length >= 7 ? response[6] : (byte)0;

            if (_resultCode != 0)
            {
                throw new NakException(_resultCode);
            }

            // check source id matches
            var _sourceId = 0xffff & response[4] << 8 | response[5];

            if (_sourceId != sourceId)
            {
                Thrower.Throw(
                    "Invalid source id, expected {0:X} but received {1:X}",
                    sourceId, _sourceId);
            }

            // check transaction label matches
            var _transactionLabel = response[2] & 0xff;

            if (_transactionLabel != transactionLabel)
            {
                Thrower.Throw(
                    "Invalid transaction label, expected {0:X} but received {1:X}",
                    transactionLabel, _transactionLabel);
            }

            // check transaction code matches
            var _transactionCode = response[3] & 0xff;

            if (!Enum.IsDefined(typeof(TransactionCode), _transactionCode) ||
                (TransactionCode)_transactionCode != transactionCode)
            {
                Thrower.Throw(
                    "Invalid transaction code, expected {0:X} but received {1:X}",
                    transactionCode, _transactionCode);
            }
        }
コード例 #25
0
        public StructuredMessage(string value, TransactionCode transactionCode)
        {
            Helpers.ValidateStringMultipleLengths(value, new[] { 53, 73 }, "StructuredMessage");

            StructuredMessageType = value.Substring(0, 3);
            StructuredMessageFull = value.Substring(3);

            if (StructuredMessageType == "101" || StructuredMessageType == "102")
            {
                Value = StructuredMessageFull.Substring(0, 12);
            }
            else if (StructuredMessageType == "105" && StructuredMessageFull.Length >= 57)
            {
                Value = StructuredMessageFull.Substring(45, 12); // is start position 42 or 45?
            }
            else if (StructuredMessageType == "127" && transactionCode.Family.Value == "05")
            {
                SepaDirectDebit = new SepaDirectDebit(StructuredMessageFull);
            }
        }
コード例 #26
0
        public override string ToString()
        {
            string ret = Time.ToString() + ",";

            ret += TransactionCode.ToString() + ",";
            ret += TransactionSubcode.ToString() + ",";
            ret += TransID.ToString() + ",";
            ret += (Symbol != null ? Symbol.ToString() : "") + ",";
            ret += (BuySell != null ? BuySell.ToString() : "") + ",";
            ret += (OpenClose != null ? OpenClose.ToString() : "") + ",";
            ret += Quantity.ToString() + ",";
            ret += ExpireDate.ToString() + ",";
            ret += Strike.ToString() + ",";
            ret += (InsType != null ? InsType.ToString() : "") + ",";
            ret += Price.ToString() + ",";
            ret += Fees.ToString() + ",";
            ret += Amount.ToString() + ",";
            ret += Description.ToString() + ",";
            ret += AccountRef.ToString();
            return(ret);
        }
コード例 #27
0
        void handleTransaction(TransactionCode tc)
        {
            bool handled = false;

            while (!handled)
            {
                try
                {
                    wmisession.StartTransaction();
                }
                catch (System.Management.ManagementException e)
                {
                    throw new Exception("Unable to start transaction " + e.ToString());
                }
                try
                {
                    tc();
                    try
                    {
                        wmisession.CommitTransaction();
                        handled = true;
                    }
                    catch (Exception e)
                    {
                        // an exception during the commit means handled doesn't get set
                        // We want to loop around and try again
                        Debug.Print(string.Format("HandleTransaction exception: {0}", e));
                        continue;
                    }
                }
                catch (Exception e)
                {
                    if (!handled)
                    {
                        wmisession.AbortTransaction();
                    }
                    throw e;
                }
            }
        }
コード例 #28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TransactionPart1Line"/> class.
 /// </summary>
 /// <param name="sequenceNumber">The continious sequence number.</param>
 /// <param name="sequenceNumberDetail">The detail number.</param>
 /// <param name="bankReference">The reference number of the bank.</param>
 /// <param name="amount">The amount.</param>
 /// <param name="valutaDate">The value date.</param>
 /// <param name="transactionCode">The transaction code.</param>
 /// <param name="messageOrStructuredMessage">The communication, structured or unstructured.</param>
 /// <param name="transactionDate">The entry date.</param>
 /// <param name="statementSequenceNumber">The sequence number statement of account on paper.</param>
 /// <param name="globalizationCode">The globalization code.</param>
 public TransactionPart1Line(
     SequenceNumber sequenceNumber,
     SequenceNumberDetail sequenceNumberDetail,
     BankReference bankReference,
     Amount amount,
     Date valutaDate,
     TransactionCode transactionCode,
     MessageOrStructuredMessage messageOrStructuredMessage,
     Date transactionDate,
     StatementSequenceNumber statementSequenceNumber,
     GlobalizationCode globalizationCode)
 {
     SequenceNumber       = sequenceNumber;
     SequenceNumberDetail = sequenceNumberDetail;
     BankReference        = bankReference;
     Amount                     = amount;
     ValutaDate                 = valutaDate;
     TransactionCode            = transactionCode;
     MessageOrStructuredMessage = messageOrStructuredMessage;
     TransactionDate            = transactionDate;
     StatementSequenceNumber    = statementSequenceNumber;
     GlobalizationCode          = globalizationCode;
 }
コード例 #29
0
        public Task <IList <TransactionCode> > Query(TransactionCode options)
        {
            var builder = _requestProvider.BuildUpon(_url)
                          .Uri("/api/TransactionCode/query")
                          .AddInterceptor(new JsonDeserializerInterceptor());

            if (!string.IsNullOrEmpty(options.Code?.Trim()))
            {
                builder.AddParam("Code", $"{options.Code}");
            }

            if (!string.IsNullOrEmpty(options.GLEntry?.Trim()))
            {
                builder.AddParam("GLEntry", options.GLEntry.Trim());
            }

            if (!string.IsNullOrEmpty(options.Text?.Trim()))
            {
                builder.AddParam("Text", options.Text.Trim());
            }

            return(builder.Execute <IList <TransactionCode> >());
        }
コード例 #30
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 27, Configuration.FieldSeparator),
                       Id,
                       SetIdIvt.HasValue ? SetIdIvt.Value.ToString(culture) : null,
                       InventoryLocationIdentifier?.ToDelimitedString(),
                       InventoryLocationName,
                       SourceLocationIdentifier?.ToDelimitedString(),
                       SourceLocationName,
                       ItemStatus?.ToDelimitedString(),
                       BinLocationIdentifier != null ? string.Join(Configuration.FieldRepeatSeparator, BinLocationIdentifier.Select(x => x.ToDelimitedString())) : null,
                       OrderPackaging?.ToDelimitedString(),
                       IssuePackaging?.ToDelimitedString(),
                       DefaultInventoryAssetAccount?.ToDelimitedString(),
                       PatientChargeableIndicator?.ToDelimitedString(),
                       TransactionCode?.ToDelimitedString(),
                       TransactionAmountUnit?.ToDelimitedString(),
                       ItemImportanceCode?.ToDelimitedString(),
                       StockedItemIndicator?.ToDelimitedString(),
                       ConsignmentItemIndicator?.ToDelimitedString(),
                       ReusableItemIndicator?.ToDelimitedString(),
                       ReusableCost?.ToDelimitedString(),
                       SubstituteItemIdentifier != null ? string.Join(Configuration.FieldRepeatSeparator, SubstituteItemIdentifier.Select(x => x.ToDelimitedString())) : null,
                       LatexFreeSubstituteItemIdentifier?.ToDelimitedString(),
                       RecommendedReorderTheory?.ToDelimitedString(),
                       RecommendedSafetyStockDays.HasValue ? RecommendedSafetyStockDays.Value.ToString(Consts.NumericFormat, culture) : null,
                       RecommendedMaximumDaysInventory.HasValue ? RecommendedMaximumDaysInventory.Value.ToString(Consts.NumericFormat, culture) : null,
                       RecommendedOrderPoint.HasValue ? RecommendedOrderPoint.Value.ToString(Consts.NumericFormat, culture) : null,
                       RecommendedOrderAmount.HasValue ? RecommendedOrderAmount.Value.ToString(Consts.NumericFormat, culture) : null,
                       OperatingRoomParLevelIndicator?.ToDelimitedString()
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
コード例 #31
0
ファイル: ACHFile.cs プロジェクト: CertiPay/CertiPay.ACH
        internal static Boolean IsCredit(TransactionCode code)
        {
            switch (code)
            {
                case TransactionCode.Checking_Credit:
                case TransactionCode.Checking_Credit_Prenote:
                case TransactionCode.Saving_Credit:
                case TransactionCode.Saving_Credit_Prenote:
                    return true;

                default:
                    return false;
            }
        }
コード例 #32
0
 void handleTransaction(TransactionCode tc)
 {
     bool handled = false;
     while (!handled)
     {
         wmisession.StartTransaction();
         try
         {
             tc();
             try
             {
                 wmisession.CommitTransaction();
                 handled = true;
             }
             catch
             {
                 // an exception during the commit means handled doesn't get set
             }
         }
         catch (Exception e)
         {
             throw e;
         }
         finally
         {
             if (!handled)
             {
                 wmisession.AbortTransaction();
             }
         }
     }
 }
コード例 #33
0
ファイル: Transaction.cs プロジェクト: ipduncan/Refactor
 public Transaction(TransactionCode code, int claimHeaderKey, double amount, DateTime transactionDate, DateTime arDate, DateTime? postDate, int unidentifiedKey)
 {
     _claimHeaderKey = claimHeaderKey;
     SetMembers(code);
     _amount = amount;
     _transactionDate = transactionDate;
     _arDate = arDate;
     _postDate = postDate;
     _unidentifiedKey = unidentifiedKey;
 }
コード例 #34
0
ファイル: DetailRecord.cs プロジェクト: stuarta0/banking-au
 public DetailRecord()
 {
     RecordType = 1;
     Indicator = Records.Indicator.None;
     TransactionCode = Records.TransactionCode.CreditItem;
 }
コード例 #35
0
 public Item()
 {
     this.ledgerDistributionField = new List<LedgerDistribution>();
     this.grnDetailsField = new List<GrnDetails>();
     this.analysisLineEntryField = new ItemAnalysisLineEntry();
     this.transactionCodeField = TransactionCode.I;
     this.discountBasisField = DiscountBasis.T;
     this.taxBasisField = TaxBasis.E;
     this.ecAcquisitionField = EcAcquisition.Y;
     this.reestablishInvoiceField = ReestablishInvoice.N;
 }
コード例 #36
0
ファイル: Transaction.cs プロジェクト: ipduncan/Refactor
 private void SetMembers(TransactionCode code)
 {
     switch (code)
     {
         case TransactionCode.COM:
             _transactionCode = code;
             _transactionCategory = TransactionCategory.PYMT;
             _transactionType = TransactionType.P;
             break;
         default:
             break;
     }
 }
コード例 #37
0
ファイル: Batch.cs プロジェクト: ipduncan/Refactor
 private static IList<ITransaction> CreateTransactionsFromPayments(
     // ReSharper disable SuggestBaseTypeForParameter
     IList<PaymentDTO> paymentDtos
     // ReSharper restore SuggestBaseTypeForParameter
     , TransactionCode transactionCode
     , DateTime transactionDate
     , DateTime transactionARDate
     , int unidentifiedMoneyKey)
 {
     if (paymentDtos == null) throw new ArgumentNullException("paymentDtos");
     IList<ITransaction> transactions = new List<ITransaction>();
     foreach (PaymentDTO paymentDTO in paymentDtos)
     {
         ITransaction transaction = new Transaction(
             0
             , transactionCode
             , paymentDTO.ClaimHeaderKey
             , paymentDTO.Amount
             , transactionDate
             , transactionARDate
             , null
             , unidentifiedMoneyKey
             );
         transactions.Add(transaction);
     }
     return transactions;
 }