private void bunifuFlatButton1_Click(object sender, EventArgs e) { activity = "add"; itemCode = new Activities().getNextItemCode(); ItemOptions1 item = new ItemOptions1(activity, itemCode); panel1.Controls.Clear(); item.Top = 10; item.Left = 10; panel1.Controls.Add(item); }
private void bunifuImageButton1_Click(object sender, EventArgs e) { if (activity == "add") { bool y = new Activities().addNewItem(txtItemCode.Text, txtName.Text, txtPrice.Text, txtSize.Text, ""); if (y == true) { txtItemCode.Text = (int.Parse(ItemCode) + 1).ToString(); MessageBox.Show("item added"); } else { MessageBox.Show("something wrong"); } } else if (activity == "update") { bool y = new Activities().addNewItem(txtItemCode.Text, txtName.Text, txtPrice.Text, txtSize.Text, ""); if (y == true) { MessageBox.Show("item added"); } else { MessageBox.Show("something wrong"); } } else { } if (activity == "delete") { MySqlDataReader rd; MySqlConnection conn; string connetionString = null; connetionString = "server=localhost;database=restauretdb;uid=indunil;pwd=123;"; conn = new MySqlConnection(connetionString); conn.Open(); try { MySqlCommand deletecmd = new MySqlCommand("delete from itemlist_tb WHERE itemCode='" + txtItemCode.Text + "'", conn); deletecmd.ExecuteNonQuery(); MessageBox.Show("Deleted!"); conn.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
private void bunifuThinButton21_Click(object sender, EventArgs e) { username = txtUser.Text; password = txtPassword.Text; InterfaceActivities x = new Activities(); bool userStatus = x.login(username, password); if (userStatus == true) { new Form1(username).Show(); this.Hide(); } else { //for set Focused false ActiveControl = null; txtPassword.BorderColorIdle = Color.Red; txtUser.BorderColorIdle = Color.Red; } }
private void bunifuImageButton1_Click_1(object sender, EventArgs e) { if (activity == "add") { bool y = new Activities().addNewItem(txtItemCode.Text, txtName.Text, txtPrice.Text, txtSize.Text, ""); if (y == true) { MessageBox.Show("item added"); } else { MessageBox.Show("something wrong"); } } else if (activity == "update") { } else { } }