Exemple #1
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;
            }
        }
        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();
        }
Exemple #3
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;
        }
 private void dg_Tubes_LoadingRow(object sender, DataGridRowEventArgs e)
 {
     e.Row.Header = CommFuntion.GetDataGridCellRowIndex(Cell).ToString();
 }