public TubesBatch GetTubesBatchByID(Guid batchID) { try { using (WanTaiEntities entities = new WanTaiEntities()) { TubesBatch record = entities.TubesBatches.Where(c => c.TubesBatchID == batchID).FirstOrDefault(); return(record); } } catch (Exception e) { string errorMessage = e.Message + System.Environment.NewLine + e.StackTrace; LogInfoController.AddLogInfo(LogInfoLevelEnum.Error, errorMessage, SessionInfo.LoginName, this.GetType().ToString() + "->" + "GetTubesBatchByID()", SessionInfo.ExperimentID); throw; } }
private void initDataGrid() { ConfigRotationController rotationController = new ConfigRotationController(); List <RotationInfo> rotationList = rotationController.GetCurrentRotationInfos(experimentId); int startIndex = 1; foreach (RotationInfo rotation in rotationList) { System.Data.DataRow dRow = dataTable.NewRow(); dRow["Number"] = startIndex; dRow["RotationID"] = rotation.RotationID; dRow["RotationName"] = rotation.RotationName; dRow["OperationName"] = rotation.OperationName; dRow["TubesBatchID"] = rotation.TubesBatchID; dRow["State"] = rotationController.ConvertEnumStatusToText((RotationInfoStatus)rotation.State); dRow["logTitle"] = "查看日志"; if (rotation.TubesBatchID != null) { TubesBatch tubeBatch = rotationController.GetTubesBatchByID((Guid)rotation.TubesBatchID); if (tubeBatch != null) { dRow["TubesBatchName"] = tubeBatch.TubesBatchName; } if (new WanTai.Controller.PCR.PCRTestResultViewListController().CheckRotationHasPCRTestResult(rotation.RotationID, experimentId)) { dRow["PCRTestResult"] = "查看"; } } if (startIndex % 2 == 0) { dRow["Color"] = WindowCustomizer.alternativeColor; } else { dRow["Color"] = WindowCustomizer.defaultColor; } dataTable.Rows.Add(dRow); startIndex++; } }
private void Page_Loaded(object sender, RoutedEventArgs e) { try { errorMessage.Text = ""; List <RotationInfo> rotationList = controller.GetCurrentRotationInfos(SessionInfo.ExperimentID); if (rotationList.Count() > 0) { this.create_button.IsEnabled = false; if (SessionInfo.NextButIndex == 1) { this.next_button.IsEnabled = true; } else { this.next_button.IsEnabled = false; } this.save_button.IsEnabled = false; operation_viewcolumn.Visibility = System.Windows.Visibility.Visible; operation_column.Visibility = System.Windows.Visibility.Hidden; foreach (RotationInfo rotation in rotationList) { System.Data.DataRow dRow = dataTable.NewRow(); dRow["Sequence"] = dataTable.Rows.Count + 1; if (rotation.TubesBatchID != null) { dRow["TubesBatchID"] = rotation.TubesBatchID; TubesBatch _tubeBatch = controller.GetTubesBatchByID((Guid)rotation.TubesBatchID); dRow["TubesBatchName"] = _tubeBatch.TubesBatchName; } dRow["OperationName"] = rotation.OperationName; dRow["Operation"] = new OperationConfiguration() { OperationID = rotation.OperationID, OperationName = rotation.OperationName }; dRow["RotationName"] = rotation.RotationName; dRow["deleteIsVisible"] = Visibility.Hidden.ToString(); dataTable.Rows.Add(dRow); } } else { this.create_button.IsEnabled = true; this.next_button.IsEnabled = false; this.save_button.IsEnabled = true; isBelongtoCurrentTubeBatch = true; operation_viewcolumn.Visibility = System.Windows.Visibility.Hidden; operation_column.Visibility = System.Windows.Visibility.Visible; operation_viewcolumn.Visibility = System.Windows.Visibility.Hidden; operation_column.Visibility = System.Windows.Visibility.Visible; tubesBatch = controller.GetLastTubesBatch(); List <OperationConfiguration> operationList = controller.GetDisplayedOperationConfigurations(); operation_column.ItemsSource = operationList; CreateOperation = operationList[0]; } } catch { MessageBox.Show("系统错误!", "系统提示!"); //this.errorMessage.Text = "系统错误!"; } }
private void btn_Save_Click(object sender, RoutedEventArgs e) { btn_Next.IsEnabled = false; if (SessionInfo.ExperimentID == new Guid()) { NewExperiment Experiment = new NewExperiment(); if (!(bool)Experiment.ShowDialog()) { return; } SessionInfo.BatchIndex = 1; } if (SystemFluid.IndexOf("2,") >= 0 || SystemFluid.IndexOf("3,") >= 0) { MessageBox.Show("阴阳对照物必须有!", "系统提示!"); return; } int TotalHole = 2; TubeGroupList = new List <TubeGroup>(); CurrentTubesBatch.TestingItem = new Dictionary <Guid, int>(); bool _SystemFluid = false; foreach (TubeGroup Item in dg_TubesGroup.Items) { if (Item.TestingItemConfigurations.Count == 0) { MessageBox.Show(Item.TubesGroupName + "没有选择检测项目,请选择!", "系统提示!"); return; } foreach (TestingItemConfiguration TestingItem in Item.TestingItemConfigurations) { int TestintItemNumber = Item.TubesNumber / Item.PoolingRulesTubesNumber + (Item.TubesNumber % Item.PoolingRulesTubesNumber > 0 ? 1 : 0); if (CurrentTubesBatch.TestingItem.ContainsKey(TestingItem.TestingItemID)) { CurrentTubesBatch.TestingItem[TestingItem.TestingItemID] += TestintItemNumber; } else { CurrentTubesBatch.TestingItem.Add(TestingItem.TestingItemID, TestintItemNumber); } } TotalHole += Item.TubesNumber / Item.PoolingRulesTubesNumber + (Item.TubesNumber % Item.PoolingRulesTubesNumber > 0 ? 1 : 0); TubeGroupList.Add(Item); if (Item.isComplement) { _SystemFluid = true; } } if (TotalHole > 96) { MessageBox.Show("混样数大于96,无法进行混样!", "系统提示!"); return; } if (_SystemFluid) { if (SystemFluid.IndexOf("1,") >= 0) { MessageBox.Show("没有样品补充液!", "系统提示!"); return; } } string ErrMsg; int ErrType; CurrentTubesBatch = new WanTai.Controller.TubesGroupController().SaveTubesGroup(SessionInfo.ExperimentID, CurrentTubesBatch, SessionInfo.BatchIndex, TubeGroupList, Tubes, out ErrType, out ErrMsg); if (ErrType == -1) { MessageBox.Show(ErrMsg, "系统提示!"); return; } //CurrentTubesBatch.TestingItem = new Dictionary<Guid, int>(); // MessageBox.Show("生成成功!", "系统提示!"); btn_Next.IsEnabled = true; }