예제 #1
0
 public AddBranch()
 {
     InitializeComponent();
     branch = new BE.Branch();
     this.gridAddBranch.DataContext = branch;
     bl = BL.FactoryBL.getBL();
     this.hechsherComboBox.ItemsSource = Enum.GetValues(typeof(BE.kosherLevel));
 }
예제 #2
0
 public Order(long orderCode, DateTime reservationDate,Branch branchs, kosherLevel kosher, int phone)
 {
     OrderCode = orderCode;
     ReservationDate = reservationDate;
     this.branchs = branchs;
     Kosher = kosher;
     clientPhone = phone;
 }
예제 #3
0
 public void AddBranch(Branch branch)
 {
     if (searchBranchByID(branch.BranchNumber) == null)
     {
         DataSource.branchList.Add(branch);
     }
     else
         throw new alreadyExists("DAL error: Id " + branch.BranchNumber + " already exists in data source");
 }
        public addBranch()
        {
            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));
        }
예제 #5
0
 public Zz(int dishID, string dishName, long orterID, DishSize dishSize, int amount, Branch branch, float payment)
 {
     this.DishNumber = dishID;
     this.DishName = dishName;
     this.OrderCode = orterID;
     this.dishSize = dishSize;
     this.Amount = amount;
     this.Branch = branch;
     this.Payment = payment;
 }
예제 #6
0
        public UpdateBranch()
        {
            InitializeComponent();
            branch           = new BE.Branch();
            this.DataContext = branch;
            bl = BL.FactoryBL.getBL();
            branchNumberComboBox.ItemsSource = from item in bl.getAllBranch()
                                               select item.branchNumber;

            this.hechsherComboBox.ItemsSource = Enum.GetValues(typeof(BE.kosherLevel));
        }
예제 #7
0
 private void UpdateBranchButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         bl.updateBranch(branch);
         branch = new BE.Branch();
         MessageBox.Show("the branch " + branch.branchName + " update ", "");
         this.DataContext = branch;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #8
0
        public XElement ConvertBranch(BE.Branch b)//converts fromm XElemen to Branch
        {
            XElement branchElement = new XElement("Branch");

            foreach (PropertyInfo item in typeof(Branch).GetProperties())
            {
                branchElement.Add
                (
                    new XElement(item.Name, item.GetValue(b, null))
                );
            }

            return(branchElement);
        }
예제 #9
0
 private void addBranchButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         bl.addBranch(branch);
         MessageBox.Show("the branch \"" + branch.branchName + "\" added to the list", "");
         branch = new BE.Branch();
         this.gridAddBranch.DataContext = branch;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                bl.AddBranch(br);
                MessageBox.Show("branch name: " + br.branchName + " branch number: " + br.branchNumber + " was added");
                //MessageBox.Show("הוסף בהצלחה" + br.branchName + " סניף ");

                br = new BE.Branch();
                this.DataContext             = br;
                hechsherComboBox.DataContext = "";
                mycityComboBox.DataContext   = "";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #11
0
 public void UpdateBranch(Branch branch)
 {
     for (int i = 0; i < DataSource.branchList.Count(); i++)
     {
         if (DataSource.branchList[i].BranchNumber == branch.BranchNumber)
         {
             DataSource.branchList[i].AvailableCouriers = branch.AvailableCouriers;
             DataSource.branchList[i].BranchAddress = branch.BranchAddress;
             DataSource.branchList[i].BranchEmployeesAmount = branch.BranchEmployeesAmount;
             DataSource.branchList[i].BranchManager = branch.BranchManager;
             DataSource.branchList[i].BranchName = branch.BranchName;
             DataSource.branchList[i].kosherLevel = branch.kosherLevel;
             DataSource.branchList[i].OpeningTimes = branch.OpeningTimes;
             DataSource.branchList[i].TelephoneNumber = branch.TelephoneNumber;
             break;
         }
     }
 }
        private void Delete_Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                BE.Branch tempBranch = bl.getBranch(int.Parse(txtBranchID.Text));

                if (tempBranch == null) // if the id doesn't exists within the branchlist.
                {
                    throw new Exception("Dish with given id not found.");
                }
                bl.deleteBranch(tempBranch.branchID);
                dataGridBranch.Items.Refresh();
                throw new Exception("Branch with id: " + tempBranch.branchID + " has been deleted.");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #13
