private void datagrid_show(SelectStage selectstage) { this.dg_abnormal_event.ItemsSource = null; string category = this.cbb_category.Text; string application_unit = this.cbb_application_unit.Text; DateTime startdate = ((dp_startdate.SelectedDate == null) ? DateTime.MinValue : (DateTime)dp_startdate.SelectedDate); DateTime enddate = ((dp_enddate.SelectedDate == null) ? DateTime.MinValue : (DateTime)dp_enddate.SelectedDate); List <Abnormal_event_ViewModel> abnormal_events = new List <Abnormal_event_ViewModel>(); Abnormal_event_ViewModel abnormal_Event_ViewModel = new Abnormal_event_ViewModel(); ObservableCollection <abnormal_event_list> abnormal_event_itemlist = new ObservableCollection <abnormal_event_list>(); switch (selectstage) { case SelectStage.nostage: abnormal_events = abnormal_Event_ViewModel.SelectAbnormal_Event_byStage("", category, application_unit, startdate, enddate); break; case SelectStage.newevent: abnormal_events = abnormal_Event_ViewModel.SelectAbnormal_Event_byStage("新事件", category, application_unit, startdate, enddate); break; case SelectStage.review: abnormal_events = abnormal_Event_ViewModel.SelectAbnormal_Event_byStage("成案審核", category, application_unit, startdate, enddate); break; case SelectStage.processing: abnormal_events = abnormal_Event_ViewModel.SelectAbnormal_Event_byStage("處理中", category, application_unit, startdate, enddate); break; case SelectStage.endprocessing: abnormal_events = abnormal_Event_ViewModel.SelectAbnormal_Event_byStage("事件完成", category, application_unit, startdate, enddate); break; } foreach (var row in abnormal_events) { abnormal_event_itemlist.Add(new abnormal_event_list() { 事件案號 = row.Abnormal_event_ID, 事件名稱 = row.Abnormal_event, 異常事件類別 = row.event_category, 志工 = row.Volunteer_name, 運用單位 = row.Application_unit, 處理階段 = row.Stage, 通報時間 = row.Notification_date, 結案時間 = row.Closing_date }); } this.dg_abnormal_event.ItemsSource = abnormal_event_itemlist; if (selectstage == SelectStage.nostage) { this.dg_abnormal_event.Columns[0].Visibility = Visibility.Collapsed; } else { this.dg_abnormal_event.Columns[0].Visibility = Visibility.Visible; } }
public Abnormal_event() { InitializeComponent(); Abnormal_event_ViewModel abnormal_Event_ViewModel = new Abnormal_event_ViewModel(); List <string> event_categorys = abnormal_Event_ViewModel.Selectevent_category(); List <string> Application_unit_names = abnormal_Event_ViewModel.SelectApplication_unit_name(); this.cbb_category.ItemsSource = event_categorys; this.cbb_application_unit.ItemsSource = Application_unit_names; }
public Abnormal_event_detail(string event_ID) { InitializeComponent(); Abnormal_event_ViewModel abnormal_Event_ViewModel = new Abnormal_event_ViewModel(); abnormal_Event_ViewModel.SelectAbnormal_event_byAbnormal_event_ID(event_ID); this.lab_abnormal_event_ID.Content = abnormal_Event_ViewModel.Abnormal_event_ID; this.lab_supervisor.Content = abnormal_Event_ViewModel.Supervisor; this.lab_abnormal_event.Content = abnormal_Event_ViewModel.Abnormal_event; this.lab_supervisor_heads.Content = abnormal_Event_ViewModel.Supervisor_heads; this.lab_event_category.Content = abnormal_Event_ViewModel.event_category; this.lab_Volunteer_leader.Content = abnormal_Event_ViewModel.Volunteer_leader; this.lab_volunteer_name.Content = abnormal_Event_ViewModel.Volunteer_name; this.lab_application_unit.Content = abnormal_Event_ViewModel.Application_unit; this.lab_stage.Content = abnormal_Event_ViewModel.Stage; this.lab_notification_date.Content = abnormal_Event_ViewModel.Notification_date; this.lab_closing_date.Content = abnormal_Event_ViewModel.Closing_date; this.lab_result.Content = abnormal_Event_ViewModel.Result; this.txt_unit_descrition.Text = abnormal_Event_ViewModel.Unit_descrition; this.txt_volunteer_description.Text = abnormal_Event_ViewModel.Volunteer_description; this.txt_supervisor_description.Text = abnormal_Event_ViewModel.Supervisor_description; this.txt_rejection_reason.Text = abnormal_Event_ViewModel.Rejection_Reason; }