/// <summary> /// On KeyUp handler for pressing a key in the invoiceDueDateTextBox, initiate check date on enter /// </summary> /// <param name="sender">object sending request</param> /// <param name="e">event arguments of request</param> private void InvoiceDueDateTextBox_KeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { if (!dateValidator.IsDateValid(InvoiceDateTextBox.Text)) { MessageBoxUtility.ShowErrorMessageBox(ErrorMessages.dateError); } } }
/// <summary> /// Updates the initial total price with the discount, if discount is not to big /// </summary> /// <param name="discount">discount to withdraw from the total price</param> private void UpdatePrice(double discount) { if (discount <= totalInvoicePrice) { int numberRows = TableRowGroupItemsOfInvoice.Rows.Count(); UpdateTotalTaxAndPriceParagraph(discount, numberRows); } else { MessageBoxUtility.ShowErrorMessageBox("The discount can´t be greater than the price"); } }
/// <summary> /// On KeyUp handler for pressing a key in the priceDiscountTextBox, initiate check number on enter /// </summary> /// <param name="sender">object sending request</param> /// <param name="e">event arguments of request</param> private void PriceDiscountTextBox_KeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { TextBox discountTetBox = (TextBox)sender; string inputString = discountTetBox.Text; int decimalIndex = numberValidator.AddSeparatorIfSeparatorNotExists(ref inputString); bool numberOk = numberValidator.IsNumberValid(inputString, decimalIndex, out double result); if (numberOk) { UpdatePrice(result); discountTetBox.Text = result.ToString("N2"); } else { MessageBoxUtility.ShowErrorMessageBox(ErrorMessages.numberError); } } }
/// <summary> /// Outut error collectedDuring error check of invoice data /// </summary> private void OutPutInvoiceErrors() { MessageBoxUtility.ShowErrorMessageBox(string.Join("\n\n", invoiceMapper.InvoiceErrors), invoiceMapper.InvoiceErrors.Count()); }