private void priceListViewToolStripMenuItem_Click_1(object sender, EventArgs e) { Form sForm = PriceListView.Instance(); sForm.MdiParent = this; sForm.Show(); sForm.Activate(); }
/// <summary> /// Exportings the PDF. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> protected void ExportingPdf(object sender, GridPdfExportingArgs e) { if (!this._isToExport) { return; } var distributorName = string.Format( "<img style ='{0}' src='/Content/Global/css/img/logo_HID_300dpi.jpg' /><div style='{1}'>{2}</div>", PriceListGeneratorPdfStyle.LogoImageStyle, PriceListGeneratorPdfStyle.DistributorNameStyle, DistributorName); if (!this.cbCustomerPrice.Checked) { // Tax information. if (txtSalesTax.Text.Equals(txtSalesTaxCalculated.Value) && !string.IsNullOrEmpty(ddlTaxState.SelectedValue)) { distributorName += string.Format( "<p style=\"{3}\">{0}, {1} {2}</p>", txtTaxCity.Text, ddlTaxState.Text, txtTaxZipCode.Text, PriceListGeneratorPdfStyle.TaxInformationStyle); } } // Inserting the header. e.RawHTML = e.RawHTML.Replace("<table", String.Format("{0}<table", distributorName)); // Cleaning some styles; e.RawHTML = e.RawHTML.Replace("border=\"0\"", string.Empty); e.RawHTML = e.RawHTML.Replace("<th s", "<th style='border-bottom: 2px solid #000000' s"); // Setting up categories and subcategories html mark up. e.RawHTML = e.RawHTML.Replace( "<td>#CartNameStart#", string.Format("</tr><tr><td colspan='9'><h2 style='{0}'>", PriceListGeneratorPdfStyle.CategoryNameStyle)); e.RawHTML = e.RawHTML.Replace("#CatNameEnd#", string.Format("</h2><h3 style='{0}'>", PriceListGeneratorPdfStyle.SubCategoryNameStyle)); e.RawHTML = e.RawHTML.Replace( "<td>#SubCatNameStart#", string.Format("</tr><tr><td colspan='9'><h3 style='{0}'>", PriceListGeneratorPdfStyle.SubCategoryNameStyle)); e.RawHTML = e.RawHTML.Replace("#SubCatNameEnd#", "</h3></td></tr><tr><td>"); // Removing unused tags for Web UI. var toFix = PriceListView.Where(item => item.Sku.Contains("#SubCatNameEnd#")).ToList(); if (toFix.Any()) { toFix.ForEach(item => item.Sku = item.Sku.Substring(item.Sku.IndexOf("#SubCatNameEnd#") + "#SubCatNameEnd#".Length)); } }
private void homeListView_Click(object sender, ItemClickEventArgs e) { // Connected animation switch (((ListView)sender).Name) { case "PriceListView": PriceListView.PrepareConnectedAnimation("toCoinDetails", e.ClickedItem, "PriceListView_Element"); break; case "VolumeListView": VolumeListView.PrepareConnectedAnimation("toCoinDetails", e.ClickedItem, "VolumeListView_Element"); break; } var clickedItem = (HomeTile)e.ClickedItem; this.Frame.Navigate(typeof(CoinDetails), clickedItem._crypto); }
private void MoveCoinUp(object sender, RoutedEventArgs e) { string crypto = ((HomeTile)((FrameworkElement)sender).DataContext)._crypto; int n = App.pinnedCoins.IndexOf(crypto); if (n != 0) { var tempName = App.pinnedCoins[n]; App.pinnedCoins[n] = App.pinnedCoins[n - 1]; App.pinnedCoins[n - 1] = tempName; var tempListItem = homeCoinList[n]; homeCoinList[n] = homeCoinList[n - 1]; homeCoinList[n - 1] = tempListItem; PriceListView.UpdateLayout(); UpdateCard(n); // Update pinnedCoin list App.UpdatePinnedCoins(); } }
/// <summary> /// Calculate customer price and distributor cost. /// </summary> /// <param name="distributorDiscount">The distributor discount.</param> /// <param name="customerDiscount">The customer discount.</param> /// <param name="salesTax">The sales tax.</param> /// <param name="shippingAndHandling">The shipping and handling.</param> private static void CalculatePrices(decimal distributorDiscount, decimal customerDiscount, decimal salesTax, decimal shippingAndHandling) { PriceListView.ForEach( item => { var tax = item.GetTaxRate(salesTax, ProductTax); item.CustomerPrice = getAmountString( item.GetCustomerPrice(customerDiscount, tax, shippingAndHandling)); item.CustomerRetailPrice = getAmountString( item.GetCustomerRetailPrice(tax, shippingAndHandling)); item.DistributorLoadedCost = getAmountString( item.GetDistributorLoadedCost(distributorDiscount, tax, shippingAndHandling)); item.DistributorDiscountCost = getAmountString(item.GetDistributorDiscountCost(distributorDiscount)); item.TaxRate = string.Format("{0} %", string.Format(GetPriceFormat(tax * 100), tax * 100)); }); var multiple = PriceListView != null?PriceListView.Select(i => i.TaxRate).Distinct().ToList() : new List <string>(); IsMultipleRate = (multiple.Count > 1); }
private void PriceListWin() { PriceListView PLW = new PriceListView(); PLW.ShowDialog(); }
private async Task UpdateCard(int i) { string c = App.pinnedCoins[i]; // DATA: await App.GetHisto(c, timeSpan, limit); float oldestPrice; float newestPrice; if (App.historic != null) { oldestPrice = App.historic[0].Close; newestPrice = App.historic[App.historic.Count - 1].Close; } else { oldestPrice = 0; newestPrice = 0; } float d = (float)Math.Round(((newestPrice / oldestPrice) - 1) * 100, 2); if (d < 0) { d = Math.Abs(d); diff = "▼" + d.ToString() + "%"; } else { diff = "▲" + d.ToString() + "%"; } homeCoinList[i]._priceCurr = App.GetCurrentPrice(c, "defaultMarket").ToString() + App.coinSymbol; homeCoinList[i]._priceDiff = diff; await App.GetCoinStats(c, "defaultMarket"); homeCoinList[i]._volume24 = App.stats.Volume24; homeCoinList[i]._volume24to = App.stats.Volume24To; // ######################################################################################### // LOADING BAR ListViewItem container = (ListViewItem)PriceListView.ContainerFromIndex(i); var loading = (container.ContentTemplateRoot as FrameworkElement)?.FindName("LoadingControl") as Loading; loading.IsLoading = true; // ######################################################################################### // COLOR SolidColorBrush coinColorT, coinColor; try { coinColorT = (SolidColorBrush)Application.Current.Resources[c.ToUpper() + "_colorT"]; coinColor = (SolidColorBrush)Application.Current.Resources[c.ToUpper() + "_color"]; } catch (Exception) { coinColorT = (SolidColorBrush)Application.Current.Resources["Main_WhiteBlackT"]; coinColor = (SolidColorBrush)Application.Current.Resources["Main_WhiteBlack"]; } // ######################################################################################### // PRICE CHART var PriceChart = (container.ContentTemplateRoot as FrameworkElement)?.FindName("PriceChart") as RadCartesianChart; var verticalAxis = (container.ContentTemplateRoot as FrameworkElement)?.FindName("VerticalAxis") as LinearAxis; await App.GetHisto(c, timeSpan, limit); List <ChartData> priceData = new List <ChartData>(); verticalAxis.Minimum = GraphHelper.GetMinimum(App.historic); verticalAxis.Maximum = GraphHelper.GetMaximum(App.historic); for (int k = 0; k < App.historic.Count; ++k) { priceData.Add(new ChartData() { Date = App.historic[k].DateTime, Value = (App.historic[k].Low + App.historic[k].High) / 2, Low = App.historic[k].Low, High = App.historic[k].High, Open = App.historic[k].Open, Close = App.historic[k].Close, Volume = App.historic[k].Volumefrom }); } SplineAreaSeries series = (SplineAreaSeries)PriceChart.Series[0]; series.CategoryBinding = new PropertyNameDataPointBinding() { PropertyName = "Date" }; series.ValueBinding = new PropertyNameDataPointBinding() { PropertyName = "Value" }; series.ItemsSource = priceData; series.Fill = coinColorT; series.Stroke = coinColor; var v = series.VerticalAxis; // ######################################################################################### // VOLUME CHART ListViewItem container2 = (ListViewItem)VolumeListView.ContainerFromIndex(i); await App.GetHisto(c, "hour", 24); List <ChartData> volumeData = new List <ChartData>(); for (int j = 0; j < 24; j++) { volumeData.Add(new ChartData() { Date = App.historic[j].DateTime, Volume = App.historic[j].Volumefrom, cc = coinColorT }); } RadCartesianChart volumeChart = (container2.ContentTemplateRoot as FrameworkElement)?.FindName("volumeChart") as RadCartesianChart; BarSeries barSeries = (BarSeries)volumeChart.Series[0]; barSeries.ItemsSource = volumeData; var z = barSeries.DefaultVisualStyle; loading.IsLoading = false; }