예제 #1
0
 private void btSaveFood_Click(object sender, EventArgs e)
 {
     if (tbFood.Text != "" && numPrice.Value > 0)
     {
         DTO.Food newFood = new DTO.Food(-1, tbFood.Text, Convert.ToInt32(cbCategory.SelectedValue.ToString()), (float)numPrice.Value);
         SanPhamDAO.InsertSanPham(newFood);
         DisplayProductTreeView();
     }
 }
예제 #2
0
 private void btUpdateFood_Click(object sender, EventArgs e)
 {
     if (tvProduct.SelectedNode.Text != null && tvProduct.SelectedNode.Parent != null)
     {
         if (tbFood.Text != "" && numPrice.Value > 0)
         {
             DTO.Food newFood = new DTO.Food(Convert.ToInt32(tvProduct.SelectedNode.Tag.ToString()), tbFood.Text, Convert.ToInt32(cbCategory.SelectedValue.ToString()), (float)numPrice.Value);
             SanPhamDAO.InsertSanPham(newFood);
             DisplayProductTreeView();
         }
         else
         {
             MessageBox.Show("Vui lòng nhập đầy đủ thông tin món ăn");
         }
     }
     else
     {
         MessageBox.Show("Vui lòng chọn 1 sản phẩm cần sửa");
     }
 }