Beispiel #1
0
 /// <summary>
 /// בנאי שיופעל בעמוד הוספת מנה
 /// </summary>
 public addDishWindows()
 {
     InitializeComponent();
     fillSizeKosherCombobox();        //עידכון שדה הבחירה של גודל וכשרויות
     newDish = new BE.Dish();
     orderGrid.DataContext = newDish; //חיבור טופס המנה לאובייקט מנה
 }
Beispiel #2
0
 /// <summary>
 /// בדיקת גיל מינימלי
 /// </summary>
 /// <param name="age"></param>
 ///
 private void checkHighPrice(BE.Dish dish)
 {
     if (dish.priceOfSingleDish > dish.MAX_PRICE_FOR_DISH)
     {
         throw new Exception("יקר מידי, אין מצב שיקנו");
     }
 }
Beispiel #3
0
        private void dishNumberComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            object a = dishNumberComboBox.SelectedValue;

            BE.Dish di = a as BE.Dish;
            d.dishNumber = di.dishNumber;
        }
 public addDishWindow()
 {
     InitializeComponent();
     d = new BE.Dish();
     this.DataContext = d;
     bl = BL.FactoryBL.GetBL();
     hechsherComboBox.ItemsSource = Enum.GetValues(typeof(BE.hechsher));
     dishSizeComboBox.ItemsSource = Enum.GetValues(typeof(BE.size));
 }
        private void dishNumberComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            object a = dishNumberComboBox.SelectedValue;

            BE.Dish b = a as BE.Dish;
            //if (a == null)
            //    throw new Exception("must select dish number first");

            Od.dishNumber = b.dishNumber;
        }
Beispiel #6
0
        public DeleteDish()
        {
            InitializeComponent();
            bl   = BL.FactoryBL.getBL();
            dish = new BE.Dish();
            dishNameComboBox.ItemsSource = from item in bl.getAllDish()
                                           select item.dishName;

            this.DataContext = dish;
        }
Beispiel #7
0
        public AddDish()
        {
            InitializeComponent();

            dish = new BE.Dish();
            this.gridAddDish.DataContext = dish;
            bl = BL.FactoryBL.getBL();

            dishSizeComboBox.ItemsSource      = Enum.GetValues(typeof(BE.Size));
            this.hechsherComboBox.ItemsSource = Enum.GetValues(typeof(BE.kosherLevel));
        }
        /// <summary>
        /// כאשר ילחצו על שורה בטבלה הפונקציה תפתח את חלון עריכת מנות
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DishUpdate_Click(object sender, MouseButtonEventArgs e)
        {
            BE.Dish dish = new BE.Dish();
            dish = (BE.Dish)(dishDataGrid.SelectedItem);

            Window AddDishWindows = new addDishWindows(dish.dishID);    // שליחת מספר המנה לחלון עריכת מנה

            (AddDishWindows as addDishWindows).refresh += refreshTable; //


            AddDishWindows.Show();
        }
Beispiel #9
0
        public UpdateDish()
        {
            InitializeComponent();
            dish = new BE.Dish();
            this.gridUpdateDish.DataContext = dish;
            bl = BL.FactoryBL.getBL();
            dishIdComboBox.ItemsSource = from item in bl.getAllDish()
                                         select item.dishId;

            hechsherComboBox.ItemsSource = Enum.GetValues(typeof(BE.kosherLevel));
            dishSizeComboBox.ItemsSource = Enum.GetValues(typeof(BE.Size));
        }
Beispiel #10
0
 public updateDishWindow()
 {
     InitializeComponent();
     d = new BE.Dish();
     this.DataContext = d;
     bl = BL.FactoryBL.GetBL();
     hechsherComboBox.ItemsSource         = Enum.GetValues(typeof(BE.hechsher));
     dishSizeComboBox.ItemsSource         = Enum.GetValues(typeof(BE.size));
     dishNumberComboBox.ItemsSource       = bl.listDishes();
     dishNumberComboBox.DisplayMemberPath = "dishNumber";
     dishNumberComboBox.DataContext       = d.dishNumber;//brirat mechdal
 }
