Esempio n. 1
0
 private void txtPcs_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         TransactionDate.Focus();
     }
 }
Esempio n. 2
0
        public BorrowBookTransaction(LibraryUser libUser, BookCopy bookCopy)
            : base(bookCopy)
        {
            _BookCopyService = new BookCopyService();
            _HolidayService  = new HolidayService();
            _BookInfoService = new BookService();
            _SectionService  = new SectionService();

            var bookInfo = _BookInfoService.BookInfoOf(BookCopy);
            var section  = _SectionService.GetBookSection(bookInfo);

            if (section == null)
            {
                throw new InvalidOperationException("The book does not belong to a section.");
            }

            if (section.MaxDaysAllowedForBorrowing == 0)
            {
                TransactionType = "Not Allowed For Borrowing.";
            }

            bookTransInfo = new TransactionInfo
            {
                BookCopyId         = BookCopy.Id,
                LibraryUserId      = libUser.Id,
                BorrowDate         = TransactionDate,
                ExpectedReturnDate = _HolidayService.GetNonHolidayDateFrom(TransactionDate.AddDays(section.MaxDaysAllowedForBorrowing))
            };
        }
Esempio n. 3
0
        public void BankAccount_BankAccountStatementsHistorical_Output()
        {
            BankAccount bankAccount = new BankAccount();
            Amount      amount      = new Amount(1000);

            //When
            bankAccount.Deposit(amount);
            bankAccount.Deposit(amount);
            bankAccount.Deposit(amount);
            bankAccount.Withdrawal(amount);
            bankAccount.Deposit(amount);
            bankAccount.Withdrawal(amount);

            //Then
            var statementsHistorical = bankAccount.Statements;
            var expectedDate         = new TransactionDate().Value;

            var expectedOutput = new StringBuilder()
                                 .AppendLine()
                                 .AppendLine($"Date = {expectedDate}	DEPOSIT	Amount = 1000	Balance = 1000")
                                 .AppendLine($"Date = {expectedDate}	DEPOSIT	Amount = 1000	Balance = 2000")
                                 .AppendLine($"Date = {expectedDate}	DEPOSIT	Amount = 1000	Balance = 3000")
                                 .AppendLine($"Date = {expectedDate}	WITHDRAWAL	Amount = 1000	Balance = 2000")
                                 .AppendLine($"Date = {expectedDate}	DEPOSIT	Amount = 1000	Balance = 3000")
                                 .AppendLine($"Date = {expectedDate}	WITHDRAWAL	Amount = 1000	Balance = 2000")
                                 .ToString();

            Check.That(statementsHistorical).IsEqualTo(expectedOutput);
        }
 public override int GetHashCode()
 {
     return("Expense".GetHashCode()
            + 7 * ExpenseCategory.GetHashCode()
            + 13 * Amount.GetHashCode()
            + 17 * TransactionDate.GetHashCode());
 }
 public override string ToString()
 {
     return("Loaded :" + TransactionDate.ToString("yyyy/MM/dd") + Environment.NewLine
            + "Supplier : " + Supplier + Environment.NewLine
            + "Amount :R" + Amount.ToString("###,##0.00") + Environment.NewLine
            + "Reference :" + Reference);
 }
Esempio n. 6
0
        public void StartStopTransaction(int transactionId)
        {
            TimePlayZeroDbContextFactory fac     = new TimePlayZeroDbContextFactory();
            TimePlayZeroDbContext        context = fac.CreateDbContext(null);

            var trans = context.Transactions.Where(w => w.Id == transactionId).FirstOrDefault();

            if (trans == null)
            {
                return;
            }

            trans.State = trans.State == 0 ? 2 : 0;

            EnumTransactionDateType type = (EnumTransactionDateType)context.TransactionDates
                                           .Where(w => w.TransactionId == transactionId).OrderByDescending(o => o.Date)
                                           .Select(s => s.Type).FirstOrDefault();

            TransactionDate transactionDate = new TransactionDate();

            transactionDate.Date          = DateTime.Now;
            transactionDate.TransactionId = transactionId;
            transactionDate.Type          = type == EnumTransactionDateType.Start ? (int)EnumTransactionDateType.Stop : (int)EnumTransactionDateType.Start;

            context.TransactionDates.Add(transactionDate);
            context.SaveChangesAsync();
        }
 public override int GetHashCode()
 {
     return("Transfer".GetHashCode()
            + 7 * Source.GetHashCode()
            + 13 * Target.GetHashCode()
            + 17 * Amount.GetHashCode()
            + 19 * TransactionDate.GetHashCode());
 }
        private void TweakThenSave(SoaRowDTO dto)
        {
            dto.DocRefType = this.GetType().FullName;
            dto.DateOffset = TransactionDate.SoaRowOffset();
            dto.Amount     = Math.Abs(dto.Amount)
                             * (IsDeposit ? 1.0M : -1.0M);

            _repo.UpsertAndUpdateBalances(dto);
        }
