Ejemplo n.º 1
0
        public string AddHostingUnit(BE.HostingUnit hostU) // add hosting unit
        {
            hostU.HostingUnitKey = 0;
            if (!(CheckMailAddress(hostU.Owner.MailAddress)))
            {
                throw new ArgumentException("This email address isn't correct");
            }
            int num;

            if (hostU.Owner.PhoneNumber.Length != 10 || !int.TryParse(hostU.Owner.PhoneNumber, out num))
            {
                throw new ArgumentException("This phone number isn't correct");
            }
            if (hostU.Owner.HostKey.Length != 8 || !int.TryParse(hostU.Owner.HostKey, out num))
            {
                throw new ArgumentException("the ID must be in format of 8 digits");
            }
            if (Convert.ToInt32(hostU.TypeOfHostingUnit) < 0 || Convert.ToInt32(hostU.TypeOfHostingUnit) > 3)
            {
                throw new ArgumentException("ERROR-This number of Type Of Hosting Unit dosn't exist");
            }

            dal.AddHostingUnit(hostU);
            return(" Add Hosting Unit accomplish with success \n Your hosting unit key is :" + hostU.HostingUnitKey);
        }
        public AddHostingUnitWindow()
        {
            try
            {
                InitializeComponent();
                unit             = new BE.HostingUnit();
                host             = new BE.Host();
                bl               = BL.FactoryBL.GetBL();
                this.DataContext = unit;
                this.jacuzziComboBox.ItemsSource = Enum.GetValues(typeof(BE.Jacuzzi));
                //jacuzziComboBox.TabIndex = 0;
                this.poolComboBox.ItemsSource                 = Enum.GetValues(typeof(BE.Pool));
                this.snackBarComboBox.ItemsSource             = Enum.GetValues(typeof(BE.SnackBar));
                this.smokingComboBox.ItemsSource              = Enum.GetValues(typeof(BE.Smoking));
                this.areaComboBox.ItemsSource                 = Enum.GetValues(typeof(BE.Area));
                this.wifiComboBox.ItemsSource                 = Enum.GetValues(typeof(BE.Wifi));
                this.typeComboBox.ItemsSource                 = Enum.GetValues(typeof(BE.Type));
                this.tvComboBox.ItemsSource                   = Enum.GetValues(typeof(BE.Television));
                this.gardenComboBox.ItemsSource               = Enum.GetValues(typeof(BE.Garden));
                this.roomServiceComboBox.ItemsSource          = Enum.GetValues(typeof(BE.RoomService));
                this.childrensAttractionsComboBox.ItemsSource = Enum.GetValues(typeof(BE.ChildrensAttractions));
                this.publicTransportationComboBox.ItemsSource = Enum.GetValues(typeof(BE.PublicTransportation));
                this.viewComboBox.ItemsSource                 = Enum.GetValues(typeof(BE.View));
                this.collectionClearanceComboBox.ItemsSource  = Enum.GetValues(typeof(BE.PaymentClearance));
                this.banknameComboBox.ItemsSource             = bl.getBankNames();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "error", MessageBoxButton.OK, MessageBoxImage.Error);

                this.Close();
                Window HostingUnitWindow = new HostingUnitWindow();
                HostingUnitWindow.Show();
            }
        }
Ejemplo n.º 3
0
        public CalendarView(BE.HostingUnit hu)
        {
            InitializeComponent();
            DisplayCalendar.DisplayDateStart = DateTime.Today.Subtract(new TimeSpan(30, 0, 0, 0));
            DisplayCalendar.DisplayDateEnd   = DateTime.Today.AddDays(11 * 30);

            for (int i = 0; i < 12; i++)

            {
                for (int j = 0; j < 31; j++)
                {
                    try
                    {
                        DateTime tmp = new DateTime(DateTime.Today.Year, i + 1, j + 1);
                    }

                    catch
                    {
                        continue;
                    }

                    if (hu.Diary[i, j])
                    {
                        DisplayCalendar.BlackoutDates.Add(new CalendarDateRange(new DateTime(DateTime.Today.Year, i + 1, j + 1), new DateTime(DateTime.Today.Year, i + 1, j + 1)));
                    }
                }
            }
        }
