private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBox1.Text) || string.IsNullOrEmpty(textBox2.Text) || string.IsNullOrEmpty(textBox3.Text) || string.IsNullOrEmpty(textBox4.Text)) { MessageBox.Show("One or more required fields are missing", "Missing Field", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } Inventory inventory = new Inventory(textBox1.Text, textBox2.Text, float.Parse(textBox3.Text), int.Parse(textBox4.Text), db.con); inventory.addItem(); inventory.addItemDate(dRow[comboBox1.SelectedIndex].ItemArray.GetValue(0).ToString(), dRow[comboBox1.SelectedIndex].ItemArray.GetValue(1).ToString(), db.con); this.DialogResult = DialogResult.OK; this.Close(); }
private void button2_Click(object sender, EventArgs e) { if(string.IsNullOrEmpty(textBox5.Text) || string.IsNullOrEmpty(textBox2.Text) || string.IsNullOrEmpty(textBox3.Text) || string.IsNullOrEmpty(textBox4.Text)) { MessageBox.Show("One or more required fields are missing", "STOP RIGHT THERE CRIMINAL SCUM!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (MessageBox.Show("Are you sure you want to update this item's information?", "Confirm Update", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK) { this.DialogResult = DialogResult.OK; } else return; Inventory inventory = new Inventory(); inventory.updateItem(textBox5.Text, textBox2.Text, textBox3.Text, textBox4.Text, dRow[comboBox1.SelectedIndex].ItemArray.GetValue(0).ToString(), db.con); }
private void button1_Click(object sender, EventArgs e) { try { int temp = Convert.ToInt32(textBox2.Text); if (Convert.ToInt32(textBox2.Text) == 0 || Convert.ToInt32(textBox2.Text) < 0) { MessageBox.Show("Please provide quantity."); return; } } catch (Exception) { if (textBox2.Text == string.Empty) { MessageBox.Show("Please provide quantity."); return; } else { MessageBox.Show("Please provide number only."); textBox2.Text = "0"; return; } } if (int.Parse(textBox2.Text) > int.Parse(dRow[comboBox1.SelectedIndex].ItemArray.GetValue(4).ToString())) { MessageBox.Show("Not enough items in inventory", "STOP RIGHT THERE CRIMINAL SCUM!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } Inventory inventory = new Inventory(); inventory.addsale(dRow[comboBox1.SelectedIndex].ItemArray.GetValue(0).ToString(), dRow[comboBox1.SelectedIndex].ItemArray.GetValue(1).ToString(), dRow[comboBox1.SelectedIndex].ItemArray.GetValue(2).ToString(), textBox1.Text, textBox2.Text, textBox3.Text, this.employee, DateTime.Now, db.con); this.DialogResult = DialogResult.OK; this.Close(); }
public EditItem(Inventory parent) { InitializeComponent(); inv = parent; conn = new MySqlConnection("Server=localhost;Database=dogpound;Uid=root;Pwd=root;"); }