private void Back_Click(object sender, RoutedEventArgs e)
        {
            Window hostwin = new HostWindow(username);

            hostwin.Show();
            this.Close();
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            HostWindow h = new HostWindow();

            this.Close();
            h.ShowDialog();
        }
Example #3
0
        private void cancelButton_Click(object sender, RoutedEventArgs e)
        {
            Window HostingUnitWindow = new HostWindow(username);

            HostingUnitWindow.Show();
            this.Close();
        }
Example #4
0
        //private void setHostingUnitFields()
        //{
        //    this.UpdateHostingUnitGrid.DataContext = HostingUnit;
        //    this.hostingUnitNameTextBox.Text = HostingUnit.HostingUnitName;
        //}
        private void ButtonUpdate_Click(object sender, RoutedEventArgs e)
        {
            if (IsMissingDetails() == false)
            {
                MessageBox.Show("Missing Information ", "", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            Close();
            try
            {
                myBL.UpdateHostingUnit(HostingUnit);
                MessageBox.Show("Hosting unit update successfully", "", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.None, MessageBoxOptions.RtlReading | MessageBoxOptions.RightAlign);
                Close();
                HostWindow w = new HostWindow(host);
                w.ShowDialog();
                // gardenComboBox.Text = null;
                // jacuzziComboBox.Text = null;
                // poolComboBox.Text = null;
                // spookyComboBox.Text = null;
                // typeComboBox.Text = null;
                // childrensAttractionsComboBox.Text = null;
                // areaComboBox.Text = null;
                // hostingUnitNameTextBox.Text = "";

                //HostingUnit = new BE.HostingUnit();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Inner exception", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.None, MessageBoxOptions.RtlReading | MessageBoxOptions.RightAlign);
                //setHostingUnitFields();
                return;
            }
        }
        public void AddNewUnit_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                if (hostingUnitList.FirstOrDefault() == null)
                {
                    var result = from item in myBL.GetHosts()
                                 where item.HostKey.CompareTo(number) == 0
                                 select item;
                    AddHostingUnitWindow HostingUnit = new AddHostingUnitWindow(result.FirstOrDefault());
                    HostingUnit.ShowDialog();
                    Close();
                    HostWindow window1 = new HostWindow(host);
                    window1.ShowDialog();
                    return;
                }
                AddHostingUnitWindow newHostingUnit = new AddHostingUnitWindow(hostingUnitList.FirstOrDefault().Owner);
                newHostingUnit.ShowDialog();
                Close();

                HostWindow window = new HostWindow(host);
                window.ShowDialog();
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message, "exception", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            Close();
        }
        private void backButton_Click(object sender, RoutedEventArgs e)
        {
            Window hosttWindow = new HostWindow(username);

            hosttWindow.Show();
            this.Close();
        }
Example #7
0
        private void Button_Click_EnterAsHost(object sender, RoutedEventArgs e)
        {
            if (HostKey.Text == "")
            {
                MessageBox.Show("Enter a host key", "", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            var result = from item in myBL.GetHosts()
                         where item.HostKey.CompareTo(HostKey.Text) == 0
                         select item;

            if (result.Count() == 0)
            {
                HostKey.Text = "";
                MessageBox.Show("There is no host with this key", "", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else
            {
                //var result2 = from item in myBL.GetHostingUnitCopy()
                //              where item.Owner.HostKey.CompareTo(HostKey.Text) == 0
                //              select item;
                HostWindow window = new HostWindow(result.Single());
                Close();
                window.ShowDialog();
                Close();
            }
        }
Example #8
0
        private void btnHost_Click(object sender, RoutedEventArgs e)
        {
            Window Host = new HostWindow();

            this.Hide();
            Host.ShowDialog();
            this.Show();
        }
Example #9
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (index2 == -1)
     {
         HostWindow hw = new HostWindow();
         this.Close();
         hw.ShowDialog();
     }
     else
     {
         PrivateArea p = new PrivateArea(index2);
         this.Close();
         p.ShowDialog();
     }
 }
 private void mouseRemoveClick(object sender, RoutedEventArgs e)
 {
     try
     {
         hostingUnit.Owner           = hostingUnitList.FirstOrDefault().Owner;
         hostingUnit.HostingUnitKey  = hostingUnitList.FirstOrDefault().HostingUnitKey;
         hostingUnit.HostingUnitName = hostingUnitList.FirstOrDefault().HostingUnitName;
         myBL.RemoveHostingUnit(hostingUnit.HostingUnitKey);
         MessageBox.Show("The hosting unit was removed successfuly", "", MessageBoxButton.OK, MessageBoxImage.Information);
         Close();
         HostWindow w = new HostWindow(host);
         w.ShowDialog();
     }
     catch
     {
         MessageBox.Show("Inner exception", "exception", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
        private void Submit_Click(object sender, RoutedEventArgs e)
        {
            if (txtUsername.Text.Length == 0)
            {
                MessageBox.Show("Enter a username");
            }
            else
            {
                if (txtPassword.Password.Length == 0)
                {
                    MessageBox.Show("Enter a password.");
                }
                if (txtUsername.Text == "Admin" && txtPassword.Password == "admin")
                {
                    AdminMainWindow admin = new AdminMainWindow();
                    admin.Show();
                    this.Close();
                }
                else
                {
                    if (!checkInputGuest() && !checkInputHost())
                    {
                        MessageBox.Show("username or password incorrect, fix or register");
                    }
                    else
                    {
                        if (checkInputHost())
                        {
                            HostWindow ho = new HostWindow(txtUsername.Text);
                            ho.Show();
                            this.Close();
                        }

                        if (checkInputGuest())
                        {
                            Welcome welcomeWindow = new Welcome();
                            welcomeWindow.Show();
                            this.Close();
                        }
                    }
                }
            }
        }
 private void UpdateOrder(object sender, RoutedEventArgs e)
 {
     try
     {
         order = (Order)OrdersList.SelectedItem;
         //order.OrderKey = o.FirstOrDefault().OrderKey;
         //order.GuestRequestKey = o.FirstOrDefault().GuestRequestKey;
         //order.HostingUnitKey = o.FirstOrDefault().HostingUnitKey;
         //order.HostingUnitName = o.FirstOrDefault().HostingUnitName;
         //order.Status = o.FirstOrDefault().Status;
         //order.OrderDate = o.FirstOrDefault().OrderDate;
         //order.CreateDate = o.FirstOrDefault().CreateDate;
         myBL.UpdateOrder(order);
         Close();
         HostWindow window = new HostWindow(host);
         window.ShowDialog();
     }
     catch
     {
         MessageBox.Show("Can't update the order", "", MessageBoxButton.OK, MessageBoxImage.Warning);
         return;
     }
 }
Example #13
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            int error = 0;

            try
            {
                if (hostingUnitName1TextBox.Text == "" && error == 0)//need to fill out name (we dont care if his name is a number)
                {
                    MessageBox.Show("need to fill out  name");
                    error++;
                }
                else if (commission1TextBox.Text == "" && error == 0)
                {
                    MessageBox.Show("need to fill out comission");
                    error++;
                }



                if (error == 0)
                {
                    bl.UpdateHostingUnit(unit);
                    MessageBox.Show("Guest Request updated, Key: " + unit.HostingUnitKey1);
                    Window hWindow = new HostWindow(username);
                    hWindow.Show();
                    this.Close();
                }
            }
            catch (FormatException)
            {
                MessageBox.Show("Please check your input and try again");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #14
0
        private void addButton_Click(object sender, RoutedEventArgs e)
        {
            int  numberOfCommish;
            bool numVal = int.TryParse(commission1TextBox.Text, out numberOfCommish);

            try
            {
                unit.Owner1 = new BE.Host();
                unit.Owner1 = owner;
                if (hostingUnitNameTextBox.Text == "")
                {
                    MessageBox.Show("must enter a HostingUnit name!");
                    hostingUnitNameTextBox.Clear();
                    hostingUnitNameTextBox.Focus();
                }
                else if (commission1TextBox.Text == "" || numberOfCommish <= 0 || (numVal == false))
                {
                    MessageBox.Show("must enter HostingUnit Commision!");
                    commission1TextBox.Clear();
                    commission1TextBox.Focus();
                }
                else if (Area1.Text == "Please Select")
                {
                    MessageBox.Show("must enter HostingUnit Area!");
                    Area1.Focus();
                }
                else
                {
                    string selected1 = Area1.SelectedItem.ToString();
                    selected1 = selected1.Substring(selected1.IndexOf(' '));

                    if (selected1 == " North")
                    {
                        unit.AreaOfHostingUnit = BEEnum.Area.North;
                    }
                    else if (selected1 == " South")
                    {
                        unit.AreaOfHostingUnit = BEEnum.Area.South;
                    }
                    else if (selected1 == " Center")
                    {
                        unit.AreaOfHostingUnit = BEEnum.Area.Center;
                    }
                    else if (selected1 == " Jerusalem")
                    {
                        unit.AreaOfHostingUnit = BEEnum.Area.Jerusalem;
                    }

                    bl.AddHostingUnit(unit);
                    MessageBox.Show("Hosting Unit Added, Key:" + unit.HostingUnitKey1);
                    this.DataContext = unit;
                    Window HostingUnitWindow = new HostWindow(username);
                    HostingUnitWindow.Show();
                    this.Close();
                }
            }

            catch (FormatException)
            {
                MessageBox.Show("Please check your input and try again");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #15
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Window HostWindow = new HostWindow();

            HostWindow.ShowDialog();
        }
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.DeletePrivateNameTextBox.Text != "" && this.DeleteKeyTextBox.Text != "")
            {
                MessageBox.Show("please enter only one field, byname or by key.");
                UpdateKey.Clear();
                UpdatePrivateNameTextBox.Clear();
                DeleteKeyTextBox.Clear();
                DeletePrivateNameTextBox.Clear();
                //Window UpdateDeleteByWindow = new updeletebyunit(username);
                //UpdateDeleteByWindow.Show();
                //this.Close();
            }

            else if (this.DeletePrivateNameTextBox.Text != "")
            {
                try
                {
                    unit = bl.GetHostingUnitByName(this.DeletePrivateNameTextBox.Text);
                    long tempkey = unit.HostingUnitKey1;
                    bl.DeleteHostingUnit(unit);
                    MessageBox.Show("Unit deleted, Key: " + tempkey);
                    Window GuestRequestWindow = new HostWindow(username);
                    GuestRequestWindow.Show();
                    this.Close();
                }
                catch (Exception exx)
                {
                    if (exx.Message.Contains(':'))
                    {
                        MessageBox.Show("unit does not exist or " + exx.Message.Substring(exx.Message.IndexOf(':')));
                    }
                    else
                    {
                        MessageBox.Show("unit does not exist or " + exx.Message);
                    }
                    Window GuestRequestWindow = new HostWindow(username);
                    GuestRequestWindow.Show();
                    this.Close();
                }
            }
            else if (this.DeleteKeyTextBox.Text != "")
            {
                try
                {
                    unit = bl.GetHostingUnitByKey(long.Parse(this.DeleteKeyTextBox.Text));
                    long tempkey = unit.HostingUnitKey1;
                    bl.DeleteHostingUnit(unit);
                    MessageBox.Show("unit deleted, Key: " + tempkey);
                    Window hostWindow = new HostWindow(username);
                    hostWindow.Show();
                    this.Close();
                }
                catch (Exception)
                {
                    MessageBox.Show("unit does not exist");
                    Window GuestRequestWindow = new HostWindow(username);
                    GuestRequestWindow.Show();
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("unit does not exist, " +
                                "or you entered info into wrong fields");
            }
        }