private void RefreshVoucherSearchWithRemainingAmount() { FinancialSearchService voucherSearchWithRemaindingAmount = new FinancialSearchService(); BindingSource bindingSource = new BindingSource(); try { bindingSource.DataSource = voucherSearchWithRemaindingAmount.VoucherSearchWithRemainingAmount(DateTime.UtcNow); dataGridViewVoucherSearchWithRemainingAmount.AutoGenerateColumns = true; dataGridViewVoucherSearchWithRemainingAmount.DataSource = bindingSource; dataGridViewVoucherSearchWithRemainingAmount.AutoResizeColumns(); dataGridViewVoucherSearchWithRemainingAmount.Refresh(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { voucherSearchWithRemaindingAmount.Close(); } }
private void RefreshGetAvailableCurrencies( System.Guid financialCurrencyId, System.DateTime currencyDateTime ) { FinancialSearchService getAvailableCurrencies = new FinancialSearchService(); BindingSource bindingSource = new BindingSource(); try { bindingSource.DataSource = getAvailableCurrencies.GetAvailableCurrencies( financialCurrencyId, currencyDateTime ); dataGridViewGetAvailableCurrencies.AutoGenerateColumns = true; dataGridViewGetAvailableCurrencies.DataSource = bindingSource; dataGridViewGetAvailableCurrencies.AutoResizeColumns(); dataGridViewGetAvailableCurrencies.Refresh(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { getAvailableCurrencies.Close(); } }
public ActionResult TransactionsBalance() { Logging.ActionLog(Request, "TransactionsBalance ( ASP MVC WCF )"); DateTime fromDateTime = DateTime.UtcNow.AddMonths(-1); DateTime untilDateTime = DateTime.UtcNow.AddDays(+5); List <TransactionsCreditDebitBalanceContract> statistics = new FinancialSearchService().TransactionsCreditDebitBalance( fromDateTime, untilDateTime ); // create a collection of data var transactionsBalance = new List <TransactionsBalance>(); foreach (TransactionsCreditDebitBalanceContract contract in statistics) { transactionsBalance.Add( new TransactionsBalance() { Day = contract.Date, Credit = contract.CreditAmount, Debit = contract.DebitAmount } ); } // modify data type to make it of array type var xDataMonths = transactionsBalance.Select(i => i.Day).ToArray(); var yDataCredit = transactionsBalance.Select(i => new object[] { i.Credit.ToString("f0") }).ToArray(); var yDataDebit = transactionsBalance.Select(i => new object[] { i.Debit.ToString("f0") }).ToArray(); // instantiate an object of the High charts type var chart = new Highcharts("chart") // define the type of chart .InitChart(new Chart { DefaultSeriesType = ChartTypes.Line }) // overall Title of the chart .SetTitle(new Title { Text = "nor-port" }) // small label below the main Title .SetSubtitle(new Subtitle { Text = "Days from " + fromDateTime.ToShortDateString() + " until " + untilDateTime.ToShortDateString() }) // load the X values .SetXAxis(new XAxis { Categories = xDataMonths }) // set the Y title .SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Credit" } }) .SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Debit" } }) .SetTooltip( new Tooltip { Enabled = true, Formatter = @"function() { return '<b>'+ this.series.name +'</b><br/>'+ this.x +': '+ this.y; }" }) .SetPlotOptions(new PlotOptions { Line = new PlotOptionsLine { DataLabels = new PlotOptionsLineDataLabels { Enabled = true }, EnableMouseTracking = false } }) // load the Y values .SetSeries(new[] { new Series { Name = "Credit", Data = new Data(yDataCredit) }, new Series { Name = "Debit", Data = new Data(yDataDebit) } }); return(View(chart)); }