/// <summary>
 /// בנאי שיופעל לחלון הוספת מסעדה
 /// </summary>
 public addBranchWindows()
 {
     InitializeComponent();
     newBranch = new BE.Branch();
     branchGrid.DataContext = newBranch;
     ValueTitleButtom();//עריכת כותרות העמוד+כפתור השליחה
 }
 /// <summary>
 /// בנאי שיופעל לחלון עריכת מסעדה
 /// </summary>
 /// <param name="branchId"></param>
 public addBranchWindows(uint branchId)
 {
     InitializeComponent();
     newBranch = new BE.Branch();
     newBranch = mybl.getBranchByBranchId(branchId); //קבלת האובייקט מסעדה על פי מספר הזיהוי שקיבלתי
     branchGrid.DataContext = newBranch;
     ValueTitleButtom();                             //עריכת כותרות העמוד+כפתור השליחה
 }
Пример #3
0
        public DeleteBranch()
        {
            InitializeComponent();
            bl     = BL.FactoryBL.getBL();
            branch = new BE.Branch();
            branchNameComboBox.ItemsSource = from item in bl.getAllBranch()
                                             select item.branchName;

            this.DataContext = branch;
        }
 public deleteBranchWindow()
 {
     InitializeComponent();
     br = new BE.Branch();
     this.DataContext = br;
     bl = BL.FactoryBL.GetBL();
     branchNumberComboBox.ItemsSource       = bl.listBranch();
     branchNumberComboBox.DisplayMemberPath = "branchNumber";
     branchNumberComboBox.DataContext       = br.branchNumber;//brirat mechdal
 }
Пример #5
0
 public void addBranch(BE.Branch new_branch)
 {
     try
     {
         myDal.addBranch(new_branch);
     }
     catch (Exception)
     {
         throw;
     }
 }
        private void branchNumberComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            object a = branchNumberComboBox.SelectedValue;

            BE.Branch b = a as BE.Branch;
            if (a == null)
            {
                throw new Exception("must select branch first");
            }
            br.branchNumber = b.branchNumber;
        }
        private int GetSelectedBranchNumber()
        {
            object a = BranchNumberTextBox.SelectedValue;

            BE.Branch b = a as BE.Branch;
            if (a == null)
            {
                throw new Exception("must select branch first");
            }
            return(b.branchNumber);
        }
Пример #8
0
        /// <summary>
        /// יופעל בעת לחיצה על שורה בטבלה, יפעיל את העריכה של אותו אובייקט
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void clickOnTableForUpdate(object sender, MouseButtonEventArgs e)
        {
            BE.Branch branch = new BE.Branch();
            branch = (BE.Branch)(branchDataGrid.SelectedItem);

            Window AddBranchWindows = new addBranchWindows(branch.branchId); // שליחת מספר המסעדה לחלון עריכת מסעדה

            (AddBranchWindows as addBranchWindows).refresh += refreshTable;  //הרשמה לאירוע של חלון העריכה , יפעיל את ריענון הטבלה


            AddBranchWindows.Show();
        }
 public updateBranchWindow()
 {
     InitializeComponent();
     br = new BE.Branch();
     this.DataContext = br;
     bl = BL.FactoryBL.GetBL();
     hechsherComboBox.ItemsSource     = Enum.GetValues(typeof(BE.hechsher));
     mycityComboBox.ItemsSource       = Enum.GetValues(typeof(BE.city));
     branchNumberComboBox.ItemsSource = bl.listBranch();
     //branchNumberComboBox.DisplayMemberPath = "branchNumber";
     //branchNumberComboBox.DataContext = br.branchNumber;//brirat mechdal
 }
Пример #10
0
        static BE.Branch init_branch(uint id, string name, string adress, string phone_number, string responsible, ushort workers, ushort free_couriers, BE.Kosher level)
        {
            BE.Branch branch = new BE.Branch();
            branch.branchId             = id;
            branch.nameOfBranch         = name;
            branch.phoneNumberOfBranch  = phone_number;
            branch.nameOfResponsible    = responsible;
            branch.numberOfWorkers      = workers;
            branch.numberOfFreeCouriers = free_couriers;
            branch.branchLevelOfKosher  = level;

            return(branch);
        }
Пример #11
0
 public void deleteBranch(BE.Branch branchToDelete)
 {
     try
     {
         if (myDal.getListOfAllOrders().Exists(order => order.branchId == branchToDelete.branchId))
         {
             throw new Exception("הסניף משרת הזמנות קיימות, אל תמחק!!!");
         }
         myDal.deleteBranch(branchToDelete);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #12
0
 public void updateBranch(BE.Branch branch, string oldName)
 {
     try
     {
         if (oldName != branch.nameOfBranch)//אם שם המנה שונה,לבדוק שהשם החד לא קיים כבר
         {
             checkDoubleName(branch, branch.nameOfBranch);
         }
         myDal.updateBranch(branch);
     }
     catch (Exception)
     {
         throw;
     }
 }
        private void button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                bl.SetBranch(br);
                MessageBox.Show("branch name: " + br.branchName + " branch number: " + br.branchNumber + " was updated");
                //MessageBox.Show("עודכן בהצלחה" + br.branchName + " סניף ");

                br = new BE.Branch();
                this.DataContext = br;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #14
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;
                }
            }
        }
Пример #15
0
        private void deleteBranch_Click(object sender, RoutedEventArgs e)
        {
            var cellInfos = branchDataGrid.SelectedItems;
            int count     = branchDataGrid.SelectedItems.Count;

            for (int i = 0; i < count; i++)
            {
                BE.Branch d = (BE.Branch)branchDataGrid.SelectedItems[i];
                try
                {
                    mybl.deleteBranch(d);
                }
                catch (Exception error)
                {
                    MessageBox.Show(error.Message);
                }
            }
            refreshTable();
        }
        private void button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                bl.DeleteBranch(br.branchNumber);
                MessageBox.Show(" branch number: " + br.branchNumber + " was deleted");
                //MessageBox.Show("נמחק בהצלחה" + br.branchName + " סניף ");


                //branchNumberComboBox.ItemsSource = bl.listBranch();
                //branchNumberComboBox.DisplayMemberPath = "branchNumber";

                br = new BE.Branch();
                this.DataContext = br;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #17
0
 private void deleteButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         BE.Branch br = new BE.Branch();
         br = bl.getAllBranch().FirstOrDefault(b => b.branchName == branch.branchName);
         if (br == null)
         {
             throw new Exception("the branch dosn't exist");
         }
         else
         {
             bl.deleteBranch(br.branchNumber);
         }
         MessageBox.Show("the branch \"" + branch.branchName + "\" Deleted from the system", "Deleted successfully!");
         this.DataContext = branch;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void updatebutton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if ((DateTime)dateDatePicker.SelectedDate < DateTime.Now)
                {
                    throw new Exception("canot udate order with a date that already passed...");
                }

                object      b  = branchNumberComboBox.SelectedValue;
                BE.Branch   bb = b as BE.Branch;
                object      c  = comboBox_Copy.SelectedValue;
                BE.Costumer cc = c as BE.Costumer;


                order.branchNumber = bb.branchNumber;
                order.costumerTz   = cc.tz;
                order.Hechsher     = (BE.hechsher)hechsherComboBox.SelectedValue;
                order.date         = (DateTime)dateDatePicker.SelectedDate;
                //DataContext = b;
                bl.SetOrder(order);
                MessageBox.Show("order: " + order.orderNumber + "  was updated");
                //MessageBox.Show("עודכנה בהצלחה" + order.orderNumber + " הזמנה ");

                order            = new BE.Order();
                this.DataContext = order;
                branchNumberComboBox.DataContext = "";
                hechsherComboBox.DataContext     = "";
                dateDatePicker.DataContext       = DateTime.Now;
                orderNumberCombotBox.DataContext = "";
                comboBox_Copy.DataContext        = "";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }