private void btnUpdateProd_Click(object sender, EventArgs e) { try { if (txtID.Text != "" && txtName.Text != "" && txtPrice.Text != "") { var mess = MessageBox.Show("Vui lòng thêm thông tin sản phẩm", "Thông Báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (mess == DialogResult.Yes) { ProductDAO.Instance.Add(int.Parse(txtID.Text), txtName.Text, int.Parse(txtPrice.Text)); InforProduct ifp = new InforProduct(); ifp.id = int.Parse(txtID.Text); ifp.nameProd = txtName.Text; this.Hide(); ifp.ShowDialog(); } else { MessageBox.Show("Thêm sản phẩm không thành công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Vui lòng không bỏ trống", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception) { MessageBox.Show("Bạn đã bị trùng ID sản phẩm", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void bunifuButton5_Click_1(object sender, EventArgs e) { InforProduct dis = new InforProduct(); dis.id = id; dis.nameProd = nameProduct; dis.ShowDialog(); }
private void btnAddProd_Click(object sender, EventArgs e) { if (txtName.Text != "" && txtPrice.Text != "") { ProductDAO.Instance.Update(id, txtName.Text, int.Parse(txtPrice.Text)); var mess = MessageBox.Show("Sủa thành công, bạn có muốn sửa chi tiết món ăn", "Thông Báo", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (mess == DialogResult.Yes) { this.Hide(); InforProduct ifp = new InforProduct(); ifp.ShowDialog(); } else { this.Hide(); } } else { MessageBox.Show("Không được bỏ trống", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } }