Exemple #1
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.tipsWindow = ((Milestone_2.TipsWindow)(target));
                return;

            case 2:
                this.tipsForBusinessDataGrid = ((System.Windows.Controls.DataGrid)(target));
                return;
            }
            this._contentLoaded = true;
        }
        // Function that is used to display a chart for all the tips written about a certain business
        // by opening a new window using the tipsWindow class
        private void showTipsButton_Click(object sender, RoutedEventArgs e)
        {
            if (searchResultsDataGrid.SelectedIndex > -1)
            {
                Business   business   = (Business)searchResultsDataGrid.SelectedItem;
                TipsWindow tipsWindow = new TipsWindow();

                string query = String.Format("select u.name, t.date, t.tip, t.likes from yelp_user u, " +
                                             "yelp_tip t, yelp_business b where b.bid = t.bid and u.uid = " +
                                             "t.uid and b.bid = '{0}'order by date desc", business.bid);

                var data = database.RunQuery(query);
                PopulateDataGrid(tipsWindow.tipsForBusinessDataGrid, data, typeof(Tip));
                tipsWindow.SetTitle(String.Format("Tips for {0}", business.bname));
                tipsWindow.Show();
            }
        }