Ejemplo n.º 4
0
 public updateHostWindow(BE.HostingUnit uni, string user)
 {
     InitializeComponent();
     unit = uni;
     this.grid1.DataContext = uni;
     username = user;
 }
        private void deleteHostingUnitButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (hostingunitComboBox.SelectedItem == null)
                {
                    throw new NullReferenceException("please select hosting unit to delete");
                }
                unit = this.hostingunitComboBox.SelectedValue as BE.HostingUnit;

                this.DataContext = unit;
                bl.DeleteHostingUnit(unit);
                unit = new BE.HostingUnit();

                MessageBoxResult result = MessageBox.Show("Your Hosting Unit has been deleted. Would you like to delete another hosting unit?", "Status", MessageBoxButton.YesNo, MessageBoxImage.Question);
                switch (result)
                {
                case MessageBoxResult.Yes:
                    this.Close();
                    Window DeleteHostingUnitWindow = new DeleteHostingUnitWindow();
                    DeleteHostingUnitWindow.Show();
                    break;

                case MessageBoxResult.No:
                    this.Close();
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Ejemplo n.º 6
0
        public AddHostingUnitGUI()
        {
            InitializeComponent();

            bl     = BL.Factory.GetInstance();
            HUshow = new BE.HostingUnit()
            {
                Owner = new BE.Host()
                {
                    BankBranchDetails = new BE.BankBranch()
                }
            };
            this.DataContext = HUshow;
            //this.GuestRequestGrid.DataContext =GRShow; //הקשר הדטה לפי GuestRequest


            this.typeComboBox.ItemsSource = Enum.GetValues(typeof(BE.Enums.TypeEnum));
            this.areaComboBox.ItemsSource = Enum.GetValues(typeof(BE.Enums.AreaEnum));


            bankAccunts = new List <BE.BankBranch>();
            try
            {
                bankAccunts = bl.getAllBankBranches();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }


            List <string> bankNames = (from bank in bankAccunts select bank.BankName).Distinct().ToList();

            BankNameComboBox.ItemsSource = bankNames;
        }
Ejemplo n.º 7
0
 public void DeleteHostingUnit(BE.HostingUnit hostingUnit)
 {
     if (DS.DataSource._hostingUnitsList.Remove(hostingUnit) == false)
     {
         throw new ArgumentException("delete from DS.DataSource._hostingUnitsList not succeed!", "hostingUnit");
     }
 }
Ejemplo n.º 8
0
        private void OrderButton_Click(object sender, RoutedEventArgs e)
        {
            var radio = new RadioButtonSelectHU(gr, host);

            BE.HostingUnit hu = new BE.HostingUnit();
            radio.Closing += (s, args) => hu = radio.GetSelection();
            radio.ShowDialog();
            BE.Order ord = new BE.Order();
            if (hu != null)
            {
                try
                {
                    ord = new BE.Order()
                    {
                        CreateDate      = DateTime.Today,
                        GuestRequestKey = gr.GuestRequestKey,
                        HostingUnitKey  = hu.HostingUnitKey,//Give to select from
                        OrderDate       = DateTime.Today,
                        Status          = BE.Enums.OrderStatus.UnTreated
                    };

                    CreateAccount.myBL.AddOrder(ord);
                    hu.Diary = CreateAccount.myBL.MarkingInTheDiary(hu, gr.EntryDate, gr.ReleaseDate);
                }
                catch (Exceptions.NoItemsException)
                {
                    throw;
                }

                huOrderedTo = hu;
            }
        }
Ejemplo n.º 9
0
        private void ListBox_HostingUnit_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            BE.HostingUnit item  = (BE.HostingUnit)listBox_HostingUnit.SelectedItem;
            DockPanel      panel = new DockPanel();

            HostinUnitDetails.Text = item.ToString();
        }
