//按钮:查看详细信息 private void ViewDetails(object sender, RoutedEventArgs e) { //查看征状详细信息 if (is_signinformationrecord.IsChecked == true) { ViewSymptomInformation viewSymptomInformation = new ViewSymptomInformation { Owner = Window.GetWindow(this), ShowActivated = true, ShowInTaskbar = false, WindowStartupLocation = WindowStartupLocation.CenterScreen }; List <TrainInfo> list = new List <TrainInfo>(); TrainInfo trainInfo = new TrainInfo { Gmt_Create = new DateTime(2012, 01, 02) }; list.Add(trainInfo); Console.WriteLine(trainInfo.Gmt_Create); list.Add(trainInfo); if (record.Content == null) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择症状信息再进行操作!", "Please Select A Symptom Info!")); return; } DataGrid dataGrid = ((SignInformationRecord_Frame)record.Content).SignInformationRecord; SymptomInfoDTO symptomInfoDto = (SymptomInfoDTO)dataGrid.SelectedItem; User user = (User)UsersInfo.SelectedItem; if (user == null) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择用户再进行操作!", "Please Select A Subject!")); return; } if (symptomInfoDto == null) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择症状信息再进行操作!", "Please Select A Symptom Info!")); return; } Dictionary <string, Object> dictionary = new Dictionary <string, object>(); dictionary.Add("user", user); dictionary.Add("symptomInfoDto", symptomInfoDto); viewSymptomInformation.DataContext = dictionary; viewSymptomInformation.ShowDialog(); } //打开训练详细信息 else if (is_trainingrecord.IsChecked == true) { ViewTrainingResults viewTrainingResults = new ViewTrainingResults { Owner = Window.GetWindow(this), ShowActivated = true, ShowInTaskbar = false, WindowStartupLocation = WindowStartupLocation.CenterScreen }; Object o = record.Content; TrainDTO trainDto = null; User user = (User)UsersInfo.SelectedItem; if (o is TrainingRecord_Frame) { TrainingRecord_Frame trainingRecordFrame = (TrainingRecord_Frame)o; int index = trainingRecordFrame.TabControl1.SelectedIndex; switch (index) { case 0: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord1.SelectedItem; break; case 1: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord2.SelectedItem; break; case 2: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord3.SelectedItem; break; case 3: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord4.SelectedItem; break; case 4: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord5.SelectedItem; break; case 5: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord6.SelectedItem; break; } } if (user == null) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择用户再进行操作!", "Please Select A Subject!")); return; } if (trainDto == null) {//判断是否选择了训练信息 MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择训练信息再进行操作!", "Please Select A Train Info!")); return; } Dictionary <string, Object> dic = new Dictionary <string, object>(); dic.Add("user", user); dic.Add("trainDto", trainDto); viewTrainingResults.DataContext = dic; viewTrainingResults.ShowDialog(); } //打开体力评价详细信息 else if (is_physicalevaluation.IsChecked == true) { ViewManualMvaluation viewManualMvaluation = new ViewManualMvaluation { Owner = Window.GetWindow(this), ShowActivated = true, ShowInTaskbar = false, WindowStartupLocation = WindowStartupLocation.CenterScreen }; Object o = record.Content; PhysicaleDTO physicaleDto = null; User user = (User)UsersInfo.SelectedItem; if (o is PhysicaleValuation_Frame) { PhysicaleValuation_Frame physicaleValuationFrame = (PhysicaleValuation_Frame)o; physicaleDto = (PhysicaleDTO)physicaleValuationFrame.PhysicaleValuation.SelectedItem; } if (user == null) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择用户再进行操作!", "Please Select A Subject!")); return; } if (physicaleDto == null) {//判断是否选择了训练信息 MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择体力评价再进行操作!", "Please Select A Physical Evalution!")); return; } Dictionary <string, Object> dic = new Dictionary <string, object>(); dic.Add("user", user); dic.Add("physicaleDto", physicaleDto); viewManualMvaluation.DataContext = dic; viewManualMvaluation.ShowDialog(); } }
//按钮:输入征状信息 private void InputSymptomInformation(object sender, RoutedEventArgs e) { Object o = record.Content; TrainDTO trainDto = null; User user = (User)UsersInfo.SelectedItem; if (o is TrainingRecord_Frame) { TrainingRecord_Frame trainingRecordFrame = (TrainingRecord_Frame)o; int index = trainingRecordFrame.TabControl1.SelectedIndex; switch (index) { case 0: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord1.SelectedItem; break; case 1: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord2.SelectedItem; break; case 2: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord3.SelectedItem; break; case 3: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord4.SelectedItem; break; case 4: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord5.SelectedItem; break; case 5: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord6.SelectedItem; break; } } if (user == null) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择用户再进行操作!", "Please Select A Subject!")); return; } //if (trainDto == null) //{ // //判断是否选择了训练信息 // MessageBox.Show(LanguageUtils.ConvertLanguage("请选择训练信息再进行操作!", "Please Select A Train Info!")); // return; //} InputSymptomInformation w2 = new InputSymptomInformation { Owner = Window.GetWindow(this), ShowActivated = true, ShowInTaskbar = false, WindowStartupLocation = WindowStartupLocation.CenterScreen }; Dictionary <string, Object> dic = new Dictionary <string, object>(); dic.Add("user", user); //dic.Add("trainDto", trainDto); w2.DataContext = dic; w2.ShowDialog(); Refresh_RecordFrame_Action(); }
/// <summary> /// 刷新右下角frame /// </summary> /// 给frame加入数据 private void Refresh_RecordFrame_Action() { User user = selectUser; if (user == null) { //MessageBox.Show("请选择用户"); return; } if (user.User_Name != "" && user.User_Name != null) { if (is_signinformationrecord.IsChecked == true) { List <SymptomInfo> symptomInfos = new SymptomService().GetByUserId(user); List <SymptomInfoDTO> symptomInfoDtos = new List <SymptomInfoDTO>(); foreach (SymptomInfo symptomInfo in symptomInfos) { symptomInfoDtos.Add(new SymptomInfoDTO(symptomInfo)); } //展示在frame SignInformationRecord_Frame signInformationRecordFrame = new SignInformationRecord_Frame();//(SignInformationRecord_Frame)o; signInformationRecordFrame.SignInformationRecord.ItemsSource = symptomInfoDtos; record.Content = signInformationRecordFrame; } else if (is_trainingrecord.IsChecked == true) { // Dictionary<int, List<TrainDTO>> dic = new TrainService().getTrainDTOByUser(user); Dictionary <int, List <TrainDTO> > dic = new TrainService().getTrainDTOByUserA(user); TrainingRecord_Frame trainingRecordFrame = new TrainingRecord_Frame(); List <TrainDTO> trainDtos = new List <TrainDTO>(); dic.TryGetValue((int)DeviceType.X01, out trainDtos); trainingRecordFrame.TrainingRecord1.ItemsSource = trainDtos; dic.TryGetValue((int)DeviceType.X05, out trainDtos); trainingRecordFrame.TrainingRecord2.ItemsSource = trainDtos; dic.TryGetValue((int)DeviceType.X04, out trainDtos); trainingRecordFrame.TrainingRecord3.ItemsSource = trainDtos; dic.TryGetValue((int)DeviceType.X03, out trainDtos); trainingRecordFrame.TrainingRecord4.ItemsSource = trainDtos; dic.TryGetValue((int)DeviceType.X06, out trainDtos); trainingRecordFrame.TrainingRecord5.ItemsSource = trainDtos; dic.TryGetValue((int)DeviceType.X02, out trainDtos); trainingRecordFrame.TrainingRecord6.ItemsSource = trainDtos; record.Content = trainingRecordFrame; } else if (is_physicalevaluation.IsChecked == true) { List <PhysicalPower> physicalPowers = new PhysicaleValuationService().GetByUserId(user); List <PhysicaleDTO> physicaleDTOs = new List <PhysicaleDTO>(); foreach (PhysicalPower physicalPower in physicalPowers) { PhysicaleDTO physicaleDTO = new PhysicaleDTO(physicalPower); //为空,说明有可能是不符合格式的数据 if (physicaleDTO.ID != null) { physicaleDTOs.Add(physicaleDTO); } } //展示在frame PhysicaleValuation_Frame physicaleValuation_Frame = new PhysicaleValuation_Frame(); physicaleValuation_Frame.PhysicaleValuation.ItemsSource = physicaleDTOs; record.Content = physicaleValuation_Frame; } } }