Esempio n. 9
0
 protected bool Equals(Transaction other)
 {
     return(Id == other.Id &&
            TransactionDate.Equals(other.TransactionDate) &&
            Created.Equals(other.Created) &&
            string.Equals(Payee, other.Payee) &&
            string.Equals(Reference, other.Reference) &&
            Amount == other.Amount);
 }
        private void saveTransactionButton_Click(object sender, RoutedEventArgs e)
        {
            Shop selectedShop = shopComboBox.SelectedItem as Shop;

            transactionController.Add(TransactionDate.ToString(), amountTextBox.Text, selectedShop, descriptionTextBox.Text);

            ClearForm();
            RefreshTransactionsTable();
        }
Esempio n. 11
0
        public int CompareTo(PaymentReportEntry other)
        {
            var result = string.Compare(Details, other.Details, StringComparison.Ordinal);

            if (result == 0)
            {
                result = TransactionDate.CompareTo(other.TransactionDate);
            }
            return(result);
        }
Esempio n. 12
0
        public override string ToString()//Override ToString which is used to format the send file statement
        {
            string username = Username;

            Thread.CurrentThread.CurrentCulture = new CultureInfo("el-gr");
            var transactiondateformat = TransactionDate.ToString("yyyy-MM-dd HH:mm:ss.FFF", CultureInfo.InvariantCulture);
            var amount = Amount.ToString("C2", CultureInfo.CurrentCulture);

            return($"Your transaction was successful {username}, " +
                   $"it took place on {transactiondateformat} and your current BALANCE is: {amount}");
        }
Esempio n. 13
0
        public string this[string columnName]
        {
            get
            {
                if (columnName == "VehicleId")
                {
                    if (null == VehicleId || VehicleId == 0)
                    {
                        return("Vehicle is required");
                    }
                }

                if (columnName == "DriverName")
                {
                    if (string.IsNullOrEmpty(DriverName))
                    {
                        return("Driver is required");
                    }
                }

                if (columnName == "TransactionDate")
                {
                    if (null == TransactionDate || string.IsNullOrEmpty(TransactionDate.ToString()))
                    {
                        return("Filled date is required");
                    }
                }

                if (columnName == "CashAmount")
                {
                    if (null == CashAmount || CashAmount <= 0)
                    {
                        return("Cash amount is required");
                    }
                }

                if (columnName == "ValueAmount")
                {
                    if (null == ValueAmount || ValueAmount <= 0)
                    {
                        return("Value amount is required");
                    }
                }

                if (columnName == "LeafNo")
                {
                    if (string.IsNullOrEmpty(LeafNo))
                    {
                        return("Leaf# is required");
                    }
                }
                return(string.Empty);
            }
        }
Esempio n. 14
0
 private Order(string name, string email, string whatsapp, Districts districts, string address, string note, PaymentMethod paymentMethod, Func <DateTime, string> orderNumberGenerator)
     : this()
 {
     this.Customer            = new OrderCustomer(name, email, whatsapp, address, districts);
     this.TransactionDate     = DateTime.Now;
     this.OrderNumber         = orderNumberGenerator.Invoke(this.TransactionDate);
     this.Payment             = new OrderPayment(paymentMethod);
     this.Note                = note;
     this.DueDateConfirmation = TransactionDate.AddDays(1);
     this.Status              = OrderStatus.DRAFT;
 }
Esempio n. 15
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()));
        }
Esempio n. 16
0
        private void TransactionDetails_Load(object sender, EventArgs e)
        {
            lblProcessedBY.Text     = AdminFullname;
            lblTransactionDate.Text = TransactionDate.ToShortDateString();
            lblTransactionID.Text   = TransactionID.ToString();
            lblTransactionType.Text = TransactionType;

            if (TransactionType == "Borrowed an Equipment")
            {
                dgvTransactionDetails.DataSource = db.sp_ViewBorrowedEquipment(TransactionID);
            }
        }
