Example #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (!collectionClearance.IsPressed)
            {
                throw new Exception("WPF: You can't sign up if you don't agree to our clearence about collection from bank accounts.");
            }
            if (!BL_Factory.GetBL_Factory().IsDigitsOnly(numberphone.Text))
            {
                throw new Exception("WPF: You can only write numbers in your numberphone.");
            }
            if (!BL_Factory.GetBL_Factory().IsDigitsOnly(banknumber.Text))
            {
                throw new Exception("WPF: You can only write numbers in your banknumber.");
            }
            Host host = new Host();

            host.privateName         = privatename.Text;
            host.lastName            = familyname.Text;
            host.phoneNumber         = int.Parse(numberphone.Text);
            host.mailAddress         = emailaddres.Text;
            host.bankAccountNumber   = int.Parse(banknumber.Text);
            host.collectionClearance = collectionClearance.IsPressed;
            host.key = Configuration.hostSerialKey++;
            bl.AddHost(host);
            App.page1.main.Content = new MainWindow();
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            List <Order> list = new List <Order>();

            list = BL_Factory.GetBL_Factory().GetOrderList();
            if (!list.Exists(or => or.guestId == int.Parse(id.Text)))
            {
                throw new Exception("Wpf: There is no order that you created.");
            }
            App.page1.main.Content = new DeleteOrder2(int.Parse(id.Text));
        }
 public AddOrder(GuestRequest guestRequest)
 {
     InitializeComponent();
     gr = guestRequest;
     foreach (var h in BL_Factory.GetBL_Factory().Machted(gr))
     {
         ComboBoxItem comboBoxItem = new ComboBoxItem();
         comboBoxItem.Content = h.hostingUnitName + ", " + h.address + "/n " + h.hostingUnitDescription;
         hostingUnits.Items.Add(comboBoxItem);
     }
     meyutar.Content = gr.key;
 }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     foreach (var i in BL_Factory.GetBL_Factory().GetOrderList())
     {
         if (orders.SelectedItem.ToString() == i.ToString())
         {
             BL_Factory.GetBL_Factory().DeleteOrder(i.key);
             break;
         }
     }
     App.page1.main.Content = new MainWindow();
 }
        private void chooseButton_Click(object sender, RoutedEventArgs e)
        {
            Order order = new Order();

            foreach (var i in BL_Factory.GetBL_Factory().GetHostingUnitList())
            {
                if (hostingUnits.SelectedItem.ToString() == i.hostingUnitName + ", " + i.address + "/n " + i.hostingUnitDescription)
                {
                    order.createDate       = DateTime.Now;
                    order.orderHostingUnit = i;
                    order.status           = STATUS.NotYetActivated;
                    order.ownerFee         = (order.orderReleaseDate.DayOfYear - order.orderEntryDate.DayOfYear) * Configuration.fee;
                    order.key             = Configuration.orderSerialKey++;
                    order.guestRequestKey = int.Parse(string.Format("{0}", meyutar.Content));
                    break;
                }
            }
            App.page1.main.Content = new MainWindow();
        }
        public DeleteOrder2(int num)
        {
            bl = BL_Factory.GetBL_Factory();
            InitializeComponent();
            id = num;
            List <Order> list = new List <Order>(), list1 = new List <Order>();

            list = bl.GetOrderList();
            foreach (var i in list)
            {
                if (i.guestId == id && i.status == STATUS.NotYetActivated)
                {
                    list1.Add(i);
                }
            }
            foreach (var o in list1)
            {
                ComboBoxItem comboBoxItem = new ComboBoxItem();
                comboBoxItem.Content = o.orderHostingUnit.hostingUnitName + ", " + o.orderHostingUnit.address + "/n " + o.orderEntryDate.ToString() + "-" + o.orderReleaseDate.ToString();
                orders.Items.Add(comboBoxItem);
            }
        }
 public DeleteOrder1()
 {
     bl = BL_Factory.GetBL_Factory();
     InitializeComponent();
 }
Example #8
0
 public AddHost()
 {
     bl = BL_Factory.GetBL_Factory();
     InitializeComponent();
 }
