예제 #1
0
        private void sendComment_Click(object sender, EventArgs e)
        {
            UserRating rating = new UserRating();

            rating.personName  = textBox1.Text;
            rating.description = textBox1.Text;

            try
            {
                UserRatingClient client = new UserRatingClient();
                using (new OperationContextScope(client.InnerChannel))
                {
                    Program.AddAccessHeaders();
                    client.addUserRating(rating, 181, _ID);
                }

                RommServiceClient client2 = new RommServiceClient();
                using (new OperationContextScope(client2.InnerChannel))
                {
                    Program.AddAccessHeaders();
                    RoomDto room = client2.getRoomDto(_ID);
                }

                if (room.userRatings != null)
                {
                    flowLayoutPanel2.Controls.Clear();
                    foreach (var item in room.userRatings.Reverse())
                    {
                        CommentItem comment = new CommentItem(item.personName, item.description);
                        flowLayoutPanel2.Controls.Add(comment);
                    }
                }
                //SetRoomDetails(_ID);

                MessageBox.Show("Comment succesfully added!", "Comment", MessageBoxButtons.OK);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Comment", MessageBoxButtons.OK);
            }

            textBox1.Text = "";
        }
예제 #2
0
        private void SetRoomDetails(long id)
        {
            RommServiceClient client = new RommServiceClient();

            room = client.getRoomDto(id);

            nameRoom.Text       = room.name;
            descriptionTb.Text  = room.description;
            pricePerPerson.Text = "Price per person: " + room.pricePerPerson + "$";
            persons.Text        = "Max persons: " + room.maxPersons;
            idTb.Text           = _ID + ":" + room.id;

            if (room.equipments != null)
            {
                listView2.View = View.List;

                foreach (var item in room.equipments)
                {
                    var listViewItem = new ListViewItem(item);
                    listView2.Items.Add(listViewItem);
                }
            }

            if (room.photos != null)
            {
                pictureBox1.Image = GetBitmapFromUrl(room.photos[0]);

                listView1.View     = View.Tile;
                listView1.TileSize = new Size(100, 100);

                myImageList           = new ImageList();
                myImageList.ImageSize = new Size(90, 90);
                foreach (var item in room.photos)
                {
                    myImageList.Images.Add(GetBitmapFromUrl(item));
                }

                listView1.LargeImageList = myImageList;
                for (int j = 0; j < myImageList.Images.Count; j++)
                {
                    ListViewItem item = new ListViewItem();
                    item.ImageIndex = j;
                    listView1.Items.Add(item);
                }
            }

            if (room.rules != null)
            {
                //listView3.View = View.Tile;
                //listView1.TileSize = new Size(100, 40);
                foreach (var item in room.rules)
                {
                    RuleItemcs rule = new RuleItemcs(item.name, item.description);
                    flowLayoutPanel1.Controls.Add(rule);
                    //TextBox lvi = new TextBox();
                    //lvi.Multiline = true;
                    //lvi.Width = 260;
                    //lvi.Text = "["+item.name+"] \n";
                    //lvi.Text += item.description;
                    //listView3.Items.Add(lvi);
                }
            }

            if (room.userRatings != null)
            {
                foreach (var item in room.userRatings)
                {
                    CommentItem comment = new CommentItem(item.personName, item.description);
                    flowLayoutPanel2.Controls.Add(comment);
                }
            }

            price.Text = "Price: " + room.maxPersons * room.pricePerPerson + "$";
        }