private void Addbutton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                DateTime d  = DateTime.Now;
                DateTime ed = (DateTime)OrderDateDatePicker.SelectedDate;
                if (ed.Year < d.Year || (ed.Year == d.Year && ed.Month < d.Month) || (ed.Year == d.Year && ed.Month == d.Month && ed.Day < d.Day))
                {
                    throw new Exception("canot add order with a date that already passed...");
                }

                bl.AddOrder(order);
                MessageBox.Show("order: " + order.orderNumber + "  was added");
                //this.Resources["Add"]
                //if(App.Current.Resources.MergedDictionaries== EnglishDictonary.xaml)
                //MessageBox.Show("הוספה בהצלחה" + order.orderNumber + " הזמנה ");

                order            = new BE.Order();
                this.DataContext = order;
                new AddOrderedDishWindow().Show();
                HechsherCampusComboBox.DataContext = "";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #2
0
 private void Button_Click(object sender, RoutedEventArgs e) //when we click on the button ORDER to add order
 {
     try
     {
         MessageBox.Show(bl.AddOrder(GuestR.GuestRequestKey, this_HostingUnitKey), "Order", MessageBoxButton.OK, MessageBoxImage.Information);
         this.IsEnabled = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Order", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DataContext = myOrder;

            try
            {
                bl.AddOrder(myOrder);
                MessageBox.Show(" הזמנתך התקבלה", "הצלחה", MessageBoxButton.OK, MessageBoxImage.Information);
                this.Close();
            }
            catch (Exception ex)
            { MessageBox.Show(ex.Message, "הודעת שגיאה", MessageBoxButton.OK, MessageBoxImage.Warning); }
        }
예제 #4
0
        private void AddOrderButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                guestrequest = GuestrequestComboBox.SelectedValue as BE.GuestRequest;
                if (guestrequest == null)
                {
                    throw new NullReferenceException("please choose a guest request");
                }

                hostingunit = HostingUnitComboBox.SelectedValue as BE.HostingUnit;
                if (hostingunit == null)
                {
                    throw new NullReferenceException("please choose a hosting unit");
                }
                order.GuestRequestKey = guestrequest.GuestRequestKey;
                order.HostingUnitKey  = hostingunit.HostingUnitKey;
                this.DataContext      = order;

                bl.AddOrder(order.GuestRequestKey, order.HostingUnitKey);
                order = new BE.Order();
                MessageBoxResult result = MessageBox.Show("Thank You, your order has been added. Would you like to add another order?", "Status", MessageBoxButton.YesNo, MessageBoxImage.Information);
                switch (result)
                {
                case MessageBoxResult.Yes:
                    this.Close();
                    Window AddOrderWindow = new AddOrderWindow();
                    AddOrderWindow.Show();
                    break;

                case MessageBoxResult.No:
                    this.Close();
                    Window OrderWindow = new OrderWindow();
                    OrderWindow.Show();
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
예제 #5
0
        static void Main(string[] args)
        {
            DateTime entryDate   = new DateTime(2020, 4, 5),
                     releaseDate = new DateTime(2020, 5, 12);

            BE.Host host = new BE.Host()
            {
                HostKey             = ++BE.Configuration.HostKey,
                Balance             = 105,
                PrivateName         = "no",
                FamilyName          = "money",
                PhoneNumber         = "05050505",
                Email               = "*****@*****.**",
                CollectionClearance = true,
                BankBranchDetails   = new BE.BankBranch()
                {
                    BankNumber    = ++BE.Configuration.BankNumber,
                    BankName      = "take your money",
                    BranchAddress = "take your money city",
                    BranchCity    = "no money city",
                    BranchNumber  = 15
                },
                BankAccountNumber = 130559,
            };
            BE.GuestRequest guestRequest = new BE.GuestRequest
            {
                GuestRequestKey     = ++BE.Configuration.GuestRequestKey,
                PrivateName         = "shachar",
                FamilyName          = "markovich",
                Email               = "*****@*****.**",
                Stat                = BE.Enums.Status.NotYetApproved,
                RegistrationDate    = DateTime.Now,
                EntryDate           = new DateTime(2020, 8, 9),
                ReleaseDate         = new DateTime(2020, 8, 12),
                Area                = BE.Enums.Area.Center,
                type                = BE.Enums.UnitType.Hotel,
                Adults              = 2,
                Children            = 3,
                Pool                = true,
                Jecuzzi             = true,
                Garden              = true,
                ChildrenAttractions = true
            };
            BE.HostingUnit hostingUnit = new BE.HostingUnit()
            {
                HostingUnitKey  = ++BE.Configuration.HostingUnitKey,
                HostingUnitName = "hotel california",
                Owner           = host,
                type            = BE.Enums.UnitType.Hotel,
                Area            = BE.Enums.Area.Center,
                Diary           = new bool[BE.Configuration._month, BE.Configuration._days],
            };
            BE.Order order = new BE.Order()
            {
                OrderKey        = ++BE.Configuration.OrderKey,
                HostingUnitKey  = hostingUnit.HostingUnitKey,
                GuestRequestKey = guestRequest.GuestRequestKey,
                Status          = guestRequest.Stat,
                CreateDate      = DateTime.Now,
                OrderDate       = new DateTime(2020, 3, 3)
            };


            _bl.AddGuestRequest(guestRequest);
            _bl.AddHostingUnit(hostingUnit);
            _bl.AddOrder(order);

            Console.WriteLine("adding the next instance Successfully:\n");
            Console.WriteLine(host);
            Console.WriteLine();
            Console.WriteLine(guestRequest);
            Console.WriteLine();
            Console.WriteLine(order);
            Clear();


            if (_bl.IsDateArmor(hostingUnit, entryDate, releaseDate))
            {
                Console.WriteLine("the following hostingUnit has free rooms between " + entryDate.toString() + " to " + releaseDate.toString());
                Console.WriteLine(hostingUnit);
                Clear();
            }

            Console.WriteLine($"host.Balance before taking fee: {host.Balance}");
            _bl.TakeFee(order);
            List <BE.HostingUnit> unit2 = _bl.AccordingTo(unit => hostingUnit.Owner.HostKey == unit.Owner.HostKey);

            Console.WriteLine($"host.Balance after taking fee: {unit2.Single().Owner.Balance}");
            Clear();

            Console.WriteLine($"hostingUnit.diary before update:\n{hostingUnit.Diary.toString()}");
            _bl.UpdateCalendar(hostingUnit, entryDate, releaseDate);
            unit2 = _bl.AccordingTo(unit => hostingUnit.HostingUnitKey == unit.HostingUnitKey);
            Console.WriteLine($"hostingUnit.diary after update:\n{unit2.Single().Diary.toString()}");
            Clear();


            _bl.SendEmail(host /*FROM*/, "*****@*****.**" /*TO*/);
            int daysNumber = _bl.OrderCount(guestRequest);

            Console.WriteLine($"number of orders sent to {guestRequest.GuestRequestKey} is: {daysNumber}");
            daysNumber = _bl.ApprovedCount(hostingUnit);
            Console.WriteLine($"number of all order that have been closed for the hosting unit {hostingUnit.HostingUnitKey} is: {daysNumber}");
            Clear();

            List <BE.HostingUnit> c = _bl.ListOptionsFree(entryDate, daysNumber);

            foreach (var item in c)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine("\n");
            List <BE.Order> d = _bl.AtLeastnDays(daysNumber);

            foreach (var item in c)
            {
                Console.WriteLine(item);
            }

            Clear();

            List <IGrouping <BE.Enums.Area, BE.GuestRequest> > f = _bl.GroupGuestRequestByArea();
            List <IGrouping <int, BE.GuestRequest> >           g = _bl.GroupGuestRequestByPeopleCount();
            List <IGrouping <int, BE.Host> > h = _bl.GroupHostByfHostingUnitCount();
            List <IGrouping <BE.Enums.Area, BE.HostingUnit> > i = _bl.GroupHostingUnitByArea();
        }