/// <summary> /// Hjälpmetod för att representera ett kvitto som en textsträng. /// </summary> /// <returns>Strängrepresentationen av ett kvitto.</returns> public override string ToString() { string receiptAsString; receiptAsString = ProductCode.ToString(CultureInfo.CurrentCulture) + ';'; receiptAsString += Quantity.ToString(CultureInfo.CurrentCulture) + ';'; receiptAsString += DateOfSale + ';'; receiptAsString += ReceiptNumber.ToString(CultureInfo.CurrentCulture) + ';'; receiptAsString += Price.ToString(CultureInfo.CurrentCulture); return(receiptAsString); }
public override string ToString() { var info = new StringBuilder(); info.Append(base.ToString()); info.Append("Amount: ").AppendLine(Amount.ToString()); info.Append("Receipt number: ").AppendLine(ReceiptNumber.ToString()); info.Append("RRN: ").AppendLine(ReturnReferenceNumber); info.Append("Authorization code: ").AppendLine(AuthorizationCode); return(info.ToString()); }
public void FillReceipts() { if (ReceiptNumber.ToString().Trim() != "0" && (ReceiptNumber % 1) == 0) { try { ReceiptModel rm = new ReceiptModel(); List <ReceiptModel> list = new List <ReceiptModel>() { rm.GetMeByNumber(ReceiptNumber, Customer.Id) }; if (list[0] == null || list.Count == 0) { throw new Exception("No receipt for " + Customer.Name + " with number " + ReceiptNumber); } Receipts = new BindableCollection <ReceiptModel>(list); } catch (Exception e) { Receipts = new BindableCollection <ReceiptModel>(); } } else { switch (ReceiptSeason.Id.ToString()) { case "0": if (ReceiptSeason.Year == "None") { Receipts = Customer.GetMyReceipts(0); } else { Receipts = Customer.GetMyReceipts(); } break; default: Receipts = Customer.GetMyReceipts(ReceiptSeason.Id); break; } } }
public override string ToString() { var info = new StringBuilder(); info.Append(base.ToString()); info.Append("Approved amount: ").AppendLine(ApprovedAmount.ToString()); info.Append("Approved Amount Currency: ").AppendLine(ApprovedAmountCurrency); info.Append("Batch number: ").AppendLine(BatchNumber.ToString()); info.Append("Receipt number: ").AppendLine(ReceiptNumber.ToString()); info.Append("RRN: ").AppendLine(ReturnReferenceNumber); info.Append("Authorization code: ").AppendLine(AuthorizationCode); info.Append("Card number: ").AppendLine(CardNumber); info.Append("Card holder name: ").AppendLine(CardHolderName); info.Append("Card company: ").AppendLine(CardCompany); info.Append("EMV Application Label: ").AppendLine(EmvApplicationLabel); info.Append("EMV Application ID: ").AppendLine(EmvApplicationId); info.Append("Transaction Flag: ").AppendLine(TransactionFlag.ToString()); info.Append("Is Pin Used: ").AppendLine(IsPinUsed.ToString()); return(info.ToString()); }
public override string ToString() { StringBuilder result = new StringBuilder(); // Message type (= Payment request), Length: 4, Fieldtype: AN result.Append(StringValueAttribute.GetStringValue(MessageType)); // Terminal number, Length: 8, Fieldtype: N result.Append(TerminalId.ToString(CultureInfo.InvariantCulture).PadLeft(8, '0')); // Message version number, Length: 1, Fieldtype: N // 0 = No addittional information, 1 = additional information result.Append(HasAdditionalInformation ? "1" : "0"); // Amount, Length: 11, Fieldtype: N result.Append(Amount.ToString("#.##", CultureInfo.CurrentCulture).Replace( CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator, "").PadLeft(11, '0')); // Product info, Length: 20, Fieldtype: AN (Future use) result.Append(new String(' ', 20)); // Receipt number, Length: 6, Fieldtype: N result.Append(ReceiptNumber.ToString(CultureInfo.InvariantCulture).PadLeft(6, '0')); // Transaction type, Length: 2, Fieldtype: N // 00 = Purchase result.Append(StringValueAttribute.GetStringValue(TransactionType)); // Length of additional information, Length: 3, Fieldtype: N result.Append(AdditionalInformation.Length.ToString(CultureInfo.InvariantCulture).PadLeft(3, '0')); // Indicator additional information, Length: 2, Fieldtype: N // 01 = Currency, 02 = Product information (only for petrol) // 03 = Product information (Special terminal) result.Append(StringValueAttribute.GetStringValue(AdditionalInformationType)); // Additional information, Length: variable, Fieldtype: AN result.Append(AdditionalInformation); // End of text result.Append((Char)TwoStepProtocol.EndOfText); // LRC Checksum result.Append(TerminalRequest.CalculateLongitudinalRedundancyCheck(result.ToString())); // Start of text result.Insert(0, (Char)TwoStepProtocol.StartOfText); return(result.ToString()); }
public override void Save() { StorageProvider.Save(CreatePrintImage(), ReceiptNumber.ToString()); }