Ejemplo n.º 1
0
        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;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void dg_Bules_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            DataGridCellInfo Cell = ((System.Windows.Controls.DataGrid)(e.Source)).CurrentCell;

            if (Cell == null || Tubes == null || Cell.Column == null || Cell.Item == null)
            {
                return;
            }
            if (Tubes.Rows.Count == 0)
            {
                return;
            }
            int ColumnIndex = CommFuntion.GetDataGridCellColumnIndex(Cell);
            int RowIndex    = CommFuntion.GetDataGridCellRowIndex(Cell) - 1;

            if (Tubes.Rows[RowIndex]["TubeType" + ColumnIndex.ToString()].ToString() == "-1")
            {
                MessageBox.Show("当前位置没有采血管!", "系统提示");
                return;
            }
            TubeBarCodeEdit _TubeBarCodeEdit = new TubeBarCodeEdit();

            _TubeBarCodeEdit.Cell = ((System.Windows.Controls.DataGrid)(e.Source)).CurrentCell;
            if ((Boolean)_TubeBarCodeEdit.ShowDialog())
            {
                Tubes.Rows[RowIndex]["BarCode" + ColumnIndex.ToString()] = _TubeBarCodeEdit.txt_BarCode.Text;
            }
        }
Ejemplo n.º 3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.MinHeight = this.MaxHeight = this.Height;

            this.MinWidth = this.MaxWidth = this.Width;

            DataTable table = ((System.Data.DataRowView)(Cell.Item)).DataView.Table;

            dg_Tubes.Columns[0].Header = CommFuntion.GetDataGridCellColumnIndex(Cell).ToString();
            int ColumnIndex = CommFuntion.GetDataGridCellColumnIndex(Cell);
            int RowIndex    = CommFuntion.GetDataGridCellRowIndex(Cell) - 1;

            dg_Tubes.Items.Add(new Tube()
            {
                BarCode = table.Rows[RowIndex]["BarCode" + ColumnIndex.ToString()].ToString(), TextItemCount = table.Rows[RowIndex]["TextItemCount" + ColumnIndex.ToString()].ToString()
            });

            txt_BarCode.Text = table.Rows[RowIndex]["BarCode" + ColumnIndex.ToString()].ToString();
        }
Ejemplo n.º 4
0
        private void btn_Group_Click(object sender, RoutedEventArgs e)
        {
            int TubesNumber = 0;

            List <TubeCell> tubeCells = new List <TubeCell>();
            DataTable       dt        = new DataTable();

            dt.Columns.Add("RowIndex", typeof(int));
            dt.Columns.Add("ColumnIndex", typeof(int));
            dt.Columns.Add("TubeCell", typeof(TubeCell));
            foreach (DataGridCellInfo Cell in dg_Bules.SelectedCells)
            {
                int ColumnIndex = CommFuntion.GetDataGridCellColumnIndex(Cell);
                int RowIndex    = CommFuntion.GetDataGridCellRowIndex(Cell);
                if (Tubes.Rows[RowIndex - 1]["TubeType" + ColumnIndex.ToString()].ToString() != "Tube")
                {
                    if (Tubes.Rows[RowIndex - 1]["TubeType" + ColumnIndex.ToString()].ToString() == "-1")
                    {
                        continue;
                    }
                    if (MessageBox.Show("单元格[" + ColumnIndex.ToString() + "," + RowIndex.ToString() + "]阴阳对应液及样品补充液不能参加分组,是否继续?", "系统提示!", MessageBoxButton.YesNo) == MessageBoxResult.No)
                    {
                        return;
                    }
                    continue;
                }
                //  CellBuilder.Append("[" + ColumnIndex.ToString() + "," + RowIndex.ToString() + "]");
                DataRow drow = dt.NewRow();
                drow["RowIndex"]    = RowIndex;
                drow["ColumnIndex"] = ColumnIndex;
                drow["TubeCell"]    = new TubeCell()
                {
                    ColumnIndex = ColumnIndex, RowIndex = RowIndex, CellValue = "[" + ColumnIndex.ToString() + "," + RowIndex.ToString() + "]"
                };
                dt.Rows.Add(drow);
                TubesNumber++;
            }
            if (dt.Rows.Count == 0)
            {
                MessageBox.Show("没有选择采血管", "系统提示");
                return;
            }

            DataView dView = dt.DefaultView;

            dView.Sort = " ColumnIndex,RowIndex asc";
            StringBuilder CellBuilder = new StringBuilder();

            foreach (DataRow tubeCell in dView.ToTable().Rows)
            {
                string TubesPosition = ((TubeCell)tubeCell["TubeCell"]).CellValue;
                if (string.IsNullOrEmpty(TubesPosition))
                {
                    continue;
                }
                string str = TubesPosition.Remove(0, 1);
                str = str.Substring(0, str.Length - 1);
                int ColumnIndex = int.Parse(str.Split(',')[0]);
                int RowIndex    = int.Parse(str.Split(',')[1]) - 1;
                CellBuilder.Append("[" + ColumnIndex.ToString() + "," + (RowIndex + 1).ToString() + "]");
                Tubes.Rows[RowIndex]["Background" + ColumnIndex.ToString()] = null;
            }

            //foreach (string TubesPosition in CurrentTubesPositions.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]) - 1;
            //    Tubes.Rows[RowIndex]["Background" + ColumnIndex.ToString()] = null;
            //}

            // TubeGroupList.Add(new TubeGroup() { TuubesGroupName = "分组" + (++TuubesGroupName).ToString(), ExperimentID = SessionInfo.ExperimentID, PoolingRulesConfiguration = PoolingRules, PoolingRulesID = PoolingRules.PoolingRulesID, CreateTime = DateTime.Now, TubesPosition = CellBuilder.ToString() });
            int SelectItemIndex = dg_TubesGroup.Items.Add(new TubeGroup()
            {
                isComplement = false, TubesNumber = TubesNumber, RowIndex = (this.RowIndex++), TubesGroupName = "分组" + (++TuubesGroupName).ToString(), ExperimentID = SessionInfo.ExperimentID, PoolingRulesConfiguration = PoolingRules, PoolingRulesName = PoolingRules.PoolingRulesName, PoolingRulesID = PoolingRules.PoolingRulesID, CreateTime = DateTime.Now, TubesPosition = CellBuilder.ToString()
            });

            dg_TubesGroup.SelectedIndex = SelectItemIndex;
            btn_Save.IsEnabled          = true;
        }
