コード例 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (t_Name.Text == string.Empty || t_Price.Text == string.Empty || comboBox1.SelectedItem.ToString() == string.Empty)
     {
         MessageBox.Show("Please Enter Values");
     }
     else
     {
         ItemListService itemListService = new ItemListService();
         Item            item            = itemListService.GetById(id);
         item.Id              = id;
         item.ItemName        = t_Name.Text;
         item.ItemPrice       = Convert.ToSingle(t_Price.Text);
         item.ItemDescription = t_Description.Text;
         item.Category_Name   = comboBox1.SelectedItem.ToString();
         int result = itemListService.Update(item);
         if (result > 0)
         {
             MessageBox.Show("Item Updated.");
             UpdateGridView();
         }
         else
         {
             MessageBox.Show("Error");
         }
     }
 }