public string this[string columnName] { get { error = null; if (columnName == "Quantity") { if (Quantity <= 0 || string.IsNullOrWhiteSpace(Quantity.ToString())) { error = "Favor ingresar una cantidad correcta"; } } if (columnName == "TransactionAmount") { if (TransactionAmount <= 0 || string.IsNullOrWhiteSpace(TransactionAmount.ToString())) { error = "Favor ingresar una cantidad correcta"; } } if (columnName == "Justification") { if (string.IsNullOrWhiteSpace(Justification)) { error = "Favor ingresar una justificacion"; } } return(error); } #endregion }
public override string ToString() { return("[TransactionLog: " + " ID = " + ID.ToString() + " UserID = " + UserID + " ReferenceNumber = " + ReferenceNumber + " Transactions = " + Transactions + " TransactionDate = " + TransactionDate + " TransactionType = " + TransactionType + " FromAccount = " + FromAccount + " ToAccount = " + ToAccount + " TransactionAmount = " + TransactionAmount.ToString() + " Remarks = " + Remarks + "]"); }
//display transaction amount and type and date when converting to string public override string ToString() { return(TransactionAmount.ToString() + " " + TransactionType + " " + TransactionDate.ToShortDateString()); }
private void RaiseDisplayChanged() { var sb = new StringBuilder(); if (_state == ControlUnitState.Maintenance) { sb.AppendLine("OUT OF ORDER"); sb.AppendLine("Sales report: "); double total = 0; // calculate sales report for (int i = 0; i < ControlUnit.Instance.VendingProcessor.ProductSlots.Length; i++) { var p = ControlUnit.Instance.VendingProcessor.ProductSlots[i]; total += p.Price * p.TotalSold; sb.AppendLine(p.Name + ", sold " + p.TotalSold + "= £" + (p.Price * p.TotalSold).ToString("#0.00")); } sb.AppendLine("Total = £" + total.ToString("#0.00")); } else if (_state == ControlUnitState.Ready) { if (String.IsNullOrEmpty(Error)) { sb.AppendLine("CHOOSE DRINK"); } else { sb.AppendLine(Error); } } else if (_state == ControlUnitState.Release || _state == ControlUnitState.Finalize) { sb.AppendLine("THANK YOU. . ."); } else if (_state == ControlUnitState.Transaction) { if (NoChange) { sb.AppendLine("NO CHANGE"); } else { if (String.IsNullOrEmpty(Error)) { sb.AppendLine("INSERT COINS PLEASE"); } else { sb.AppendLine(Error); } } } else { sb.AppendLine("ERROR!"); } if (_state == ControlUnitState.Transaction) // Show product name, cost, and current transaction amount { sb.AppendLine(ChosenProduct.Name); sb.AppendLine("Cost: £" + ChosenProduct.Price.ToString("#0.00")); sb.AppendLine("Cash Inserted : £" + TransactionAmount.ToString("#0.00")); } if (OnDisplayChanged != null) { OnDisplayChanged(sb.ToString()); } }
/// <summary> /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>. /// </summary> /// <returns> /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>. /// </returns> public override string ToString() { return(string.Format(Resources.Culture, Resources.InvestmentTransactionDisplay, Date.ToString("d", CultureInfo.CurrentCulture), TextFirstLine, TransactionAmount.ToString("C2", CultureInfo.CurrentCulture))); }