Esempio n. 17
0
        public override async Task <TransactionDto> Create(CreateTransactionDto input)
        {
            try
            {
                TimePlayZeroDbContextFactory fac     = new TimePlayZeroDbContextFactory();
                TimePlayZeroDbContext        context = fac.CreateDbContext(null);

                Transaction transaction = new Transaction();
                transaction.CreationTime = DateTime.Now;
                transaction.Duration     = input.Duration;
                transaction.CustomerName = input.CustomerName;
                transaction.PhoneNumber  = input.PhoneNumber;
                transaction.Price        = input.Price;

                transaction.State         = input.State;
                transaction.ItemPriceCode = input.ItemPriceCode;
                transaction.ItemPriceId   = input.ItemPriceId;
                transaction.CustomerId    = input.CustomerId;
                transaction.Description   = input.Description;
                transaction.IsUnlimited   = input.IsUnlimited;
                context.Transactions.Add(transaction);
                int x = await context.SaveChangesAsync();

                TransactionDate transactionDate = new TransactionDate();
                transactionDate.Date          = DateTime.Now;
                transactionDate.Type          = (int)EnumTransactionDateType.Start;
                transactionDate.TransactionId = transaction.Id;

                context.TransactionDates.Add(transactionDate);

                int y = await context.SaveChangesAsync();

                var res = MapToEntityDto(transaction);

                res.TotalPrice = transaction.Price;
                res.StartDate  = transactionDate.Date;

                if (input.IsUnlimited)
                {
                    res.DurationStr = L("IsUnlimited");
                }
                else
                {
                    res.DurationStr = res.Duration.ToString();
                }
                return(res);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 18
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (lines != null ? lines.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Id != null ? Id.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ TransactionDate.GetHashCode();
         hashCode = (hashCode * 397) ^ (Username != null ? Username.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TransactionType != null ? TransactionType.GetHashCode() : 0);
         return(hashCode);
     }
 }
Esempio n. 19
0
 private Transaction(
     TransactionId id,
     decimal amount,
     Currency currency,
     TransactionDate date,
     TransactionStatus status)
 {
     TransactionId   = id;
     Amount          = amount;
     Currency        = currency;
     TransactionDate = date;
     Status          = status;
 }
Esempio n. 20
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id.GetHashCode();
         hashCode = (hashCode * 397) ^ TransactionDate.GetHashCode();
         hashCode = (hashCode * 397) ^ Created.GetHashCode();
         hashCode = (hashCode * 397) ^ (Payee != null ? Payee.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Reference != null ? Reference.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Amount.GetHashCode();
         return(hashCode);
     }
 }
        public override string ToString()
        {
            var sb = new StringBuilder();

            sb.Append("From" + "   | ").Append("Transaction Type | ")
            .Append("    " + "To" + "    | ").Append("   " + "Amount" + "     |")
            .AppendLine("\t    " + "\tDate" + "\t\t   |")
            .Append(AccountHolder).Append("\t      " + $"{TransactionType}" + "      ")
            .Append("   " + LoggedUser + "  ").Append("    " + $"{Amount.ToString("C", new CultureInfo("el-Gr"))}" + "     ")
            .Append("  " + $"{TransactionDate.ToString("yyyy-MM- dd HH:mm:ss.FFF")}")
            .AppendLine();

            return(sb.ToString());
        }
Esempio n. 22
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 17;
         hash = hash * 23 + (ActualCost == default(decimal) ? 0 : ActualCost.GetHashCode());
         hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode());
         hash = hash * 23 + (ProductId == default(int) ? 0 : ProductId.GetHashCode());
         hash = hash * 23 + (Quantity == default(int) ? 0 : Quantity.GetHashCode());
         hash = hash * 23 + (ReferenceOrderId == default(int) ? 0 : ReferenceOrderId.GetHashCode());
         hash = hash * 23 + (ReferenceOrderLineId == default(int) ? 0 : ReferenceOrderLineId.GetHashCode());
         hash = hash * 23 + (TransactionDate == default(DateTime) ? 0 : TransactionDate.GetHashCode());
         hash = hash * 23 + (TransactionType == null ? 0 : TransactionType.GetHashCode());
         return(hash);
     }
 }
