Ejemplo n.º 1
0
 // GET: CTransaction
 public ActionResult Index()
 {
     if (Session["user"] != null)
     {
         CCryptoTranList trans = new CCryptoTranList();
         trans.Load();
         return(View(trans));
     }
     return(RedirectToAction("Login", "Login"));
 }
Ejemplo n.º 2
0
        private void btnExpClick2(object sender, RoutedEventArgs e)
        {
            try
            {
                CCryptoTranList c = new CCryptoTranList();
                c.Export();

                MessageBox.Show("Export Successful", "Yay!");
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 3
0
        public void Refresh()
        {
            decimal runningTotal = 0;

            try
            {
                CStockList stocks = new CStockList();

                stocks.Load();
                dgStocks.ItemsSource = stocks;

                //get total
                foreach (var s in stocks)
                {
                    CTransaction t = new CTransaction();
                    runningTotal = t.GetTotal(s.Ticker) + runningTotal;
                }

                lblTotal.Content = runningTotal.ToString("c2");

                dgStocks.Columns[4].Header     = "Quantity";
                dgStocks.Columns[5].Header     = "Position Value";
                dgStocks.Columns[0].Visibility = Visibility.Hidden;
                dgStocks.Columns[1].Visibility = Visibility.Hidden;
            }
            catch (Exception ex)
            {
            }


            try
            {
                CTransactionList trans = new CTransactionList();
                trans.Load();

                dgTransactions_Copy.ItemsSource = trans;

                dgTransactions_Copy.Columns[0].Header = "Stock";
                dgTransactions_Copy.Columns[3].Header = "Date of Transaction";
                dgTransactions_Copy.Columns[4].Header = "Buy";
                dgTransactions_Copy.Columns[5].Header = "Quantity";
                dgTransactions_Copy.Columns[6].Header = "Price Per Share";

                dgTransactions_Copy.Columns[1].Visibility = Visibility.Hidden;
                dgTransactions_Copy.Columns[2].Visibility = Visibility.Hidden;
            }
            catch (Exception ex)
            {
            }

            try
            {
                CCryptoList stocks = new CCryptoList();

                stocks.Load();
                dgCrypto1.ItemsSource = stocks;

                //get total
                foreach (var s in stocks)
                {
                    CCryptoTran t = new CCryptoTran();
                    decimal.TryParse(t.GetTotal(s.Ticker).ToString(), out decimal g);
                    runningTotal = g + runningTotal;
                }

                lblTotal.Content = runningTotal.ToString("c2");

                dgCrypto1.Columns[4].Header     = "Quantity";
                dgCrypto1.Columns[5].Header     = "Position Value";
                dgCrypto1.Columns[0].Visibility = Visibility.Hidden;
                dgCrypto1.Columns[1].Visibility = Visibility.Hidden;
            }
            catch (Exception ex)
            {
            }

            try
            {
                CCryptoTranList crypto = new CCryptoTranList();
                crypto.Load();

                dgCrypto_Copy.ItemsSource = crypto;

                dgCrypto_Copy.Columns[0].Header = "Currency";
                dgCrypto_Copy.Columns[3].Header = "Transaction Date";
                dgCrypto_Copy.Columns[4].Header = "Buy";
                dgCrypto_Copy.Columns[5].Header = "Quantity";
                dgCrypto_Copy.Columns[6].Header = "Price Per Share";

                dgCrypto_Copy.Columns[1].Visibility = Visibility.Hidden;
                dgCrypto_Copy.Columns[2].Visibility = Visibility.Hidden;
            }
            catch (Exception)
            {
            }
        }