///SqlCommand cmd; public S_Jewelry() { try { DB_CONNECTION dbObj = new DB_CONNECTION(); conn = dbObj.GetConnection(); } catch (Exception ex) { MessageBox.Show("Can't Open Connection!! " + ex); } InitializeComponent(); pictureBoxes = new PictureBox[9]; pictureBoxes[0] = pictureBox1; pictureBoxes[1] = pictureBox2; pictureBoxes[2] = pictureBox3; pictureBoxes[3] = pictureBox4; pictureBoxes[4] = pictureBox5; pictureBoxes[5] = pictureBox6; pictureBoxes[6] = pictureBox7; pictureBoxes[7] = pictureBox8; pictureBoxes[8] = pictureBox9; picturePaths = new string[pictureBoxes.Length]; pictureIsNew = new bool[pictureBoxes.Length]; for (int i = 0; i < pictureIsNew.Length; ++i) { pictureIsNew[i] = false; } }
public S_Gems() { try { DB_CONNECTION dbObj = new DB_CONNECTION(); conn = dbObj.getConnection(); } catch (Exception ex) { MessageBox.Show("Can't Open Connection!! " + ex); } InitializeComponent(); // create array of pixtureboxes so that it is easier to iterate pictureBoxes = new PictureBox[10]; pictureBoxes[0] = pictureBox1; pictureBoxes[1] = pictureBox2; pictureBoxes[2] = pictureBox3; pictureBoxes[3] = pictureBox4; pictureBoxes[4] = pictureBox5; pictureBoxes[5] = pictureBox6; pictureBoxes[6] = pictureBox7; pictureBoxes[7] = pictureBox8; pictureBoxes[8] = pictureBox9; pictureBoxes[9] = pictureBox10; picturePaths = new string[pictureBoxes.Length]; pictureIsNew = new bool[pictureBoxes.Length]; for (int i = 0; i < pictureIsNew.Length; ++i) { pictureIsNew[i] = false; } cmbStockType.SelectedIndex = 0; pictureBorders = new Label[pictureBoxes.Length]; pictureBorders[0] = currentimage1; pictureBorders[1] = currentimage2; pictureBorders[2] = currentimage3; pictureBorders[3] = currentimage4; pictureBorders[4] = currentimage5; pictureBorders[5] = currentimage6; pictureBorders[6] = currentimage7; pictureBorders[7] = currentimage8; pictureBorders[8] = currentimage9; pictureBorders[9] = currentimage10; foreach (var border in pictureBorders) { border.Visible = false; } }
public In_certi() { try { DB_CONNECTION dbObj = new DB_CONNECTION(); conn = dbObj.getConnection(); } catch (Exception ex) { MessageBox.Show("Can't Open Connection!! " + ex); } InitializeComponent(); CalculateTotal(); using (var cmd = new SqlCommand("SELECT * FROM dbo.[F_Currency]", conn)) { using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { cmbCurrency1.Items.Add(reader["FC_TYPE"].ToString()); cmbCurrency2.Items.Add(reader["FC_TYPE"].ToString()); cmbCurrency3.Items.Add(reader["FC_TYPE"].ToString()); } } } cmbCurrency1.SelectedIndex = 0; cmbCurrency2.SelectedIndex = 1; cmbCurrency3.SelectedIndex = 2; // btnFCupdate.Visible = false; using (var cmd = new SqlCommand("SELECT * FROM dbo.[Card_Vendor]", conn)) { using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { cmbCardTyp.Items.Add(reader["Vendor"].ToString()); } } } cmbPaymentTyp.SelectedIndex = 0; for (int i = 0; i < dgvItem.Columns.Count; ++i) { dt.Columns.Add(dgvItem.Columns[i].HeaderText); } dgvItem.AutoGenerateColumns = true; dgvItem.Columns.Clear(); dgvItem.DataSource = dt; }
private void Updatebt_Click(object sender, EventArgs e) { DB_CONNECTION x = new DB_CONNECTION(); SqlConnection conn = x.getConnection(); String UpdateQuery = "Update F_Currency set FC_Rate ='" + textBox1.Text + "' where FC_TYPE ='" + comboBox1.Text + "';"; SqlDataAdapter execute = new SqlDataAdapter(UpdateQuery, conn); execute.SelectCommand.ExecuteNonQuery(); MessageBox.Show("You've updated successfully!", "Successful Message", MessageBoxButtons.OK, MessageBoxIcon.Information); conn.Close(); this.Hide(); }
public NewUser() { try { DB_CONNECTION dbObj = new DB_CONNECTION(); conn = dbObj.GetConnection(); } catch (Exception ex) { MessageBox.Show("Can't Open Connection!! " + ex); } InitializeComponent(); }
public Status_of_Stocks() { try { DB_CONNECTION dbObj = new DB_CONNECTION(); conn = dbObj.GetConnection(); } catch (Exception ex) { MessageBox.Show("Can't Open Connection!! " + ex); } InitializeComponent(); DisplayData(); }
public Invoice_Certificate() { try { DB_CONNECTION dbObj = new DB_CONNECTION(); conn = dbObj.getConnection(); } catch (Exception ex) { MessageBox.Show("Can't Open Connection!! " + ex); } InitializeComponent(); DisplayData(); }
public Foriegn_Currency_Update() { InitializeComponent(); using (var conn = new DB_CONNECTION().getConnection()) { using (var cmd = new SqlCommand("SELECT [FC_TYPE] FROM dbo.[F_Currency]", conn)) { using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { comboBox1.Items.Add(reader["FC_TYPE"].ToString()); } } } } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { try { DB_CONNECTION x = new DB_CONNECTION(); using (SqlConnection conn = x.getConnection()) { Console.WriteLine(comboBox1.Text); using (var command = new SqlCommand("SELECT [FC_RATE] FROM dbo.[F_Currency] where [FC_TYPE]=@FC_Type", conn)) { //Combo command.Parameters.AddWithValue("FC_Type", comboBox1.Text); textBox1.Text = command.ExecuteScalar().ToString(); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public Stocks_Jewelry() { //this.showUser = showUser; try { DB_CONNECTION dbObj = new DB_CONNECTION(); conn = dbObj.GetConnection(); } catch (Exception ex) { MessageBox.Show("Can't Open Connection!! " + ex); } InitializeComponent(); //dataGridView1.Columns.Clear(); DisplayData(); }