Esempio n. 23
0
        public bool Equals(DealerPositionInfo another)
        {
            if (null == another)
            {
                return(false);
            }

            if (this == another)
            {
                return(true);
            }
            string tmpDate1 = TransactionDate.ToString(GlobalDefinition.DateFormat, GlobalDefinition.FormatProvider);
            string tmpDate2 = another.TransactionDate.ToString(GlobalDefinition.DateFormat, GlobalDefinition.FormatProvider);

            return(tmpDate1.Equals(tmpDate2) && Commodity.Equals(another.Commodity) && Month.Equals(another.Month) &&
                   VolumeDealers.Equals(another.VolumeDealers) && BuyDealers.Equals(another.BuyDealers) &&
                   SellDealers.Equals(another.SellDealers));
        }
        public bool Equals(ContractTransactionInfo another)
        {
            if (null == another)
            {
                return(false);
            }

            if (this == another)
            {
                return(true);
            }

            string dateString1 = TransactionDate.ToString(GlobalDefinition.DateFormat, GlobalDefinition.FormatProvider);
            string dateString2 = another.TransactionDate.ToString(GlobalDefinition.DateFormat, GlobalDefinition.FormatProvider);

            return(dateString1.Equals(dateString2) && Commodity.Equals(another.Commodity) &&
                   DoubleUtility.Equals(OpenPrice, another.OpenPrice) && DoubleUtility.Equals(HighPrice, another.HighPrice) &&
                   DoubleUtility.Equals(LowPrice, another.LowPrice) && DoubleUtility.Equals(ClosePrice, another.ClosePrice) &&
                   DoubleUtility.Equals(SettlePrice, another.SettlePrice) && Volume == another.Volume && Position == another.Position);
        }
Esempio n. 25
0
        public bool ExistIn(DealerPositionInfo another)
        {
            if (null == another)
            {
                return(false);
            }

            string date1  = TransactionDate.ToString(GlobalDefinition.DateFormat, GlobalDefinition.FormatProvider);
            string date2  = another.TransactionDate.ToString(GlobalDefinition.DateFormat, GlobalDefinition.FormatProvider);
            bool   result = date1.Equals(date2) && Commodity.Equals(another.Commodity) && Month.Equals(another.Month);

            string dealerList = "";

            if (result)
            {
                switch (DealerInformationType)
                {
                case InformationType.VolumeInfo:
                    dealerList = another.VolumeDealers;
                    break;

                case InformationType.BuyInfo:
                    dealerList = another.BuyDealers;
                    break;

                case InformationType.SellInfo:
                    dealerList = another.SellDealers;
                    break;
                }
                string dealer;
                int    amount;
                ExtractDealer(Rank, dealerList, out dealer, out amount);

                result = DealerName.Equals(dealer) && Amount == amount;
            }

            return(result);
        }
 private static Result <TransactionDate> TryResolveTransactionDate(string date) =>
 TransactionDate.Create(date);
Esempio n. 27
0
 public override string ToString()
 {
     return($"{TransactionDate.ToString(Formats.DateFormat)} {MerchantName.PadRight(10)} {string.Format(Formats.DecimalFormat, Fee)}");
 }
Esempio n. 28
0
 public override string ToString()
 {
     return(String.Format("{0,-10}{1,20}{2,25}{3,30}", TransactionDate.ToString("MM/dd/yyyy hh:mm:ss tt"), Action, ChangeInBalance.ToString("C"), CurrentBalance.ToString("C")));
     //return $"{TransactionDate.ToString("MM/dd/yyyy hh:mm:ss tt")} {Action} {ChangeInBalance.ToString("C")} {CurrentBalance.ToString("C")}";
 }
Esempio n. 29
0
        private string GetHash()
        {
            string raw = $"{TruckId?.Trim()}{TransactionDate?.Trim()}{TransactionTime?.Trim()}{Units.ToString()}{NetCost.ToString()}";

            return(GetMd5Hash(raw));
        }
Esempio n. 30
0
 protected bool Equals(Transaction other)
 {
     return(lines.SequenceEqual(other.lines) && string.Equals(Id, other.Id) && TransactionDate.Equals(other.TransactionDate) && string.Equals(Username, other.Username) && string.Equals(Description, other.Description) && string.Equals(TransactionType, other.TransactionType));
 }