/// <summary> /// view partnership details button was clicked /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click(object sender, RoutedEventArgs e) { Button button = sender as Button; Partnership ad = button.DataContext as Partnership; DataTable dt = _controller.getAdvertisments(ad.Type, ad.Id); DataRow[] rows = dt.Select(); ViewPartnership vp = new ViewPartnership(ref _controller, rows[0], ad.Id, _userMail, ad.Type, ad.ManagerMail, false, rows[0][7].ToString()); vp.Show(); }
/// <summary> /// Display current user partnerships window /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void display_Click(object sender, RoutedEventArgs e) { string type = _interestArea[box_interest.SelectedItem.ToString()]; List <Partnership> ads = new List <Partnership>(); //Get user partnerships DataTable dt = _controller.getPreferencesForUserByType(type, _userMail); DataRow[] rows; if (dt != null) { //Display all partnerships rows = dt.Select(); foreach (DataRow r in rows) { string id = r[0].ToString(); DataTable prefercencePartners = _controller.getPartnershipsIdByPreferenceId(type, id); if (prefercencePartners != null) { foreach (DataRow partnershipId in prefercencePartners.Rows) { DataTable partnership = _controller.getPartnershipById(type, partnershipId[0].ToString()); if (partnership != null) { foreach (DataRow result in partnership.Select()) { Partnership a = new Partnership() { Id = result[0].ToString(), ManagerMail = result[1].ToString(), Date = result[3].ToString(), Type = _interestArea[box_interest.SelectedItem.ToString()], NumOfPartners = result[7].ToString(), }; ads.Add(a); } } } } } listView.ItemsSource = ads; listView.Visibility = Visibility.Visible; } else { MessageBox.Show("לא קיימות לך שותפויות בתחום."); } }