Ejemplo n.º 10
0
        public AddNewOrder(BE.HostingUnit H, Calendar c)
        {
            InitializeComponent();
            bl                = BL.FactoryBL.GetBL();
            hostU             = H;
            MyCalendar        = c;
            vbCalendar.Height = MyCalendar.Height;
            vbCalendar.Width  = MyCalendar.Width;
            vbCalendar.Child  = MyCalendar;
            SetBlackOutDates();
            var GuestRequestList = bl.GuestRequestByCondition(hostU);

            SubGrid.Height = 0;
            for (int i = 0; i < GuestRequestList.Count; i++)
            {
                SubGrid.Height += 300;
                SubGrid.RowDefinitions.Add(new RowDefinition());
            }

            for (int i = 0; i < GuestRequestList.Count; i++)   // For row 0 data, create UserControl by the number of hosting units of the selected host,
            {
                GuestRequestUserControl a = new GuestRequestUserControl(GuestRequestList[i], hostU.HostingUnitKey);
                SubGrid.Children.Add(a); // Add them to the display organizer
                Grid.SetRow(a, i);       // and put them in the appropriate row
            }
        }
Ejemplo n.º 11
0
        private void UnitPassword_PasswordChanged(object sender, RoutedEventArgs e)
        {
            //Unit number must be 8 digits
            if (UnitPassword.Password.Length < 8)
            {
                //if a char is deleted after a unit is approved
                Continue_button.IsEnabled = false;
                return;
            }


            //checks if the number is correct
            foreach (var number in UnitPassword.Password)
            {
                if (!char.IsDigit(number))
                {
                    WrongNumber("Invalid number");
                    return;
                }
            }

            try
            {
                TheUnit = MainWindow.BL.GetHostingUnit(Convert.ToInt32(UnitPassword.Password));
                Continue_button.IsEnabled = true;
            }
            catch (Exception err)
            {
                //the unit not exist
                WrongNumber(err.Message);
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// test Idal's HostingUnit functions
        /// </summary>
        private static void HostingUnit()
        {
            List <BE.HostingUnit> unitsList = _dal.GetAllHostingUnits();

            //add
            BE.HostingUnit unit = new BE.HostingUnit()
            {
                HostingUnitKey  = ++BE.Configuration.HostingUnitKey,
                HostingUnitName = "hotel california",
                Owner           = unitsList[0].Owner,
                type            = BE.Enums.UnitType.Hotel,
                Area            = BE.Enums.Area.Center,
                Diary           = new bool[BE.Configuration._month, BE.Configuration._days],
            };
            _dal.AddHostingUnit(unit.Clone());
            PrintHostingUnits();

            // update
            unit.Owner = unitsList[2].Owner;
            _dal.UpdateHostingUnit(unit.Clone());
            Console.WriteLine("after update:");
            PrintHostingUnits();

            //delete
            _dal.DeleteHostingUnit(unit.Clone());
            Console.WriteLine("after delete:");
            PrintHostingUnits();
        }
 public DeleteHostingUnitWindow()
 {
     InitializeComponent();
     unit             = new BE.HostingUnit();
     bl               = BL.FactoryBL.GetBL();
     this.DataContext = unit;
     this.hostingunitComboBox.ItemsSource = bl.GetHostingUnitList();
 }
 public AdminHostingUnitUC(BE.HostingUnit hu)
 {
     InitializeComponent();
     Name.Content  = hu.HostingUnitName;
     Owner.Content = hu.Owner.PrivateName + " " + hu.Owner.FamilyName;
     Key.Content   = hu.HostingUnitKey;
     this.hu       = hu;
 }
Ejemplo n.º 15
0
 private void studentsComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (this.studentsComboBox.SelectedItem is BE.HostingUnit)
     {
         this.hostingUnit            = ((BE.HostingUnit) this.studentsComboBox.SelectedItem).GetCopy();
         this.hostigUnit.DataContext = hostingUnit;
     }
 }
 public DeleteHostingUnitWindow()
 {
     InitializeComponent();
     hosting     = new BE.HostingUnit();
     DataContext = hosting;
     bl          = BL.FactoryBL.GetBL();
     this.HostingUnitKey.ItemsSource = bl.GetAllHostingUnits(); //Enum.GetValues(typeof(hostingunitList));
 }
 public addHostingUnitWindow()
 {
     InitializeComponent();
     hosting               = new BE.HostingUnit();
     DataContext           = hosting;
     bl                    = BL.FactoryBL.GetBL();
     this.Area.ItemsSource = Enum.GetValues(typeof(BE.MyEnums.Area));
 }
        private void CreateButton_Click(object sender, RoutedEventArgs e)
        {
            Regex propHUName = new Regex(@"^(?:[A-Z][a-z]+\s?)+$");

            if (!propHUName.IsMatch(NameOfUnit.Text))
            {
                MessageBox.Show("Invalid format of name! Name must be title case!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            BE.HostingUnit unit = new BE.HostingUnit
            {
                Area                        = (BE.Enums.Area)Enum.Parse(typeof(BE.Enums.Area), Area.SelectionBoxItem as string),
                Type                        = (BE.Enums.HostingUnitType)Enum.Parse(typeof(BE.Enums.HostingUnitType), TypeOfUnit.SelectionBoxItem as string),
                HostingUnitName             = NameOfUnit.Text,
                NumberOfPlacesForAdults     = (int)AmountOfAdults.Value,
                NumberOfPlacesForChildren   = (int)AmountOfChildren.Value,
                IsTherePool                 = (bool)HasPool.IsChecked,
                IsThereJacuzzi              = (bool)HasJacuzzi.IsChecked,
                IsThereGarden               = (bool)HasGarden.IsChecked,
                IsThereChildrensAttractions = (bool)HasChildrenAttractions.IsChecked,
                Diary                       = null,
                Owner                       = host
            };

            if (updating)
            {
                unit.HostingUnitKey = hu.HostingUnitKey;
            }

            try
            {
                if (updating)
                {
                    CreateAccount.myBL.RemoveHostingUnit(hu.HostingUnitKey);
                }
                CreateAccount.myBL.AddHostingUnit(unit);
            }
            catch
            {
                FR.FR_Imp.GetFR().SetHostingUnitKey(FR.FR_Imp.GetFR().GetHostingUnitKey() - 1);
                MessageBox.Show("Error with one or more of your fields", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (updating)
            {
                MessageBox.Show("You have updated a hosting unit successfully!", "Success!", MessageBoxButton.OK, MessageBoxImage.Information);
            }

            else
            {
                MessageBox.Show("You have registered a hosting unit successfully!", "Success!", MessageBoxButton.OK, MessageBoxImage.Information);
            }

            hu = unit;

            Close();
        }
 public static BE.HostingUnit Clone(this BE.HostingUnit original)
 {
     BE.HostingUnit target = new BE.HostingUnit();
     target.HostingUnitKey  = original.HostingUnitKey;
     target.Owner           = original.Owner;
     target.HostingUnitName = original.HostingUnitName;
     target.Diary           = original.Diary;
     return(target);
 }
Ejemplo n.º 20
0
        public ListOrderToUpdate(BE.HostingUnit h)
        {
            InitializeComponent();

            unit        = h;
            DataContext = this;
            orderL      = MainWindow.BL.Lorder(item => item.HostingUnitKey == h.HostingUnitKey);
            UpdateOrder_Grid.ItemsSource = orderL;
        }
 private void hostingComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (this.hostingComboBox.SelectedItem is BE.HostingUnit)
     {
         this.hosting = ((BE.HostingUnit) this.hostingComboBox.SelectedItem).GetCopy();
         //MessageBox.Show(hosting.HostingUnitName);
         tmp.HostingunitKey = hosting.Hostingunitkey;
     }
 }
        public AddOrderWindow(BE.HostingUnit hostingUnit)
        {
            InitializeComponent();

            DataContext = this;
            AddOrder_Grid.ItemsSource = guestL;

            order = new BE.Order();
            order.HostingUnitKey = hostingUnit.HostingUnitKey;
        }
        public UpdateHostingUnitWindow2()
        {
            InitializeComponent();
            hosting     = new BE.HostingUnit();
            DataContext = hosting;
            bl          = BL.FactoryBL.GetBL();

            HostingUnitKey.ItemsSource = bl.GetAllHostingUnits();
            //HostingUnitKey.SelectedValuePath = "HostingUnitKey";
        }
 private void hostingComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (this.hostingComboBox.SelectedItem is BE.HostingUnit)
     {
         this.tmp2 = ((BE.HostingUnit) this.hostingComboBox.SelectedItem).GetCopy();
         //MessageBox.Show(hosting.HostingUnitName);
         this.DataContext = tmp2;
     }
     //this.DataContext = hosting;
 }
Ejemplo n.º 25
0
 private void BLogOut_Click(object sender, RoutedEventArgs e) //when we click on the button LOG OUT
 {
     hostU                                = null;
     hostU                                = new BE.HostingUnit();
     hostU.Owner                          = new BE.Host();
     hostU.Owner.BankBranchH              = new BE.BankBranch();
     this.DataContext                     = hostU;
     PrivateAreaBorder.Visibility         = Visibility.Collapsed;
     PrivateAreaPasswordBorder.Visibility = Visibility.Visible;
     HostingUkey.Password                 = "";
 }
Ejemplo n.º 26
0
        public void AddHostingUnit(BE.HostingUnit H)
        {
            if (H.HostingUnitKey == 0)
            {
                H.HostingUnitKey = BE.Configuration.HostingUnitKeySt;
                H.DiaryDto       = new bool[31 * 12];
                //H.Diary=new bool[31 , 12];
            }

            DS.DataSource.HostingUnitsList.Add(H.Copy());
        }
        public DaleteHostingUnit()
        {
            tmp2 = null;
            InitializeComponent();
            bl = BL.Factory.GetInstance();

            this.hostingComboBox.ItemsSource = bl.GetAllHostingUnit();

            this.hostingComboBox.DisplayMemberPath = "Hostingunitkey";
            this.hostingComboBox.SelectedValuePath = "Hostingunitkey";
        }
 public AddHostingUnit()
 {
     InitializeComponent();
     hostingunit = new BE.HostingUnit();
     bl          = BL.Factory.GetInstance();
     this.areaComboBox.ItemsSource = Enum.GetValues(typeof(BE.Area));
     this.DataContext             = hostingunit;
     this.Owner.ItemsSource       = bl.GetAllHost();
     this.Owner.DisplayMemberPath = "PrivateName";
     this.Owner.SelectedValuePath = "Hostkey";
 }
 public UpdateHostingUnit(BE.HostingUnit H)
 {
     InitializeComponent();
     bl               = BL.FactoryBL.GetBL();
     hostUnit         = H;
     this.DataContext = hostUnit;
     this.BankBranchComboBox.ItemsSource = bl.bankBranchesList();
     UpdateGrid.Height             = this.Height;
     UpdateGrid.Width              = this.Width;
     this.AreaComboBox.ItemsSource = Enum.GetValues(typeof(BE.AREA));
     this.TypeComboBox.ItemsSource = Enum.GetValues(typeof(BE.TYPE));
 }
Ejemplo n.º 30
0
        private void list_SelectionChanged(object sender, SelectionChangedEventArgs e)//https://social.msdn.microsoft.com/Forums/vstudio/en-US/194ee5ad-a3cf-48ae-8c0e-1aab84a1df97/how-to-get-wpf-listview-click-event?forum=wpf
        {
            HostingShow = (BE.HostingUnit)list.SelectedItem;

            if (HostingShow != null)
            {
                //int id = int.Parse(selectedrow.Row.ItemArray[0].ToString());
                //Console.WriteLine(id);
                //Console.WriteLine(bl.getGuestRequestByID(40000000 + id));
                ///////////////////////////////////////////Console.WriteLine(GRShow.ToString());  ?????
            }
        }