public Activity_detail_View(string Activity_name, DateTime startdate) { InitializeComponent(); Activity_ViewModel activity_ViewModel = new Activity_ViewModel(); List<BitmapImage> activity_photos = activity_ViewModel.SelectActivity_byActivity_no(Activity_name, startdate); this.Lab_activity_name.Content = activity_ViewModel.Activity_name; this.Lab_activity_type.Content = activity_ViewModel.Activity_type; this.Lab_group.Content = activity_ViewModel.Group; this.Lab_activity_startdate.Content = activity_ViewModel.Activity_startdate; this.Lab_activity_enddate.Content = activity_ViewModel.Activity_enddate; this.Lab_undertake_unit.Content = activity_ViewModel.Undertake_unit; this.Lab_undertake.Content = activity_ViewModel.Undertaker; this.Lab_undertake_phone.Content = activity_ViewModel.Undertake_phone; this.Lab_undertake_email.Content = activity_ViewModel.Undertake_email; this.Lab_lecturer.Content = activity_ViewModel.Lecturer; this.Lab_Member.Content = activity_ViewModel.Member; this.Lab_Spare.Content = activity_ViewModel.Spare; this.Lab_Place.Content = activity_ViewModel.Place; this.Summary.Text = activity_ViewModel.Summary; this.Home_photo.Source = activity_ViewModel.Home_image; foreach (var row in activity_photos) { System.Windows.Controls.Image image = new System.Windows.Controls.Image(); image.Source = row; this.Photos.Children.Add(image); } }
public Volunteer_detail(int Volunteer_no) { InitializeComponent(); Volunteer_ViewModel volunteer_ViewModel = new Volunteer_ViewModel(); volunteer_ViewModel.SelectVolunteer_byVolunteerno(Volunteer_no); this.Chinese_name_Label.Content = volunteer_ViewModel.Chinese_name; this.English_name_Label.Content = volunteer_ViewModel.English_name; this.Sex_Label.Content = volunteer_ViewModel.Sex; this.Birthday_Label.Content = volunteer_ViewModel.Birthday; this.IDcrad_Label.Content = volunteer_ViewModel.IDcrad_no; this.Medical_record_no_Label.Content = volunteer_ViewModel.Medical_record_no; this.Identity_type_Label.Content = volunteer_ViewModel.Identity_type; this.Seniority_Label.Content = volunteer_ViewModel.Seniority; this.Join_date_Label.Content = volunteer_ViewModel.Join_date; this.Leave_date_Label.Content = volunteer_ViewModel.Leave_date; this.Leave_reason_Label.Content = volunteer_ViewModel.Leave_reason; this.Phone_no_Label.Content = volunteer_ViewModel.Phone_no; this.Mobile_no_Label.Content = volunteer_ViewModel.Mobile_no; this.Vest_no_Label.Content = volunteer_ViewModel.Vest_no; this.Postal_code_Label.Content = volunteer_ViewModel.Postal_code; this.Address_Label.Content = volunteer_ViewModel.Address; this.Education_Label.Content = volunteer_ViewModel.Education; this.Lssuing_unit_Label.Content = volunteer_ViewModel.Lssuing_unit; this.Service_manual_no_Label.Content = volunteer_ViewModel.Service_manual_no; this.Personality_scale_Label.Content = volunteer_ViewModel.Personality_scale; this.Photo.Source = volunteer_ViewModel.Photo; this.Leader_list_Label.Content = volunteer_ViewModel.Leader_list; this.Experise_list_Label.Content = volunteer_ViewModel.Experise_list; ObservableCollection <Activity_list> activity_list = new ObservableCollection <Activity_list>(); Activity_ViewModel activity_ViewModel = new Activity_ViewModel(); List <Activity_ViewModel> activity_ViewModel_list = activity_ViewModel.SelectVolunteer_ActivitybyVolunteerno(Volunteer_no); foreach (var row in activity_ViewModel_list) { activity_list.Add(new Activity_list() { 活動編號 = row.Activity_no, 活動名稱 = row.Activity_name, 活動承辦人 = row.Undertaker }); } Activity_datagrid.ItemsSource = activity_list; }
private void btn_selectactivity_Click(object sender, RoutedEventArgs e) { Activity_ViewModel activity_ViewModel = new Activity_ViewModel(); DateTime startdate = ((dp_startdate.SelectedDate == null) ? DateTime.Parse("2000/01/01") : (DateTime)dp_startdate.SelectedDate); DateTime enddate = ((dp_startdate.SelectedDate == null) ? DateTime.Parse("3000/01/01") : (DateTime)dp_enddate.SelectedDate); string activitytype = cbb_activitytype.Text; string activitygroup = cbb_activitygroup.Text; List <Activity_ViewModel> activity_viewmodels = activity_ViewModel.SelectActivity_byActivity_no(startdate, enddate, activitytype, activitygroup); ObservableCollection <activity_list> activity_itemlist = new ObservableCollection <activity_list>(); foreach (var row in activity_viewmodels) { activity_itemlist.Add(new activity_list() { 活動名稱 = row.Activity_name, 活動類別 = row.Activity_type, 組別 = row.Group, 活動起始時間 = row.Activity_startdate, 活動結束時間 = row.Activity_enddate, 課程人數 = row.Member }); } this.dg_activity.ItemsSource = activity_itemlist; }