Ejemplo n.º 5
0
        private void btn_del_Click(object sender, RoutedEventArgs e)
        {
            if (dg_TubesGroup.SelectedItem != null)
            {
                TubeGroup _TubeGroup = ((TubeGroup)dg_TubesGroup.SelectedItem);
                foreach (string TubesPosition in ((TubeGroup)dg_TubesGroup.SelectedItem).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]);
                    Tubes.Rows[RowIndex - 1]["Background" + ColumnIndex.ToString()] = null;
                    string TextItemCount = Tubes.Rows[RowIndex - 1]["TextItemCount" + ColumnIndex.ToString()].ToString();


                    foreach (TestingItemConfiguration _TestingItemConfiguration in _TubeGroup.TestingItemConfigurations)
                    {
                        TextItemCount = TextItemCount.Replace("," + _TubeGroup.RowIndex.ToString() + ";" + _TestingItemConfiguration.TestingItemColor, "");
                    }
                    Tubes.Rows[RowIndex - 1]["TextItemCount" + ColumnIndex.ToString()] = TextItemCount;
                    Tubes.Rows[RowIndex - 1]["DetailView" + ColumnIndex.ToString()]    = Tubes.Rows[RowIndex - 1]["DetailView" + ColumnIndex.ToString()].ToString().Replace(_TubeGroup.TubesGroupName + " " + _TubeGroup.PoolingRulesName + _TubeGroup.TestintItemName + ",", "");


                    //int i = 0;
                    //while (_TubeGroup.TestingItemConfigurations.Count > i)
                    //{
                    //    TestingItemConfiguration _TestingItemConfiguration = _TubeGroup.TestingItemConfigurations.ToList()[i++];
                    //    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 (_TestingItemConfiguration.TestingItemName == "HBV")
                    //    //    HBVNumber -= _TubeGroup.TubesNumber;
                    //    //if (_TestingItemConfiguration.TestingItemName == "HCV")
                    //    //    HCVNumber -= _TubeGroup.TubesNumber;
                    //    //if (_TestingItemConfiguration.TestingItemName == "HIV")
                    //    //    HIVNumber -= _TubeGroup.TubesNumber;
                    //   // bool b = _TubeGroup.TestingItemConfigurations.Remove(_TubeGroup.TestingItemConfigurations.Where(tic => tic.TestingItemID == _TestingItemConfiguration.TestingItemID).FirstOrDefault());
                    //}
                }
                while (_TubeGroup.TestingItemConfigurations.Count > 0)
                {
                    TestingItemConfiguration _TestingItemConfiguration = _TubeGroup.TestingItemConfigurations.First();

                    ((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());
                }
                dg_TubesGroup.Items.Remove(dg_TubesGroup.SelectedItem);

                for (int i = 0; i < dg_TubesGroup.Items.Count; i++)
                {
                    Label labTuubesGroupName = CommFuntion.FindName(dg_TubesGroup, 0, i, "lab_TubesGroupName") as Label;

                    //  Label labTuubesGroupName = CommFuntion.FindCellControl<Label>("lab_TubesGroupName", dg_TubesGroup, i, 0);
                    if (labTuubesGroupName != null)
                    {
                        labTuubesGroupName.Content = "分组" + (i + 1).ToString();
                    }
                    //  ((TubeGroup)dg_TubesGroup.Items[i]).TuubesGroupName = "分组" + (i+1).ToString();
                    TuubesGroupName = i + 1;
                }

                if (dg_TubesGroup.Items.Count == 0)
                {
                    TuubesGroupName    = 0;
                    btn_Next.IsEnabled = false;
                    btn_Save.IsEnabled = false;
                }
                else
                {
                    dg_TubesGroup.SelectedIndex = TuubesGroupName - 1;
                }
            }
        }
Ejemplo n.º 6
0
 private void dg_Tubes_LoadingRow(object sender, DataGridRowEventArgs e)
 {
     e.Row.Header = CommFuntion.GetDataGridCellRowIndex(Cell).ToString();
 }