// GET: Reports public ActionResult Index() { List <DisplaySales> displaySales = new List <DisplaySales>(); float floatVal = 0; MySqlConnection cnn; DbInterface dbInterface = new DbInterface(); cnn = dbInterface.connect(); try { cnn.Open(); MySqlCommand mySqlCommand = cnn.CreateCommand(); mySqlCommand.CommandText = EndOFDayReport; mySqlCommand.Parameters.AddWithValue("@saleDate", DateTime.Now.ToString("yyyy-MM-dd")); mySqlCommand.Parameters.AddWithValue("@locationID", 1); MySqlDataReader reader = mySqlCommand.ExecuteReader(); int i = 1; while (reader.Read()) { DisplaySales displaySale = new DisplaySales(); displaySale.rowID = i.ToString(); displaySale.salesID = reader["salesID"].ToString(); float.TryParse(reader["tutar"].ToString(), out floatVal); displaySale.tutar = floatVal.ToString("N2"); float.TryParse(reader["paidTutar"].ToString(), out floatVal); if (floatVal == 0) { displaySale.paidTutar = displaySale.tutar; } else { displaySale.paidTutar = floatVal.ToString("N2"); } displaySales.Add(displaySale); i = i + 1; } reader.Close(); mySqlCommand.Dispose(); } catch (Exception ex) { ModelState.AddModelError("VeriTabani", "Veri Tabanı Erişim Hatası"); logger log = new logger(); log.write_to_log("Index", ex.ToString()); } if (cnn != null) { cnn.Close(); } return(View()); }
private void bthOpenGraph_Click(object sender, EventArgs e) { var displaySalesGraph = new DisplaySales(); displaySalesGraph.Show(); }