private void bbiEdit_ItemClick(object sender, ItemClickEventArgs e) { if (pfIDSelected != "") { EditPetFood epf = new EditPetFood(); var db = new PetStoreEntities(); var pf = db.PetFoods.Find(pfIDSelected); var type = db.Types.Find(pf.t_id); List <PetStore.Type> typeList = db.Types.ToList(); foreach (var item in typeList) { epf.te_Type.Properties.Items.Add(item.t_name); } epf.te_Type.SelectedItem = type.t_name; //set data of item edit to Edit form epf.te_FoodID.Text = pf.pf_id; epf.te_FoodName.Text = pf.pf_name; epf.te_FoodPrice.Text = pf.pf_prices + ""; epf.te_FoodSalePrice.Text = pf.pf_salePrice + ""; epf.te_FoodStatus.SelectedItem = pf.pf_status; epf.te_FoodAmount.Text = pf.pf_amount + ""; //epf.te_Type.Text = type.t_name; //show Edit form epf.ShowDialog(); } else { XtraMessageBox.Show("Please choose a food item to edit !!!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void bbiEdit_ItemClick(object sender, ItemClickEventArgs e) { if (pfIDSelected != "") { EditPetFood epf = new EditPetFood(); var db = new PetStoreEntities(); var pf = db.PetFoods.Find(pfIDSelected); epf.te_FoodID.Text = pf.pf_id; epf.te_FoodName.Text = pf.pf_name; //epf.te_FoodImage.Text = pf.pf_image; epf.te_FoodPrice.Text = pf.pf_prices + ""; epf.te_FoodSalePrice.Text = pf.pf_salePrice + ""; epf.te_FoodStatus.SelectedItem = pf.pf_status; epf.te_FoodAmount.Text = pf.pf_amount + ""; epf.ShowDialog(); } else { XtraMessageBox.Show("Please choose a food item to restore !!!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }