Exemple #1
0
        private void LogOffButton_Click(object sender, EventArgs e)
        {
            CurrentUser.getInstance().currentClient = null;
            LoginForm nazad = new LoginForm();

            nazad.Show();
            this.Hide();
        }
Exemple #2
0
        public static bool pokemon(Hotel hotel)
        {
            Client charizard = CurrentUser.getInstance().currentClient;

            if (hotel.TotalPrice > charizard.Money || hotel.Owner != null)
            {
                return(false);
            }
            hotel.Owner      = charizard;
            charizard.Money -= hotel.TotalPrice;
            return(true);
        }
Exemple #3
0
 public static bool LogIn(string login, string password)
 {
     foreach (Client client in Storage.Clients)
     {
         if (client.isThis(login, password))
         {
             CurrentUser.getInstance().currentClient = client;
             return(true);
         }
     }
     return(false);
 }
Exemple #4
0
        public static bool reserve(Hotel pomidorka)
        {
            Client pikachu = CurrentUser.getInstance().currentClient;

            if (pikachu.Money <= pomidorka.Price || pomidorka.Free == 0)
            {
                return(false);
            }
            pikachu.Money -= pomidorka.Price;
            pomidorka.Free--;
            pikachu.BookedHotels.Add(pomidorka);
            return(true);
        }
Exemple #5
0
        private void ConfirmButton_Click(object sender, EventArgs e)
        {
            Client user = CurrentUser.getInstance().currentClient;

            if (NameEditBox.Text != "")
            {
                user.Name = NameEditBox.Text;
                MainPage confirm = new MainPage();
                this.Hide();
            }
            if (SurnameEditBox.Text != "")
            {
                user.Surname = SurnameEditBox.Text;
                MainPage confirm = new MainPage();
                this.Hide();
            }
            if (PasswordEdit1Box.Text == user.Password)
            {
                if (PasswordEdit2Box.Text == PasswordEdit3Box.Text)
                {
                    if (PasswordEdit3Box.Text != "")
                    {
                        user.Password = PasswordEdit3Box.Text;
                        MainPage confirm = new MainPage();
                        this.Hide();
                    }
                    else
                    {
                        playerbaka.Play();
                        MessageBox.Show("BAAKAAA");
                    }
                }
                else
                {
                    playerbaka.Play();
                    MessageBox.Show("BAAKAAA");
                }
            }
            if (PasswordEdit1Box.Text == "" && PasswordEdit2Box.Text == "" && PasswordEdit3Box.Text == "")
            {
                mpage.Redraw();
                this.Hide();
            }
        }
Exemple #6
0
        public void Redraw()
        {
            NameLabel.Text     = CurrentUser.getInstance().currentClient.Name;
            SurnameLabel.Text  = CurrentUser.getInstance().currentClient.Surname;
            BallanceLabel.Text = CurrentUser.getInstance().currentClient.Money.ToString();

            BookedView.Clear();
            BookedView.Visible = true;
            BookedView.View    = View.Details;
            BookedView.Columns.Add("Address", 46);
            BookedView.Columns.Add("Name", 37);
            BookedView.Columns.Add("Total Price", 53);
            BookedView.Columns.Add("Price", 38);
            BookedView.Columns.Add("Free", 36);
            BookedView.Columns.Add("Owner", 37);

            SearchResultView.Clear();
            SearchResultView.Visible = true;
            SearchResultView.View    = View.Details;
            SearchResultView.Columns.Add("Address", 53);
            SearchResultView.Columns.Add("Name", 50);
            SearchResultView.Columns.Add("Total Price", 55);
            SearchResultView.Columns.Add("Price", 50);
            SearchResultView.Columns.Add("Free", 50);
            SearchResultView.Columns.Add("Owner", 53);

            SearchResultView.Items.Clear();
            foreach (var hotel in result)
            {
                ListViewItem item;
                String[]     resultFields = new String[6];
                resultFields[0] = hotel.Address.ToString();
                resultFields[1] = hotel.Name.ToString();
                resultFields[2] = hotel.TotalPrice.ToString();
                resultFields[3] = hotel.Price.ToString();
                resultFields[4] = hotel.Free.ToString();
                if (hotel.Owner == null)
                {
                    resultFields[5] = "nobody";
                }
                else
                {
                    resultFields[5] = hotel.Owner.Name + " " + hotel.Owner.Surname;
                }
                item = new ListViewItem(resultFields);
                SearchResultView.Items.Add(item);
            }

            BookedView.Items.Clear();
            foreach (var hotel in CurrentUser.getInstance().currentClient.BookedHotels)
            {
                ListViewItem item;
                String[]     resultFields = new String[6];
                resultFields[0] = hotel.Address.ToString();
                resultFields[1] = hotel.Name.ToString();
                resultFields[2] = hotel.TotalPrice.ToString();
                resultFields[3] = hotel.Price.ToString();
                resultFields[4] = hotel.Free.ToString();
                if (hotel.Owner == null)
                {
                    resultFields[5] = "nobody";
                }
                else
                {
                    resultFields[5] = hotel.Owner.Name + " " + hotel.Owner.Surname;
                }
                item = new ListViewItem(resultFields);
                BookedView.Items.Add(item);
            }
        }