示例#1
0
        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());
            }
        }
示例#2
0
        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
                });
            }
        }
示例#3
0
        private void dg_TubesGroup_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;
            }
            if (dg_TubesGroup.Items.Count == 0)
            {
                return;
            }
            dg_Bules.SelectedCells.Clear();
            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;
            }
            CurrentTubesPositions = ((WanTai.DataModel.TubeGroup)(Cell.Item)).TubesPosition;
            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()] = "Green";
            }
        }
示例#4
0
        private void btn_detail_Click(object sender, RoutedEventArgs e)
        {
            // Tubes.Namespace = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            foreach (TubeGroup tubeGroup in dg_TubesGroup.Items)
            {
                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]) - 1;
                    if (DateTime.Parse(Tubes.Rows[RowIndex]["DetailViewTime" + ColumnIndex.ToString()].ToString()) < DateTime.Parse(Tubes.Namespace))
                    {
                        Tubes.Rows[RowIndex]["DetailView" + ColumnIndex.ToString()] = tubeGroup.TubesGroupName;
                    }
                    else
                    {
                        Tubes.Rows[RowIndex]["DetailView" + ColumnIndex.ToString()] += tubeGroup.TubesGroupName;
                    }

                    Tubes.Rows[RowIndex]["DetailView" + ColumnIndex.ToString()] += " " + tubeGroup.PoolingRulesName;

                    //foreach(TestingItemConfiguration TestItem in tubeGroup.TestingItemConfigurations)
                    //    Tubes.Rows[RowIndex]["DetailView" + ColumnIndex.ToString()] += " " + TestItem.TestingItemName;
                    Tubes.Rows[RowIndex]["DetailView" + ColumnIndex.ToString()] += tubeGroup.TestintItemName + ",";

                    Tubes.Rows[RowIndex]["DetailViewTime" + ColumnIndex.ToString()] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                }
            }
            Tubes.Namespace = DateTime.Now.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss");
            TubesDetailView _TubesDetailView = new TubesDetailView();

            _TubesDetailView.Tubes = Tubes;
            _TubesDetailView.ShowDialog();
        }
示例#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;
                }
            }
        }