/// <summary> /// Sets the controls of this window around an invoice object. /// </summary> /// <param name="invoice">The invoice object we're setting to.</param> private void SetInvoice(Invoice invoice) { try { if (!AddingInvoice && !ModifyingInvoice) { _currentInvoice = invoice; } if (invoice != null && invoice.Items.Any()) { itemList = new ObservableCollection <Item>(invoice.Items); } else { itemList = new ObservableCollection <Item>(); } cmbInvoiceItems.ItemsSource = itemList; grdInvoiceDetails.ItemsSource = itemList; lblInvoiceID.Content = "Invoice ID: " + (AddingInvoice ? "< New Invoice > " : invoice?.InvoiceNumber.ToString()); lblInvoiceDate.Content = "Invoice Date: " + invoice?.InvoiceDate.ToShortDateString(); lblTotalCost.Content = "Total Cost: " + (invoice != null ? Formatting.FormatCurrency(invoice.TotalCost) : ""); } catch (Exception ex) { throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message); } }
public static MvcHtmlString PSCurrencyBox(this HtmlHelper htmlHelper, string name, object value, object htmlAttributes) { var newAttributes = ControlHelper.GetHtmlAttributes(htmlAttributes); newAttributes = newAttributes .AddClass("class", "ps-currency-box form-control text-right") .AddClass("maxlength", "18"); decimal amount = value.ToDecimal(); return(htmlHelper.TextBox(name, Formatting.FormatCurrency(amount), newAttributes)); }