0
 public void UpdateBranch(Branch branch)
 {
     mybranch.UpdateBranch(branch);
 }
 private void Add_Button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         int id;
         if (txtBranchID.Text == "")
         {
             id = 0;
         }
         else
         {
             id = int.Parse(txtBranchID.Text);
         }
         if (id > 1000)
         {
             throw new Exception("Inaccurate id number.");
         }
         string name = textBoxName.Text;
         if (name == "")
         {
             throw new Exception("Lacking Name.");
         }
         string address = textBoxAddress.Text;
         if (address == "")
         {
             throw new Exception("Lacking Address.");
         }
         long phoneNum = long.Parse(textBoxPhoneNum.Text);
         if (textBoxPhoneNum.Text.Length != 10)
         {
             throw new Exception("Inaccurate PhoneNum.");
         }
         string manager = textBoxManager.Text;
         if (manager == "")
         {
             throw new Exception("Lacking Manager.");
         }
         int employee = int.Parse(textBoxEmployees.Text);
         if (employee < 1)
         {
             throw new Exception("Inaccurate Employees");
         }
         int deliveryFree = int.Parse(textBoxDelivery.Text);
         if (deliveryFree < 0)
         {
             throw new Exception("Inaccurate Delivery.");
         }
         branchHechser hechser = (branchHechser)comboBoxHechser.SelectedItem;
         if ((int)hechser < 0)
         {
             throw new Exception("Lacking Hechser.");
         }
         BE.Branch currentBranch = new BE.Branch(name, address, phoneNum, manager, employee, deliveryFree, hechser, id);
         bl.addBranch(currentBranch);
         dataGridBranch.Items.Refresh();
         MessageBox.Show("You have added the Branch with the id: " + currentBranch.branchID.ToString());
         //Clear the form:
         txtBranchID.Text             = "";
         textBoxAddress.Text          = "";
         textBoxDelivery.Text         = "";
         textBoxEmployees.Text        = "";
         textBoxManager.Text          = "";
         textBoxName.Text             = "";
         textBoxPhoneNum.Text         = "";
         comboBoxHechser.SelectedItem = null;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void Update_Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                BE.Branch tempBranch = bl.getBranch(int.Parse(txtBranchID.Text));

                if (tempBranch == null) // if the id doesn't exists within the branchlist.
                {
                    throw new Exception("Dish with given id not found.");
                }

                else
                {
                    //If the textBox == "", meaning it's empty, it wont update that info.

                    if (textBoxName.Text != "")
                    {
                        tempBranch.branchName = textBoxName.Text;
                    }

                    if (textBoxAddress.Text != "")
                    {
                        tempBranch.branchAddress = textBoxAddress.Text;
                    }

                    if (textBoxPhoneNum.Text != "")
                    {
                        if (textBoxPhoneNum.Text.Length != 10)
                        {
                            throw new Exception("Phone number not accurate.");
                        }
                        else
                        {
                            tempBranch.branchPhoneNum = int.Parse(textBoxPhoneNum.Text);
                        }
                    }

                    if (textBoxManager.Text != "")
                    {
                        tempBranch.branchManager = textBoxManager.Text;
                    }

                    if (textBoxEmployees.Text != "")
                    {
                        if (int.Parse(textBoxEmployees.Text) < 1)
                        {
                            throw new Exception("Innacurate Employees.");
                        }
                        else
                        {
                            tempBranch.branchEmployee = int.Parse(textBoxEmployees.Text);
                        }
                    }

                    if (textBoxDelivery.Text != "")
                    {
                        if (int.Parse(textBoxDelivery.Text) < 0)
                        {
                            throw new Exception("Innacurate Delivery.");
                        }
                        else
                        {
                            tempBranch.branchDeliveryFree = int.Parse(textBoxDelivery.Text);
                        }
                    }

                    //not change the hechser:
                    if ((int)comboBoxHechser.SelectedItem >= 0)
                    {
                        tempBranch.branchHechserBranch = (branchHechser)comboBoxHechser.SelectedItem;
                    }

                    bl.updateBranch(tempBranch);
                    dataGridBranch.Items.Refresh();
                    MessageBox.Show("Branch: " + tempBranch.branchID.ToString() + " has been updated.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #16
0
 public void DeletBranch(Branch branch)
 {
     dal_func.DeletBranch(branch);
 }
예제 #17
0
 public void AddBranch(Branch branch)
 {
     dal_func.AddBranch(branch);
 }
예제 #18
0
 public void UpdateBranch(Branch branch)
 {
     dal_func.UpdateBranch(branch);
 }
예제 #19
0
 public void UpdateBranch(Branch branch)//update branch
 {
     if (RemoveBranch(branch.BranchNumber))
         AddBranch(branch);
     else
         throw new NullReferenceException("Branch not found!");
 }
예제 #20
0
 private void branchNumberComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     branch           = bl.getAllBranch(b => b.branchNumber == branch.branchNumber).FirstOrDefault();
     this.DataContext = branch;
 }
예제 #21
0
 public void AddBranch(Branch branch)
 {
     mybranch.AddBranch(branch);
 }
예제 #22
0
 public void DeletBranch(Branch branch)
 {
     //if (branch == null && DataSource.branchList.Remove(branch))
     //    throw new NullReferenceException("the branch not found");
     DataSource.branchList.Remove(branch);
 }
예제 #23
0
 public void DeletBranch(Branch branch)
 {
     mybranch.RemoveBranch(branch.BranchNumber);
 }
예제 #24
0
        public void AddBranch(Branch branch)//Add branch
        {
            if (SearchBranchById(branch.BranchNumber) == null)
            {
                XElement id = new XElement("id", branch.BranchNumber);
                XElement Name = new XElement("Name", branch.BranchName);
                XElement Address = new XElement("Address", branch.BranchAddress);
                XElement KosherLevel = new XElement("KosherLevel", branch.kosherLevel);
                XElement openingTime = new XElement("openingTime", branch.OpeningTimes);
                XElement Phone = new XElement("Phone", branch.TelephoneNumber);
                XElement Employees = new XElement("Employees", branch.BranchEmployeesAmount);
                XElement Manager = new XElement("Manager", branch.BranchManager);
                XElement Couriers = new XElement("Couriers", branch.AvailableCouriers);
                XElement bran = new XElement("Branch_Details", Name, Address, openingTime, Phone, Employees, Couriers, Manager);

                BranchRoot.Add(new XElement("Branch", id, bran, KosherLevel));
                BranchRoot.Save(BranchPath);
            }
            else
                throw new alreadyExists("DAL error: Id " + branch.BranchNumber + " already exists in data source");
        }