private void button1_Click(object sender, EventArgs e) { mathtime doit = new mathtime(); int[] ores = { vel, sco, pyr, pla, omb, ker, jas, hem, hed, gne, dar, cro, spod, bis, ark, mer }; int[] estimate = doit.orePrice(ores); int x = 0; t_projected.Text = estimate[0].ToString(); p_projected.Text = estimate[1].ToString(); mex_projected.Text = estimate[2].ToString(); i_projected.Text = estimate[3].ToString(); n_projected.Text = estimate[4].ToString(); z_projected.Text = estimate[5].ToString(); meg_projected.Text = estimate[6].ToString(); mor_projected.Text = estimate[7].ToString(); t = estimate[0]; p = estimate[1]; mex = estimate[2]; iso = estimate[3]; n = estimate[4]; z = estimate[5]; meg = estimate[6]; mor = estimate[7]; double estTotal = doit.inStock(t, p, mex, iso, n, z, meg, mor); oreprice_lbl.Text = string.Format("{0:0,0.00}", estTotal); }
private void Report_Load(object sender, EventArgs e) { string connectionString = GetConnString(); try { using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); using (SqlCommand cmd = new SqlCommand("SELECT * FROM ore WHERE recent = 1", conn)) using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { ark = reader.GetInt32(0); bis = reader.GetInt32(1); cro = reader.GetInt32(2); dar = reader.GetInt32(3); gne = reader.GetInt32(4); hed = reader.GetInt32(5); hem = reader.GetInt32(6); jas = reader.GetInt32(7); ker = reader.GetInt32(8); mer = reader.GetInt32(9); omb = reader.GetInt32(10); pla = reader.GetInt32(11); pyr = reader.GetInt32(12); sco = reader.GetInt32(13); spod = reader.GetInt32(14); vel = reader.GetInt32(15); //conn.Close(); } } } } catch (SqlException ex) { MessageBox.Show(ex.ToString(), "Something broke", MessageBoxButtons.OK); } try { using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); using (SqlCommand cmd = new SqlCommand("SELECT * FROM minerals WHERE recent = 1", conn)) using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { t = reader.GetInt32(0); p = reader.GetInt32(1); mex = reader.GetInt32(2); iso = reader.GetInt32(3); n = reader.GetInt32(4); meg = reader.GetInt32(5); z = reader.GetInt32(6); mor = reader.GetInt32(7); } } } } catch (SqlException ex) { MessageBox.Show(ex.ToString(), "Something Broke", MessageBoxButtons.OK); } ark_Ore.Text = ark.ToString(); bis_ORE.Text = bis.ToString(); cro_ORE.Text = cro.ToString(); dar_ORE.Text = dar.ToString(); gne_ORE.Text = gne.ToString(); hed_ORE.Text = hed.ToString(); hem_ORE.Text = hem.ToString(); jas_ORE.Text = jas.ToString(); ker_ORE.Text = ker.ToString(); mer_ORE.Text = mer.ToString(); omb_ORE.Text = omb.ToString(); pla_ORE.Text = pla.ToString(); pyr_ORE.Text = pyr.ToString(); sco_ORE.Text = sco.ToString(); spo_ORE.Text = spod.ToString(); vel_ORE.Text = vel.ToString(); t_mineral.Text = t.ToString(); p_mineral.Text = p.ToString(); mex_mineral.Text = mex.ToString(); i_mineral.Text = iso.ToString(); n_mineral.Text = n.ToString(); meg_mineral.Text = meg.ToString(); z_mineral.Text = z.ToString(); mor_mineral.Text = mor.ToString(); mathtime doit = new mathtime(); //int[] minerals = { t, p, mex, iso, n, meg, z, mor }; double iskstock = doit.inStock(t, p, mex, iso, n, meg, z, mor); //double iskstock = doit.inStock(minerals); //t_projected.Text = estimate[0].ToString(); iskstock_lbl.Text = string.Format("{0:0,0.00}", iskstock); }