Example #9
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (!BL_Factory.GetBL_Factory().IsDigitsOnly(adultNum.Text))
            {
                throw new Exception("WPF: Your can only write numbers in your adultNum.");
            }
            if (!BL_Factory.GetBL_Factory().IsDigitsOnly(childNum.Text))
            {
                throw new Exception("WPF: Your can only write numbers in your childNum.");
            }
            if (!BL_Factory.GetBL_Factory().IsDigitsOnly(moneyForNight.Text))
            {
                throw new Exception("WPF: Your can only write numbers in your moneyForNight that you want to pay.");
            }



            HostingUnit hostingunit = new HostingUnit();

            foreach (var i in BL_Factory.GetBL_Factory().GetHostList())
            {
                if (int.Parse(owner.Text) == i.key)
                {
                    hostingunit.owner = i;
                }
            }
            hostingunit.hostingUnitName        = hostingUnitName.Text;
            hostingunit.hostingUnitDescription = hostingUnitDescription.Text;
            hostingunit.adultNum           = int.Parse(adultNum.Text);
            hostingunit.childNum           = int.Parse(childNum.Text);
            hostingunit.pool               = pool.IsPressed;
            hostingunit.jacuzzi            = jacuzzi.IsPressed;
            hostingunit.wifi               = wifi.IsPressed;
            hostingunit.disabledAccessible = disabledAccessible.IsPressed;
            hostingunit.view               = view.IsPressed;
            hostingunit.moneyForNight      = int.Parse(moneyForNight.Text);
            hostingunit.address            = city.Text + ' ' + street.Text + ' ' + appnum.Text;


            switch (this.area.Text)
            {
            case "All":
                hostingunit.area = AREA.All;
                break;

            case "North":
                hostingunit.area = AREA.North;
                break;

            case "South":
                hostingunit.area = AREA.South;
                break;

            case "Jerusalem":
                hostingunit.area = AREA.Jerusalem;
                break;

            case "Center":
                hostingunit.area = AREA.Center;
                break;

            case "Eilat":
                hostingunit.area = AREA.Eilat;
                break;

            default:
                break;
            }
            switch (this.type.Text)
            {
            case "All":
                hostingunit.type = TYPE.All;
                break;

            case "Hotel":
                hostingunit.type = TYPE.Hotel;
                break;

            case "Zimmer":
                hostingunit.type = TYPE.Zimmer;
                break;

            case "Apartment":
                hostingunit.type = TYPE.Apartment;
                break;

            case "Camping":
                hostingunit.type = TYPE.Camping;
                break;

            default:
                break;
            }
        }
Example #10
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (!BL_Factory.GetBL_Factory().IsDigitsOnly(id.Text))
            {
                throw new Exception("WPF: Your can only write numbers in your id .");
            }
            if (!BL_Factory.GetBL_Factory().IsDigitsOnly(minimum.Text) && int.Parse(minimum.Text) >= 0)
            {
                throw new Exception("WPF: Your can only write numbers in your minimum that you want to pay  .");
            }
            if (int.Parse(minimum.Text) <= 0)
            {
                throw new Exception("WPF: Your can only enter num that biger then zero  .");
            }
            if (int.Parse(minimum.Text) > int.Parse(maximum.Text))
            {
                throw new Exception("WPF: Your minimum has to be bigger then your maximum.");
            }
            if (!BL_Factory.GetBL_Factory().IsDigitsOnly(maximum.Text))
            {
                throw new Exception("WPF: Your can only write numbers in your maximum that you want to pay  .");
            }

            GuestRequest guestRequest = new GuestRequest();

            guestRequest.key              = Configuration.guestRequestSerialKey++;
            guestRequest.id               = int.Parse(this.id.Text);
            guestRequest.firstName        = this.firstName.Text;
            guestRequest.lastName         = this.LastName.Text;
            guestRequest.registretionTime = DateTime.Now;
            guestRequest.entryDate        = this.entryDate.SelectedDate ?? DateTime.Now;
            guestRequest.releaseDate      = this.releaseDate.SelectedDate ?? DateTime.Now;
            switch (this.area.Text)
            {
            case "All":
                guestRequest.area = AREA.All;
                break;

            case "North":
                guestRequest.area = AREA.North;
                break;

            case "South":
                guestRequest.area = AREA.South;
                break;

            case "Jerusalem":
                guestRequest.area = AREA.Jerusalem;
                break;

            case "Center":
                guestRequest.area = AREA.Center;
                break;

            case "Eilat":
                guestRequest.area = AREA.Eilat;
                break;

            default:
                break;
            }
            switch (this.type.Text)
            {
            case "All":
                guestRequest.type = TYPE.All;
                break;

            case "Hotel":
                guestRequest.type = TYPE.Hotel;
                break;

            case "Zimmer":
                guestRequest.type = TYPE.Zimmer;
                break;

            case "Apartment":
                guestRequest.type = TYPE.Apartment;
                break;

            case "Camping":
                guestRequest.type = TYPE.Camping;
                break;

            default:
                break;
            }

            guestRequest.pool               = this.pool.IsPressed;
            guestRequest.wifi               = this.wifi.IsPressed;
            guestRequest.jacuzzi            = this.jacuzzi.IsPressed;
            guestRequest.view               = this.view.IsPressed;
            guestRequest.disabledAccessible = this.disabledAccessible.IsPressed;
            guestRequest.moneyRange[0]      = int.Parse(this.minimum.Text);
            guestRequest.moneyRange[1]      = int.Parse(this.maximum.Text);

            BL_Factory.GetBL_Factory().AddGuestRequest(guestRequest);
            App.page1.Content = new AddOrder(guestRequest);
        }