Beispiel #11
0
 public void addDish(BE.Dish new_dish)
 {
     try
     {
         checkDoubleName(new_dish, new_dish.dishName);
         checkHighPrice(new_dish);
         myDal.addDish(new_dish);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #12
0
        private void dishNumberComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            object a = dishNumberComboBox.SelectedValue;

            BE.Dish b = a as BE.Dish;
            if (a == null)
            {
                throw new Exception("must select branch first");
            }
            d.dishNumber = b.dishNumber;
            d            = b;
            DataContext  = b;
        }
Beispiel #13
0
 private void AddDishButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         bl.addDish(dish);
         MessageBox.Show("the dish \"" + dish.dishName + "\" is added to the list", "");
         dish = new BE.Dish();
         this.gridAddDish.DataContext = dish;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #14
0
 private void UpdatDishButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         bl.updateDish(dish);
         MessageBox.Show("the dish \"" + dish.dishName + "\" updated  ", " Successfully updated! ");
         dish = new BE.Dish();
         this.gridUpdateDish.DataContext = dish;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #15
0
 public void deleteDish(BE.Dish dish)
 {
     try
     {
         if (myDal.getListOfAllDishOrders().Exists(orderDish => orderDish.dishID == dish.dishID))
         {
             throw new Exception("המנה מוזמנת אצל לקוחות, אל תמחק !!!");
         }
         myDal.deleteDish(dish);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #16
0
        /// <summary>
        /// בנאי שיופעל בעמוד עריכה
        /// </summary>
        /// <param name="dishId">מספר המנה אותה נערוך</param>
        public addDishWindows(uint dishId)
        {
            InitializeComponent();
            this.updateDishId = dishId; //קבלת מספר המנה שרוצים לעדכן
            fillSizeKosherCombobox();   //עידכון שדה הבחירה של גודל וכשרויות

            newDish = new BE.Dish( );
            newDish = mybl.getDishById(dishId); //חיבור טופס המנה לאובייקט מנה



            orderGrid.DataContext = newDish;

            editValueTitleButtom();//עריכת כותרת העמוד+כפתור השליחה שיתאימו לעמוד עריכה
        }
Beispiel #17
0
 public void updateDish(BE.Dish dish, string oldName)
 {
     try
     {
         if (dish.dishName != oldName)//אם שונה שם המנה לבדוק שהשם לא מופיע כבר
         {
             checkDoubleName(dish, dish.dishName);
         }
         checkHighPrice(dish);
         myDal.updateDish(dish);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #18
0
        static void Main(string[] args)
        {
            BL.IBL myBl = BL.FactoryBL.getBL();

            BE.Branch      branch      = new BE.Branch();
            BE.Client      client      = new BE.Client();
            BE.Dish        dish        = new BE.Dish();
            BE.Order       order       = new BE.Order();
            BE.OrderedDish orderedDish = new BE.OrderedDish();

            Console.WriteLine("Hello, this is a check");
            ConsoleKeyInfo input = new ConsoleKeyInfo();
            int            choice;

            while (true)
            {
                Console.WriteLine("enter your choice:");
                input  = Console.ReadKey();
                choice = int.Parse(input.KeyChar.ToString());

                switch (choice)
                {
                case 0:
                    break;

                case 3:
                    try
                    {
                        branch = init_branch(10, "g. mordechai", "vaad leumi", 123, "moshe", 12, 20, BE.Kosher.GLAT);
                        order  = init_order(1, DateTime.Now, 2, 3, false);
                        myBl.addOrder(order);
                        orderedDish = init_order_dish(1, 2, 3, BE.Kosher.GLAT, BE.SizeOfDish.LARGE);
                        myBl.addOrderedDish(orderedDish, order, branch);
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                    break;

                default:
                    Console.WriteLine("error");
                    break;
                }
            }
        }
Beispiel #19
0
        private void UPDATE_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                bl.SetDish(d);
                MessageBox.Show("Dish number: " + d.dishNumber + " was updated successfully");
                //   MessageBox.Show("עודכנה בהצלחה"+d.dishNumber + " מנה ");

                d = new BE.Dish();
                this.DataContext             = d;
                hechsherComboBox.DataContext = "";
                dishSizeComboBox.DataContext = "";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 private void adddishbutton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         bl.AddDish(d);
         MessageBox.Show("Dish number: " + d.dishNumber + " was added successfully");
         //if(ResourceDictionary.Equals("EnglishDictionary.xaml"))
         // MessageBox.Show("הוספה בהצלחה"+d.dishNumber + " מנה ");
         d = new BE.Dish();
         this.DataContext             = d;
         hechsherComboBox.DataContext = "";
         dishSizeComboBox.DataContext = "";
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        /// <summary>
        /// מחיקת המנות שנבחרו
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DishDelete_Click(object sender, RoutedEventArgs e)
        {
            var cellInfos = dishDataGrid.SelectedItems;
            int count     = dishDataGrid.SelectedItems.Count;

            for (int i = 0; i < count; i++)
            {
                BE.Dish d = (BE.Dish)dishDataGrid.SelectedItems[i];
                try
                {
                    mybl.deleteDish(d);
                }
                catch (Exception error)
                {
                    MessageBox.Show(error.Message);
                }
            }
            refreshTable();//ריענון הטבלה
        }
        /// <summary>
        /// הפונקציה תוסיף אובייקט "מנסה מוזמנת" לרשימה זמנית של כל המנות המוזמנות, ותציג אותה בטבלה המתאימה
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addDishToOrderClick(object sender, RoutedEventArgs e)
        {
            try
            {
                BE.OrderedDish tempOrderDish = new BE.OrderedDish();                                         //object to build the new orderDish accoring to his inseret
                BE.Dish        tempDish      = mybl.getDishByName(listDishCombobox.SelectedItem.ToString()); //get the object dish according to name


                buildOrderDish(tempOrderDish, tempDish.dishID);                                                                                     // build the temp order dish according to the form
                mybl.checkKosherSizeLevel(tempOrderDish, tempDish.dishSize, tempDish.dishLevelOfKosher);                                            //check kosher& size for the new dish
                double addedPriceUpdate = mybl.calculatePrice(mybl.getDishById(tempDish.dishID).priceOfSingleDish, tempOrderDish.numberOfSameDish); //חישוב מחיר המנה שהתווסף
                mybl.maxOrderPayment(double.Parse(totalPrice.Text) + addedPriceUpdate);                                                             //בדיקה האם המחיר שהיה +החדש גבוה מידי
                updatePriceTextBox(addedPriceUpdate);                                                                                               // update the price on the correct text
                addOrderDishForList(tempOrderDish);                                                                                                 //add the order dish to the temp list , to show on the table
                refresh_addedDishesTable();                                                                                                         // refresh the table that show all the dish
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message);
            }
        }
Beispiel #23
0
 private void DeleteDishButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         BE.Dish di = new BE.Dish();
         di = bl.getAllDish().FirstOrDefault(d => d.dishName == dish.dishName);
         if (di == null)
         {
             throw new Exception("this dish doesn't exist");
         }
         else
         {
             bl.deleteDish(di.dishId);
         }
         MessageBox.Show("the dish \"" + dish.dishName + "\" Deleted from the list", "");
         this.DataContext             = dish;
         dishNameComboBox.ItemsSource = from item in bl.getAllDish()
                                        select item.dishName;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #24
0
 private void dishIdComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     dish = bl.getAllDish(d => d.dishId == dish.dishId).FirstOrDefault();
     this.gridUpdateDish.DataContext = dish;
 }