public void checkBox_Unchecked(object sender, RoutedEventArgs e) { if (dg_TubesGroup.SelectedItem != null) { TestingItemConfiguration _TestingItemConfiguration = (TestingItemConfiguration)(((System.Windows.Controls.CheckBox)(sender)).DataContext); WanTai.DataModel.TubeGroup _TubeGroup = ((WanTai.DataModel.TubeGroup)(dg_TubesGroup.SelectedItem)); foreach (string TubesPosition in _TubeGroup.TubesPosition.Split(']')) { if (string.IsNullOrEmpty(TubesPosition)) { continue; } string str = TubesPosition.Remove(0, 1); int ColumnIndex = int.Parse(str.Split(',')[0]); int RowIndex = int.Parse(str.Split(',')[1]); string TextItemCount = Tubes.Rows[RowIndex - 1]["TextItemCount" + ColumnIndex.ToString()].ToString(); Tubes.Rows[RowIndex - 1]["TextItemCount" + ColumnIndex.ToString()] = TextItemCount.Replace("," + _TubeGroup.RowIndex.ToString() + ";" + _TestingItemConfiguration.TestingItemColor, ""); } ((WanTai.DataModel.TubeGroup)(dg_TubesGroup.SelectedItem)).TestintItemName = ((WanTai.DataModel.TubeGroup)(dg_TubesGroup.SelectedItem)).TestintItemName.Replace(" " + _TestingItemConfiguration.TestingItemName, ""); //if (CurrentTubesBatch.TestingItem == null) // CurrentTubesBatch.TestingItem = new Dictionary<Guid, int>(); //int TestintItemNumber = _TubeGroup.TubesNumber / _TubeGroup.PoolingRulesTubesNumber + (_TubeGroup.TubesNumber % _TubeGroup.PoolingRulesTubesNumber > 0 ? 1 : 0); //if (CurrentTubesBatch.TestingItem.ContainsKey(_TestingItemConfiguration.TestingItemID)) // CurrentTubesBatch.TestingItem[_TestingItemConfiguration.TestingItemID] -= TestintItemNumber; //else // CurrentTubesBatch.TestingItem.Add(_TestingItemConfiguration.TestingItemID, 0); bool b = _TubeGroup.TestingItemConfigurations.Remove(_TubeGroup.TestingItemConfigurations.Where(tic => tic.TestingItemID == _TestingItemConfiguration.TestingItemID).FirstOrDefault()); } }
private void cb_PoolingRulesConfigurations_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (dg_TubesGroup.SelectedItem != null) { WanTai.DataModel.TubeGroup tubeGroup = ((WanTai.DataModel.TubeGroup)(dg_TubesGroup.SelectedItem)); PoolingRulesConfiguration PoolingRules = ((PoolingRulesConfiguration)e.AddedItems[0]); ((WanTai.DataModel.TubeGroup)(dg_TubesGroup.SelectedItem)).PoolingRulesID = ((PoolingRulesConfiguration)e.AddedItems[0]).PoolingRulesID; ((WanTai.DataModel.TubeGroup)(dg_TubesGroup.SelectedItem)).PoolingRulesName = ((PoolingRulesConfiguration)e.AddedItems[0]).PoolingRulesName; ((WanTai.DataModel.TubeGroup)(dg_TubesGroup.SelectedItem)).PoolingRulesTubesNumber = ((PoolingRulesConfiguration)e.AddedItems[0]).TubeNumber; CheckBox ch_Complement = CommFuntion.FindCellControl <CheckBox>("ch_Complement", dg_TubesGroup, dg_TubesGroup.SelectedIndex, 4); if (ch_Complement != null) { if ((tubeGroup.TubesPosition.Split(']').Length - 1) % PoolingRules.TubeNumber > 0) { ch_Complement.IsEnabled = true; if (MessageBox.Show("该分组需要补液,是否补液?", "系统提示!", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { ch_Complement.IsChecked = true; } else { ch_Complement.IsChecked = false; } } else { ch_Complement.IsEnabled = false; ch_Complement.IsChecked = false; } } } }
public void checkBox_Checked(object sender, RoutedEventArgs e) { if (dg_TubesGroup.SelectedItem != null) { TestingItemConfiguration _TestingItemConfiguration = (TestingItemConfiguration)(((System.Windows.Controls.CheckBox)(sender)).DataContext); WanTai.DataModel.TubeGroup tubeGroup = ((WanTai.DataModel.TubeGroup)(dg_TubesGroup.SelectedItem)); string TubesPositions = tubeGroup.TubesPosition; foreach (string TubesPosition in TubesPositions.Split(']')) { if (string.IsNullOrEmpty(TubesPosition)) { continue; } string str = TubesPosition.Remove(0, 1); int ColumnIndex = int.Parse(str.Split(',')[0]); int RowIndex = int.Parse(str.Split(',')[1]); string TextItemCount = Tubes.Rows[RowIndex - 1]["TextItemCount" + ColumnIndex.ToString()].ToString() + "," + tubeGroup.RowIndex.ToString() + ";" + _TestingItemConfiguration.TestingItemColor; Tubes.Rows[RowIndex - 1]["TextItemCount" + ColumnIndex.ToString()] = TextItemCount.ToString(); } //((System.Data.DataRowView)(dg_Bules.Items[0]))._row.ItemArray[5] = "2"; //dg_Bules.ItemsSource = null; // dg_Bules.ItemsSource = Tubes.DefaultView; //var query = from d in Dic_BandRate // where d.Value == 9600 // select d.Key; // if(CurrentTubesBatch.TestingItem==null) // CurrentTubesBatch.TestingItem =new Dictionary<Guid,int>(); // int TestintItemNumber = tubeGroup.TubesNumber / tubeGroup.PoolingRulesTubesNumber + (tubeGroup.TubesNumber % tubeGroup.PoolingRulesTubesNumber > 0 ? 1 : 0); // if (CurrentTubesBatch.TestingItem.ContainsKey(_TestingItemConfiguration.TestingItemID)) // CurrentTubesBatch.TestingItem[_TestingItemConfiguration.TestingItemID] += TestintItemNumber; //else // CurrentTubesBatch.TestingItem.Add(_TestingItemConfiguration.TestingItemID, TestintItemNumber); ((WanTai.DataModel.TubeGroup)(dg_TubesGroup.SelectedItem)).TestintItemName = ((WanTai.DataModel.TubeGroup)(dg_TubesGroup.SelectedItem)).TestintItemName + " " + _TestingItemConfiguration.TestingItemName; // ((WanTai.DataModel.TubeGroup)(dg_TubesGroup.SelectedItem)).TestingItemConfigurations.Add(IestingItemList.Where(tic => tic.TestingItemID == _TestingItemConfiguration.TestingItemID).FirstOrDefault()); ((WanTai.DataModel.TubeGroup)(dg_TubesGroup.SelectedItem)).TestingItemConfigurations.Add(new TestingItemConfiguration() { TestingItemID = _TestingItemConfiguration.TestingItemID, TestingItemName = _TestingItemConfiguration.TestingItemName, TestingItemColor = _TestingItemConfiguration.TestingItemColor }); } }