Beispiel #1
0
        private void Add_new_dish_Load(object sender, EventArgs e)
        {
            try
            {
                InputType.Items.Add("Main Dish");
                InputType.Items.Add("Drink");
                InputType.Items.Add("Cake");
                InputType.Items.Add("Salad");
                InputType.SelectedIndex = 0;

                if (!NewDish)
                {
                    Gb_View.Text = "Edit";
                    Entity.Dish dish = DataAccess.DishDao.Get_Dish_By_ID(Dish_Id);
                    inputName.Text          = dish.Name;
                    inputPrice.Text         = Convert.ToString(dish.Price);
                    InputDiscount.Text      = Convert.ToString(dish.Discount);
                    imputImg.Text           = dish.avatar;
                    InputDescription.Text   = dish.Description;
                    InputType.SelectedIndex = dish.Type - 1;
                }
                else
                {
                    Gb_View.Text = "New Dish";
                }
            }catch (Exception E)
            {
                MessageBox.Show("Error !!!");
            }
        }
Beispiel #2
0
 private void GV_ViewDish_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (GV_ViewDish.Columns[e.ColumnIndex].Name == "Editcol")
     {
         DataGridViewRow dr     = GV_ViewDish.Rows[e.RowIndex];
         Object          data   = dr.DataBoundItem;
         Entity.Dish     dish   = (Entity.Dish)data;
         int             ID     = dish.ID;
         Add_new_dish    update = new Add_new_dish(ID);
         update.Visible = true;
     }
 }