コード例 #1
0
 public bool tooLittleHoly(orderHechser x, dishHechser y)
 {
     if ((int)x > (int)y) //dish is less holy then order
     {
         return(true);    //meaning dish isnt holy enough
     }
     else
     {
         return(false);//meaning dish is good
     }
 }
コード例 #2
0
 private void buttonAdd_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         int id = int.Parse(textBoxID.Text);//add id from txtbox
         if (id < 1)
         {
             throw new Exception("Inaccurate ID");
         }
         string name = textBoxName.Text;//add name from txtbox
         if (name == "")
         {
             throw new Exception("Inaccurate Name");
         }
         int price = int.Parse(textBoxPrice.Text);//add price from txtbox
         if (price < 1)
         {
             throw new Exception("Inaccurate Price");
         }
         dishSize size = (dishSize)comboBoxSize.SelectedItem;//add size from combobox
         if ((int)size < 0)
         {
             throw new Exception("Lacking Size.");
         }
         dishHechser hechser = (dishHechser)comboBoxHechser.SelectedItem;//add hechsher from combobox
         if ((int)hechser < 0)
         {
             throw new Exception("Lacking Hechser.");
         }
         Dish currDish = new Dish(id, name, price, size, hechser);//adding dish
         //clear all fields
         textBoxName.Text             = "";
         textBoxID.Text               = "";
         textBoxPrice.Text            = "";
         comboBoxSize.SelectedItem    = null;
         comboBoxHechser.SelectedItem = null;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #3
0
 public Dish(int dishID, string dishName, double dishPrice, dishSize dishSizeDish, dishHechser dishHechserDish)
 {
     this.dishID          = dishID;
     this.dishName        = dishName;
     this.dishPrice       = dishPrice;
     this.dishSizeDish    = dishSizeDish;
     this.dishHechserDish = dishHechserDish;
 }