Пример #1
0
 /// <summary>
 /// method wich works when the user chose ingredient from the list
 /// the method will fill the name field with the name of the chosen ingredient
 /// </summary>
 private void lstIngredients_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (Checks.IsItemSelected(lstIngredients))
     {
         chosenIngredientName = txtIngredientName.Text = lstIngredients.SelectedItem.ToString();
     }
 }
Пример #2
0
 /// <summary>
 /// method wich works when the user select employee from the employees list
 /// the method will fill all the fields with the selected emplyee details
 /// </summary>
 private void lstEmployees_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (Checks.IsItemSelected(lstEmployees))
     {
         btnUpdateEmployee.Enabled = true;
         btnAddEmployee.Enabled    = false;
         FillSelectedEmployeeData();
     }
 }
Пример #3
0
 /// <summary>
 /// method wich works when the user change the chosen event in the events list
 /// the method will shoe the pressed event details on the details table
 /// </summary>
 private void lstEventsList_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (Checks.IsItemSelected(lstEventsList))
     {
         btnEditEvent.Enabled = true;
         newEvent             = eventsToDay[lstEventsList.SelectedIndex];
         FillExistEventDataGrid();
     }
 }
Пример #4
0
 /// <summary>
 /// method wich works when the user select product from the products list
 /// the method will fill all the fields with the selected product details
 /// </summary>
 private void lstProductList_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (Checks.IsItemSelected(lstProductList))
     {
         btnAddProduct.Enabled    = false;
         btnUpdateProduct.Enabled = true;
         FillSelectedProductData();
     }
 }
Пример #5
0
 /// <summary>
 /// method wich works when the user select wine from the wines list
 /// the method will fill all the fields with the selected wine details
 /// </summary>
 private void lstWineList_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (Checks.IsItemSelected(lstWineList))
     {
         btnAddWine.Enabled    = false;
         btnUpdateWine.Enabled = true;
         FillSelectedWineData();
     }
 }
Пример #6
0
 /// <summary>
 /// method wich works when the user select customer from the customers list
 /// the method will fill all the fields with the selected customer details
 /// </summary>
 private void lstCustomers_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (Checks.IsItemSelected(lstCustomers))
     {
         btnUpdateCustoemr.Enabled = true;
         btnAddCustomer.Enabled    = false;
         FillSelectedCustomerData();
     }
 }
Пример #7
0
 /// <summary>
 /// method wich works when the user press on "update ingredient" button
 /// the method will update the chosen ingredient name in the data base
 /// </summary>
 private void btnUpdateIngredient_Click(object sender, EventArgs e)
 {
     if (Checks.IsItemSelected(lstIngredients))
     {
         int idToUpdate = GetIngredientIdByName(chosenIngredientName);
         db.UpdateIngredientById(txtIngredientName.Text, idToUpdate);
         MessageBox.Show("המרכיב עודכן בהצלחה בהצלחה!");
         FillIngredientsList();
     }
     else
     {
         MessageBox.Show("בחר מרכיב מהרשימה ואז לחץ על עדכן מרכיב");
     }
 }
Пример #8
0
 /// <summary>
 /// method wich works when the user press on "edit event" button
 /// the method will pass to events tab and put all the chosen events
 /// details on the fields
 /// </summary>
 private void btnEditEvent_Click(object sender, EventArgs e)
 {
     if (Checks.IsItemSelected(lstEventsList))
     {
         tcMain.SelectedTab     = tpEvnets;
         btnUpdateEvent.Enabled = true;
         btnAddEvent.Enabled    = false;
         FillFieldsWithExistEvent();
     }
     else
     {
         MessageBox.Show("בחר אירוע מהרשימה ואז לחץ על עריכת אירוע!");
     }
 }
Пример #9
0
        /// <summary>
        /// method wich works when the uset chose customer from the list
        /// the method will set the selected customer properrty to the chosen one and close the form
        /// </summary>
        private void lstCustomers_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (Checks.IsItemSelected(lstCustomers))
            {
                string[] words            = lstCustomers.SelectedItem.ToString().Split('|');
                int      chosenCustomerId = int.Parse(words[0]);
                bool     flag             = true;

                for (int i = 0; i < customers.Length && flag; i++)
                {
                    if (customers[i].CustomerId == chosenCustomerId)
                    {
                        selctedCustomer = customers[i];
                        flag            = false;
                    }
                }
                this.Close();
            }
        }
Пример #10
0
 /// <summary>
 /// Method to remove ingredient from the database
 /// </summary>
 private void btnRemoveIngredient_Click(object sender, EventArgs e)
 {
     if (Checks.IsItemSelected(lstIngredients))
     {
         if (db.IsIngredientPartOfDish(GetIngredientIdByName(txtIngredientName.Text)))
         {
             MessageBox.Show("המרכיב שנבחר הוא חלק ממנה, לא ניתן להסיר אותו!");
         }
         else
         {
             db.RemoveIngredientByName(chosenIngredientName);
             MessageBox.Show("המרכיב נמחק בהצלחה!");
             FillIngredientsList();
         }
     }
     else
     {
         MessageBox.Show("בחר מרכיב מהרשימה ואז לחץ על הסר מרכיב");
     }
 }