コード例 #1
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);
            }
        }